]> Cypherpunks repositories - gostls13.git/commit
syscall/js: handle interleaved functions correctly
authorRichard Musiol <mail@richard-musiol.de>
Sat, 2 Nov 2019 20:20:24 +0000 (21:20 +0100)
committerRichard Musiol <neelance@gmail.com>
Sat, 23 Nov 2019 09:35:22 +0000 (09:35 +0000)
commitc2e2296dd7dea68de4a45d8dc82b1920130eb74a
tree134d65e67c6fd40a6c85ab356ef3f6f1441fcfd1
parent688aa748579f07552a50d2534eccb16afda4174b
syscall/js: handle interleaved functions correctly

Because of concurrent goroutines it is possible for multiple event
handlers to return at the same time. This was not properly supported
and caused the wrong goroutine to continue, which in turn caused
memory corruption.

This change adds a stack of events so it is always clear which is the
innermost event that needs to return next.

Fixes #35256

Change-Id: Ia527da3b91673bc14e84174cdc407f5c9d5a3d09
Reviewed-on: https://go-review.googlesource.com/c/go/+/204662
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/runtime/lock_js.go
src/syscall/js/js_test.go