]> Cypherpunks repositories - gostls13.git/commit
all: add support for synchronous callbacks to js/wasm
authorRichard Musiol <mail@richard-musiol.de>
Thu, 11 Oct 2018 10:46:14 +0000 (12:46 +0200)
committerRichard Musiol <neelance@gmail.com>
Sat, 10 Nov 2018 11:57:17 +0000 (11:57 +0000)
commit6dd70fc5e391eb7a47be5eb6353107f38b73f161
treee5ba2aa9f1dcaa4ab396417129b0a04c27b8d0e9
parente3e043bea4d7547edf004a9e202f66a4d69b5899
all: add support for synchronous callbacks to js/wasm

With this change, callbacks returned by syscall/js.NewCallback
get executed synchronously. This is necessary for the APIs of
many JavaScript libraries.

A callback triggered during a call from Go to JavaScript gets executed
on the same goroutine. A callback triggered by JavaScript's event loop
gets executed on an extra goroutine.

Fixes #26045
Fixes #27441

Change-Id: I591b9e85ab851cef0c746c18eba95fb02ea9e85b
Reviewed-on: https://go-review.googlesource.com/c/142004
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
13 files changed:
misc/wasm/wasm_exec.js
src/cmd/internal/obj/wasm/a.out.go
src/cmd/internal/obj/wasm/wasmobj.go
src/cmd/link/internal/wasm/asm.go
src/net/http/roundtrip_js.go
src/runtime/lock_futex.go
src/runtime/lock_js.go
src/runtime/lock_sema.go
src/runtime/proc.go
src/runtime/rt0_js_wasm.s
src/syscall/fs_js.go
src/syscall/js/callback.go
src/syscall/js/js_test.go