WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
308136
WebAssembly.compileStreaming + instantiate does not work with JS string builtins.
https://bugs.webkit.org/show_bug.cgi?id=308136
Summary
WebAssembly.compileStreaming + instantiate does not work with JS string built...
konsoletyper
Reported
2026-02-18 09:49:08 PST
## Steps to reproduce 1. Open a web page with following content: ``` <html> <body> <script> async function testStrings2() { let bytes = new Int8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 7, 1, 96, 1, 127, 1, 100, 111, 2, 31, 1, 14, 119, 97, 115, 109, 58, 106, 115, 45, 115, 116, 114, 105, 110, 103, 12, 102, 114, 111, 109, 67, 104, 97, 114, 67, 111, 100, 101, 0, 0, 3, 1, 0, 5, 4, 1, 1, 0, 0, 7, 10, 1, 6, 109, 101, 109, 111, 114, 121, 2, 0, 10, -127, -128, -128, 0, 0]); let supported = true; try { let response = new Response(bytes, { headers: { "Content-Type": "application/wasm" } }); let module = await WebAssembly.compileStreaming(response, { builtins: ["js-string"] }); await WebAssembly.instantiate(module, {}, { builtins: ["js-string"] }); } catch (e) { supported = false; } if (supported) { console.log("String builtins are *supported* in your browser (new check 2)"); } else { console.log("String builtins are *not* supported in your browser (new check 2)"); } } async function testStrings() { let bytes = new Int8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 7, 1, 96, 1, 127, 1, 100, 111, 2, 31, 1, 14, 119, 97, 115, 109, 58, 106, 115, 45, 115, 116, 114, 105, 110, 103, 12, 102, 114, 111, 109, 67, 104, 97, 114, 67, 111, 100, 101, 0, 0, 3, 1, 0, 5, 4, 1, 1, 0, 0, 7, 10, 1, 6, 109, 101, 109, 111, 114, 121, 2, 0, 10, -127, -128, -128, 0, 0]); let supported = true; try { await WebAssembly.instantiate(bytes, {}, { builtins: ["js-string"] }); } catch (e) { supported = false; } if (supported) { console.log("String builtins are *supported* in your browser (new check)"); } else { console.log("String builtins are *not* supported in your browser (new check)"); } } function testStringsOld() { let bytes = new Int8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 2, 23, 1, 14, 119, 97, 115, 109, 58, 106, 115, 45, 115, 116, 114, 105, 110, 103, 4, 99, 97, 115, 116, 0, 0, 3, 1, 0, 5, 4, 1, 1, 0, 0, 10, -127, -128, -128, 0, 0]); let supported = !WebAssembly.validate(bytes, { builtins: ["js-string"] }); if (supported) { console.log("String builtins are *supported* in your browser (old check)"); } else { console.log("String builtins are *not* supported in your browser (old check)"); } } testStrings(); testStrings2(); testStringsOld(); </script> </body> </html> ``` 2. Open developer console ## Expected result ``` String builtins are *supported* in your browser (old check) String builtins are *supported* in your browser (new check) String builtins are *supported* in your browser (new check 2) ``` ## Actual result ``` String builtins are *supported* in your browser (old check) String builtins are *supported* in your browser (new check) String builtins are *not* supported in your browser (new check 2) ``` the exception message is: "TypeError: import wasm:js-string:fromCharCode must be an object" ## Notes I tried with various combinations. Looks like compile + instantiate works as well. More context. After updating to Safari 26.2 users started complaining on the code that used to work with prior versions of Safari and with all other major browsers. Safari before 26.2 did not support JS string builtins, so my runtime detected string builtins support and provided polyfill on absence. As a workaround I improved feature detection to use the approach from `testStrings2`. I also tried with Epiphany, but it looks like the version on my machine does not include support for JS string builtins. The module, encoded by the byte sequence in the example is following: ``` (module (; 0000000b ;) (type (; 0 ;) (; 0000000b ;) (func (; 0000000d ;) (param i32) (; 0000000f ;) (result (ref extern) ) ) (; 00000011 ;) (import "wasm:js-string" "fromCharCode" (func (; 0 ;) (type 0) (param (; 0 ;) i32) (result (ref extern) )) ) ) ```
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2026-02-23 09:06:31 PST
<
rdar://problem/170989896
>
Vassili Bykov
Comment 2
2026-02-23 16:53:49 PST
Pull request:
https://github.com/WebKit/WebKit/pull/59278
EWS
Comment 3
2026-02-25 14:28:48 PST
Committed
308234@main
(e075761ea48f): <
https://commits.webkit.org/308234@main
> Reviewed commits have been landed. Closing PR #59278 and removing active labels.
WebKit Commit Bot
Comment 4
2026-02-25 20:22:14 PST
Re-opened since this is blocked by
bug 308698
Vassili Bykov
Comment 5
2026-02-26 13:48:33 PST
Pull request:
https://github.com/WebKit/WebKit/pull/59534
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug