Contact emails
f...@chromium.org, thiba...@chromium.org, irez...@chromium.org


Explainer
https://github.com/WebAssembly/js-promise-integration/blob/main/proposals/js-promise-integration/Overview.md


Specification
https://github.com/WebAssembly/js-promise-integration/blob/main/proposals/js-promise-integration/Overview.md


Design docs

https://docs.google.com/document/d/16Us-pyte2-9DECJDfGm5tnUpfngJJOc8jbj54HMqE9Y/edit#heading=h.n1atlriavj6v


Summary

JavaScript Promise Integration (JSPI) is an API that allows WebAssembly 
applications to integrate with JavaScript Promises. It allows a WebAssembly 
program to act as the generator of a Promise, and it allows the WebAssembly 
program to interact with Promise-bearing APIs. In particular, when an 
application uses JSPI to call a Promise-bearing (JavaScript) API, the 
WebAssembly code is suspended; and the original caller to the WebAssembly 
program is given a Promise that will be fulfilled when the WebAssembly program 
finally completes. JSPI is described in more detail in 
https://github.com/WebAssembly/js-promise-integration which is part of the W3C 
WebAssembly standards track. See also 
https://github.com/WebAssembly/stack-switching and 
https://github.com/WebAssembly/meetings/tree/main/stack.



Blink component
Blink>JavaScript>WebAssembly


Search tags
stack switching, Promise, JSPI


TAG review
https://github.com/w3ctag/design-reviews/issues/809 Review was declined, 
deferring to W3C WebAssembly CG


TAG review status
Issues addressed


Origin Trial Name
WebAssembly JavaScript Promise Integration


Chromium Trial Name
WebAssemblyJSPromiseIntegration


Origin Trial documentation link
https://github.com/WebAssembly/js-promise-integration


WebFeature UseCounter name
kV8WasmJavaScriptPromiseIntegration


Risks




Interoperability and Compatibility

This spec is backed by a standardization effort. We do not plan to ship the 
JSPI until it has been standardized by the W3C Wasm WG. However, post 
standardization, we will depend on all browsers implementing the standard.


Gecko: Positive (https://bugzilla.mozilla.org/show_bug.cgi?id=1850627) Mozilla 
have started their own imlementation

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/422)

Web developers: No signals

Other signals:


Activation

Making use of JSPI requires some changes by WebAssembly-based developers (no 
impact on JavaScript developers). Depending on their toolchain usage a 
developer will need to modify their code. For Emscripten users, this is likely 
to be minimal as support for JSPI exists in Emscripten.



Security

1. Control flow integrity. 2. Ensuring that JavaScript programs cannot suspend 
via JSPI. 3. Ensuring that heap sandbox escapes are not possible.



WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it 
has potentially high risk for Android WebView-based applications?

No.




Debuggability

Developers can piggyback on existing DevTools support for Promises to help with 
debugging JSPI applications. In particular the existing mechanisms for 
constructing extended stack traces from so-called Promise chains will also 
include stack traces from JSPI applications.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, 
ChromeOS, Android, and Android WebView)?
Yes


Is this feature fully tested by web-platform-tests?
Yes
https://wpt.fyi/results/wasm/jsapi/jspi



Flag name on about://flags
enable-experimental-webassembly-stack-switching


Finch feature name
None


Non-finch justification
None


Rollout plan
Will ship enabled for all users


Requires code in //chrome?
False


Tracking bug
https://bugs.chromium.org/p/v8/issues/detail?id=12191&q=owner%3Ame&can=2


Measurement
https://chromestatus.com/metrics/feature/timeline/popularity/4760


Availability expectation
JSPI will be available on Chrome (including Edge) and on FireFox at launch. No 
specific indication about availability on Safari.


Adoption expectation
1. We expect that JSPI will be used by both 1P and 3P partners within a few 
months of launch.


Adoption plan
1. There has been an origin trial running for one year. This OT has > 300 
registrants at time of writing. 2. We will be publishing V8.dev blog posts both 
about the feature (see https://v8.dev/blog/jspi-newapi) and its implementation. 
We believe that this will further increase awareness of JSPI. 3. We will also 
benefit from awareness of WebAssembly and the W3C wasm CG.


Non-OSS dependencies

Does the feature depend on any code or APIs outside the Chromium open source 
repository and its open-source dependencies to function?
no.


Estimated milestones


Shipping on desktop 137

Origin trial desktop first 123

Origin trial desktop last 131

Origin trial extension 1 end milestone 131

Origin trial extension 2 end milestone 133

Origin trial extension 3 end milestone 136

DevTrial on desktop 109

Shipping on Android 137

Origin trial Android first 123

Origin trial Android last 131

Shipping on WebView 137

Origin trial WebView first 123

Origin trial WebView last 131




Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop 
issues. Please list open issues (eg links to known github issues in the project 
for the feature specification) whose resolution may introduce web 
compat/interop risk (eg, changing to naming or structure of the API in a 
non-backward-compatible way).
No spec changes anticipated. JSPI is part of a W3C standards process (see 
https://github.com/WebAssembly). We plan to ship after this spec reaches 'stage 
4' which represents a completed specification.


Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5674874568704000?gate=5851957764292608


Links to previous Intent discussions
Intent to Prototype: 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAAdKk6BGFseZ6pBO2qEW_xeovVw1_guVq26rcNM1nWY442Y5Ng%40mail.gmail.com
Intent to Experiment: 
https://groups.google.com/a/chromium.org/g/blink-dev/c/Fu79zrp7MoE
Intent to Extend Experiment 1: 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CALi9WK-JJNTYSeNdSuai827Qg5%3D2vZo-emYP2z-5vJOfE%2B8Nng%40mail.gmail.com
Intent to Extend Experiment 2: 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/67103777.2b0a0220.137ef7.0e4c.GAE%40google.com
Intent to Extend Experiment 3: 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAE65UWDsoPqTePz3S42YsV2_Wr3OGL6yY2YdsS6oOYw3Rh8%2Bww%40mail.gmail.com



This intent message was generated by Chrome Platform Status.

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/67f54f82.170a0220.374483.0000.GAE%40google.com.

Reply via email to