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>
This commit is contained in:
Hajime Hoshi 2020-05-06 23:00:58 +09:00
parent 8c1db77a92
commit a0698a6b60
2 changed files with 32 additions and 27 deletions

View file

@ -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())
}
}