Lightpanda: the headless browser designed for AI and automation
wasm: don't re-enter V8 when an exception is already pending
Adrià Arrufat6209893a5b47
diff --git a/src/browser/js/WasmStreaming.zig b/src/browser/js/WasmStreaming.zigindex 835973357..38d4bb9e1 100644--- a/src/browser/js/WasmStreaming.zig+++ b/src/browser/js/WasmStreaming.zig@@ -115,10 +115,13 @@ fn abortTypeError(self: *WasmStreaming, local: *const js.Local, message: []constself.abort(local.isolate.createTypeError(message));}-// Body accessors report a TypeError through the context's error_message,-// the same way the bridge surfaces it to JS.+/// Body accessors report a TypeError through the context's error_message,+/// the same way the bridge surfaces it to JS.fn abortZigError(self: *WasmStreaming, local: *const js.Local, err: anyerror) void {switch (err) {+ // An exception is already pending, or the script is being killed.+ // Aborting would re-enter V8 and replace it with a catchable error.+ error.TryCatchRethrow, error.JsException, error.ExecutionTerminated => self.release(),error.TypeError => {const env = local.ctx.env;self.abortTypeError(local, env.error_message orelse "Response body is not usable");