From a0698a6b60952f80e2136df0699325b657ea0def Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 6 May 2020 23:00:58 +0900 Subject: 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 TryBot-Result: Gobot Gobot Reviewed-by: Richard Musiol --- src/syscall/js/js_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/syscall') 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()) + } +} -- cgit v1.3-5-g9baa