]> Cypherpunks repositories - gostls13.git/commit
syscall/js: use stable references to JavaScript values
authorRichard Musiol <mail@richard-musiol.de>
Sun, 24 Jun 2018 15:23:38 +0000 (17:23 +0200)
committerPaul Jolly <paul@myitcv.org.uk>
Tue, 26 Jun 2018 16:40:09 +0000 (16:40 +0000)
commit8997ec1c4e01b01f9950f0869085ef5be6d45ef0
treeb69c255f170e99e9bff891f16765cb500cc9bff4
parentd89efc3c06edd25c686717003b4b82e864d7d0bc
syscall/js: use stable references to JavaScript values

This commit changes how JavaScript values are referenced by Go code.
After this change, a JavaScript value is always represented by the same
ref, even if passed multiple times from JavaScript to Go. This allows
Go's == operator to work as expected on js.Value (strict equality).
Additionally, the performance of some operations of the syscall/js
package got improved by saving additional roundtrips to JavaScript code.

Fixes #25802.

Change-Id: Ide6ffe66c6aa1caf5327a2d3ddbe48fe7c180461
Reviewed-on: https://go-review.googlesource.com/120561
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
misc/wasm/wasm_exec.js
src/cmd/vet/all/whitelist/wasm.txt
src/syscall/js/js.go
src/syscall/js/js_js.s
src/syscall/js/js_test.go