mirror of
https://github.com/denoland/deno.git
synced 2025-07-24 13:44:08 +00:00
fix(fetch): Fix uncaught rejection panic with WebAssembly.instantiateStreaming
(#13925)
When an exception is thrown during the processing of streaming WebAssembly, `op_wasm_streaming_abort` is called. This op calls into V8, which synchronously rejects the promise and calls into the promise rejection handler, if applicable. But calling an op borrows the isolate's `JsRuntimeState` for the duration of the op, which means it is borrowed when V8 calls into `promise_reject_callback`, which tries to borrow it again, panicking. This change changes `op_wasm_streaming_abort` from an op to a binding (`Deno.core.abortWasmStreaming`). Although that binding must borrow the `JsRuntimeState` in order to access the `WasmStreamingResource` stored in the `OpTable`, it also takes ownership of that `WasmStreamingResource` instance, which means it can drop any borrows of the `JsRuntimeState` before calling into V8.
This commit is contained in:
parent
c5792d6d1d
commit
12d28dffc6
6 changed files with 60 additions and 26 deletions
|
@ -556,7 +556,7 @@
|
|||
core.close(rid);
|
||||
} catch (err) {
|
||||
// 2.8 and 3
|
||||
core.opSync("op_wasm_streaming_abort", rid, err);
|
||||
core.abortWasmStreaming(rid, err);
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue