fix(core): preserve WebAssembly streaming callback across new contexts (#34679)
WebAssembly.compileStreaming and WebAssembly.instantiateStreaming broke after creating a new context with node:vm (e.g. via happy-dom's new Window()) or after attaching the inspector. Subsequent calls rejected Response arguments with "WebAssembly.compile(): Argument 0 must be a buffer source", even though the same code worked moments earlier and works in Node. The cause is in deno_core. The streaming callback is installed lazily from JS, so deno_core set the --wasm-test-streaming V8 flag to force V8 to install compileStreaming/instantiateStreaming at all. That flag also makes V8 reset the isolate-wide streaming callback to its own testing callback every time it re-creates the WebAssembly object, which happens on every new context (node:vm) and when the inspector attaches. The testing callback only accepts BufferSource arguments, hence the error. This installs the streaming callback natively at isolate creation, the same way Node does, and drops the --wasm-test-streaming flag so V8 no longer overwrites it. op_set_wasm_streaming_callback now only stores the JS handler; the v8-level callback is set once and survives later context creation. Fixes #34677 Fixes #21508
B
Bartek Iwańczuk committed
619742f0c77ff1aefe94c6a8095d3dbe8d168fc8
Parent: e086b32
Committed by GitHub <noreply@github.com>
on 6/2/2026, 6:55:42 AM