Skip to content

Conversation

x1unix
Copy link
Owner

@x1unix x1unix commented Mar 12, 2022

Our playground uses special proxy object to inject/customize global scope of Go's WebAssembly bridge (wasm_exec.js) by wrapping globalThis with proxy object.

Some window calls, like window.alert require that execution context object should be window.

When proxy object passed instead, occurs an error:

TypeError: 'alert' called on an object that does not implement interface Window

Prototype swap by using setPrototypeOf also doesn't work.

This PR adds method owner check during method call as a workaround, which replaces proxy object with original window during call on any window member method (like alert()).

@x1unix x1unix added this to the 1.8.0 milestone Mar 12, 2022
@x1unix x1unix merged commit 55d7470 into master Mar 12, 2022
@x1unix x1unix deleted the fix/wasm-method-calls branch March 12, 2022 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant