summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Streams
diff options
context:
space:
mode:
authorMatthew Olsson <matthewcolsson@gmail.com>2023-04-13 16:46:31 -0700
committerLinus Groh <mail@linusgroh.de>2023-04-14 13:03:34 +0200
commitdb1be40b1319b3417d8e74fe2fc39b393fa7f15b (patch)
tree27a9a0374c48676a0d82668e7238af8c18ea95d7 /Userland/Libraries/LibWeb/Streams
parentf9d6a161e8f76eae61790ec673fbd177d150ca98 (diff)
downloadserenity-db1be40b1319b3417d8e74fe2fc39b393fa7f15b.zip
LibWeb: Propogate OOM errors from readable_stream_reader_generic_cancel
Diffstat (limited to 'Userland/Libraries/LibWeb/Streams')
-rw-r--r--Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Streams/AbstractOperations.h2
-rw-r--r--Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp2
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
index 4e6844bf35..75c8150f0f 100644
--- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
+++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp
@@ -242,7 +242,7 @@ void readable_stream_add_read_request(ReadableStream& stream, ReadRequest const&
}
// https://streams.spec.whatwg.org/#readable-stream-reader-generic-cancel
-JS::NonnullGCPtr<WebIDL::Promise> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin& reader, JS::Value reason)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin& reader, JS::Value reason)
{
// 1. Let stream be reader.[[stream]]
auto stream = reader.stream();
@@ -251,7 +251,7 @@ JS::NonnullGCPtr<WebIDL::Promise> readable_stream_reader_generic_cancel(Readable
VERIFY(stream);
// 3. Return ! ReadableStreamCancel(stream, reason)
- return MUST(readable_stream_cancel(*stream, reason));
+ return TRY(readable_stream_cancel(*stream, reason));
}
// https://streams.spec.whatwg.org/#readable-stream-reader-generic-initialize
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h
index 229e6ef0b0..9bb4bb9985 100644
--- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h
+++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h
@@ -33,7 +33,7 @@ void readable_stream_fulfill_read_request(ReadableStream&, JS::Value chunk, bool
size_t readable_stream_get_num_read_requests(ReadableStream&);
bool readable_stream_has_default_reader(ReadableStream&);
-JS::NonnullGCPtr<WebIDL::Promise> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin&, JS::Value reason);
+WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin&, JS::Value reason);
void readable_stream_reader_generic_initialize(ReadableStreamGenericReaderMixin&, ReadableStream&);
WebIDL::ExceptionOr<void> readable_stream_reader_generic_release(ReadableStreamGenericReaderMixin&);
diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp
index e78d71b7de..be7eb391ca 100644
--- a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp
+++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp
@@ -32,7 +32,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> ReadableStreamGenericReaderMi
}
// 2. Return ! ReadableStreamReaderGenericCancel(this, reason).
- auto promise_capability = readable_stream_reader_generic_cancel(*this, reason);
+ auto promise_capability = TRY(readable_stream_reader_generic_cancel(*this, reason));
return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise().ptr()) };
}