]> Cypherpunks repositories - gostls13.git/commit
syscall/js: garbage collect references to JavaScript values
authorRichard Musiol <mail@richard-musiol.de>
Sat, 26 Oct 2019 19:01:32 +0000 (21:01 +0200)
committerBrad Fitzpatrick <bradfitz@golang.org>
Mon, 4 Nov 2019 22:50:43 +0000 (22:50 +0000)
commit54e6ba6724dfde355070238f9abc16362cac2e3d
tree545a12103881cfa87f536865a8cf0bfd9e85b731
parent063d0f11e535edf61d1e0b4ba16cfeae0f312bcf
syscall/js: garbage collect references to JavaScript values

The js.Value struct now contains a pointer, so a finalizer can
determine if the value is not referenced by Go any more.

Unfortunately this breaks Go's == operator with js.Value. This change
adds a new Equal method to check for the equality of two Values.
This is a breaking change. The == operator is now disallowed to
not silently break code.

Additionally the helper methods IsUndefined, IsNull and IsNaN got added.

Fixes #35111

Change-Id: I58a50ca18f477bf51a259c668a8ba15bfa76c955
Reviewed-on: https://go-review.googlesource.com/c/go/+/203600
Run-TryBot: Richard Musiol <neelance@gmail.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
misc/wasm/wasm_exec.js
src/net/http/roundtrip_js.go
src/syscall/fs_js.go
src/syscall/js/export_test.go [new file with mode: 0644]
src/syscall/js/func.go
src/syscall/js/js.go
src/syscall/js/js_js.s
src/syscall/js/js_test.go