-
Notifications
You must be signed in to change notification settings - Fork 456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[js-api] Properly wrap invocation of JavaScript functions to ensure incumbent/entry settings setup #1184
Comments
Ms2ger
added a commit
to web-platform-tests/wpt
that referenced
this issue
Jun 19, 2020
Substantially based on #21206. Ref: WebAssembly/spec#1184.
Ms2ger
added a commit
to web-platform-tests/wpt
that referenced
this issue
Jun 23, 2020
Substantially based on #21206. Ref: WebAssembly/spec#1184.
Ms2ger
added a commit
that referenced
this issue
Jun 23, 2020
Ms2ger
added a commit
that referenced
this issue
Jun 24, 2020
Ms2ger
added a commit
to web-platform-tests/wpt
that referenced
this issue
Jun 24, 2020
Substantially based on #21206. Ref: WebAssembly/spec#1184.
moz-v2v-gh
pushed a commit
to mozilla/gecko-dev
that referenced
this issue
Jul 1, 2020
…mbly host functions., a=testonly Automatic update from web-platform-tests Test entry/incumbent globals for WebAssembly host functions. Substantially based on #21206. Ref: WebAssembly/spec#1184. -- wpt-commits: 7fd07ecb9e031cc499962ecc61d8a3e8c32650e3 wpt-pr: 24250
hsivonen
pushed a commit
to hsivonen/gecko
that referenced
this issue
Jul 3, 2020
…mbly host functions., a=testonly Automatic update from web-platform-tests Test entry/incumbent globals for WebAssembly host functions. Substantially based on #21206. Ref: WebAssembly/spec#1184. -- wpt-commits: 7fd07ecb9e031cc499962ecc61d8a3e8c32650e3 wpt-pr: 24250
i3roly
pushed a commit
to i3roly/firefox-dynasty
that referenced
this issue
Jun 1, 2024
…mbly host functions., a=testonly Automatic update from web-platform-tests Test entry/incumbent globals for WebAssembly host functions. Substantially based on #21206. Ref: WebAssembly/spec#1184. -- wpt-commits: 7fd07ecb9e031cc499962ecc61d8a3e8c32650e3 wpt-pr: 24250
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://webassembly.github.io/spec/js-api/#run-a-host-function calls a JS function. It may need to wrap that function in appropriate calls to prepare to run a callback and prepare to run script, in order to properly set up the incumbent and entry realms.
I am not familiar enough with the spec to know if this is the case, but the scenario in which this wrapping is needed is if the function is ever passed to user agent code in one place, and then called later, asynchronously. This asynchronicity could be explicit, e.g. by posting a task or microtask; or it could be implicit, e.g. by storing the function in a data structure and then later letting the web developer cause it to be invoked arbitrarily later.
If it is necessary, then you need to store the incumbent settings object at the time of first passing the function to UA code. Then, when it is time to call the function in "run a host function", you prepare to run script with the function's [[Realm]]'s relevant settings object, and prepare to run a callback with the stored incumbent settings object.
This can be tested by looking at the impact on entry/incumbent web APIs of indirecting through "run a host function". For example, see web-platform-tests/wpt#21206 for the impact of indirecting through promise jobs. (The promise tests are likely a bit more complicated than would apply here since they have to deal with the multiple ways of smuggling a function into the promise infrastructure, e.g. thenables vs. fulfillment handlers vs. rejection handlers.)
The text was updated successfully, but these errors were encountered: