Lightpanda: the headless browser designed for AI and automation
throwing start on ReadableStream properly throws
Muki Kiboigo74849daf4d0d
diff --git a/src/browser/tests/streams/readable_stream.html b/src/browser/tests/streams/readable_stream.htmlindex fe6f4c2cd..1216e3afa 100644--- a/src/browser/tests/streams/readable_stream.html+++ b/src/browser/tests/streams/readable_stream.html@@ -451,6 +451,19 @@});</script>+<script id=readable_stream_start_throws>+ {+ const e = new Error('boom');+ let caught;+ try {+ new ReadableStream({ start() { throw e; } });+ } catch (x) {+ caught = x;+ }+ testing.expectEqual(e, caught);+ }+</script>+<script id=stored_error type=module>const state = await testing.async();diff --git a/src/browser/webapi/streams/ReadableStream.zig b/src/browser/webapi/streams/ReadableStream.zigindex 72ee1bf22..2930ad79f 100644--- a/src/browser/webapi/streams/ReadableStream.zig+++ b/src/browser/webapi/streams/ReadableStream.zig@@ -83,22 +83,7 @@ pub fn init(src_: ?UnderlyingSource, strategy_: ?QueueingStrategy, exec: *constif (src_) |src| {if (src.start) |start| {- const local = exec.js.local.?;- var try_catch: js.TryCatch = undefined;- try_catch.init(local);- defer try_catch.deinit();-- start.callRethrow(void, .{self._controller}) catch |err| {- if (err == error.JsException or err == error.TryCatchRethrow) {- if (try_catch.exceptionValue()) |exc| {- try self._controller.errorWithValue(exc);- } else {- return err;- }- } else {- return err;- }- };+ try start.callRethrow(void, .{self._controller});}if (src.cancel) |callback| {