aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHajime Hoshi <hajimehoshi@gmail.com>2020-05-06 23:00:58 +0900
committerHajime Hoshi <hajimehoshi@gmail.com>2020-05-12 15:01:56 +0000
commita0698a6b60952f80e2136df0699325b657ea0def (patch)
treeb79f15bf02fcfe68161061ccdf4a419adb50bf0c /src
parent8c1db77a92b1d17d3fe07999c5f20602a2080be9 (diff)
downloadgo-a0698a6b60952f80e2136df0699325b657ea0def.tar.xz
syscall/js: prepare IDs for the preset objects
Fixes #38899 Change-Id: Ib8131c3078c60dc3fe2cf0eaac45b25a4f6e4649 Reviewed-on: https://go-review.googlesource.com/c/go/+/232518 Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Richard Musiol <neelance@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/syscall/js/js_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/syscall/js/js_test.go b/src/syscall/js/js_test.go
index fea4c135af..5fc9107d40 100644
--- a/src/syscall/js/js_test.go
+++ b/src/syscall/js/js_test.go
@@ -591,3 +591,14 @@ func BenchmarkDOM(b *testing.B) {
document.Get("body").Call("removeChild", div)
}
}
+
+func TestGlobal(t *testing.T) {
+ ident := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ return args[0]
+ })
+ defer ident.Release()
+
+ if got := ident.Invoke(js.Global()); !got.Equal(js.Global()) {
+ t.Errorf("got %#v, want %#v", got, js.Global())
+ }
+}