WebAssembly JSPI has a new API
WebAssembly JavaScript Promise Integration (JSPI) ships a revised API in Chrome M126 that drops explicit Suspender objects and instead uses the most recent JS-to-Wasm export call as the suspension cut point. The new API consists of WebAssembly.promising() to wrap exports and a WebAssembly.Suspending constructor to mark imports, removing the dependency on the Type Reflection proposal. Suspending imports now only suspend when the JS function actually returns a Promise, which avoids unnecessary event-loop trips. Emscripten 3.1.61+ users need no code changes, the old API is removed after Chrome M128, and V8 is working on growable (segmented) stacks so that millions of suspended coroutines become feasible.
Related posts
- Introducing the WebAssembly JavaScript Promise Integration API
V8 mediumAdeptJSPI lets WebAssembly code written against synchronous APIs call asynchronous Web APIs. It intercepts Promises returned from wrapped JavaScript imports, suspends the Wasm computation, and resumes it from the browser's event loop when the Promise resolves. Wrapped exports return a Promise instead of a direct value. JSPI changes neither JavaScript nor Wasm, and suspend/resume costs are roughly constant: a deliberately bad Promise-based Fibonacci benchmark puts each JSPI'd call at about 1μs. The API is at phase 4 and ships in Chrome 137 and Firefox 139. Emscripten examples show `-s JSPI` with `EM_ASYNC_JS`, plus a trampoline pattern that lazily fetches and instantiates a Wasm module on first call.
- Bringing Javascript to WebAssembly for Shopify Functions
Shopify Engineering mediumAdeptShopify runs JavaScript in Shopify Functions by compiling the QuickJS interpreter to WebAssembly/WASI via Javy. JIT engines like V8 can't run inside Wasm, so QuickJS fills the gap. Embedding the engine with the user's bytecode produced modules of 800KB or more, well over the 256KB limit. Shopify got around this with an ad-hoc dynamic linking scheme built on Wasmtime's linker: a shared "javy_quickjs_provider_v1" library exposes realloc and eval_bytecode, so each function shrinks to a roughly 220-byte stub plus its bytecode, and the engine can be precompiled and patched centrally. The minimal Javy runtime adds POSIX-like stdin/stdout APIs on a Javy global and a Rust-implemented UTF-8 TextEncoder/TextDecoder, but does not yet enable the event loop.
- What's coming to JavaScript
Deno mediumAdeptTC39's 108th meeting advanced nine JavaScript proposals. Explicit Resource Management (`using`/`await using` with `Symbol.dispose`), `Array.fromAsync` and `Error.isError` reached stage 4, and Immutable `ArrayBuffer` (`transferToImmutable`, `sliceToImmutable`) reached stage 3. Earlier-stage proposals include seeded PRNGs, `Number.prototype.clamp`, `Intl.NumberFormat` trailing-zero control, a standard value-inspection format for diffs, and a `Random` namespace for sampling and shuffling. Each proposal comes with code examples and runtime support status, and Deno plans to use immutable buffers to avoid copies and disposable `AsyncContext.Variable` to simplify tracing spans.
- Why is WebAssembly a second-class language on the web?
Mozilla Hacks mediumAdeptWebAssembly remains second-class on the web because it can only load code and reach Web APIs through JavaScript. That forces arcane instantiation boilerplate, language-specific glue code from tools like wasm-bindgen and embind, JS-centric documentation, and real runtime overhead. A 2020 TodoMVC experiment with the Dodrio Rust framework found that removing JS glue cut DOM-update time by 45%. The esm-integration proposal, being implemented in Firefox, simplifies loading, and the WebAssembly Component Model with WIT interfaces is proposed as a standardized artifact that could let Wasm call Web APIs directly with no JavaScript in between.
- WebKit Features for Safari 26.6
WebKit mediumAdeptSafari 26.6 adds a compileOptions parameter to WebAssembly.compileStreaming() and instantiateStreaming(), so Wasm JS String Builtins (shipped in Safari 26.2) can be enabled without giving up streaming compilation. The release also brings eight bug fixes. These include the CSS `ic` unit scaling incorrectly with zoom, position-area fallback for fixed elements, and partitioned cookie deletion via WKHTTPCookieStore. Other fixes auto-unregister service workers with missing scripts and correct RTCPeerConnection relay-only ICE gathering on macOS Sequoia.