ソースを参照

LibWeb: Mark readable stream cancel/pull/release steps as infallible

These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
Timothy Flynn 1 年間 前
コミット
fc070c8cbd

+ 2 - 2
Userland/Libraries/LibWeb/FileAPI/Blob.cpp

@@ -372,7 +372,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> Blob::text()
     auto reader = reader_or_exception.release_value();
     auto reader = reader_or_exception.release_value();
 
 
     // 3. Let promise be the result of reading all bytes from stream with reader
     // 3. Let promise be the result of reading all bytes from stream with reader
-    auto promise = TRY(reader->read_all_bytes_deprecated());
+    auto promise = reader->read_all_bytes_deprecated();
 
 
     // 4. Return the result of transforming promise by a fulfillment handler that returns the result of running UTF-8 decode on its first argument.
     // 4. Return the result of transforming promise by a fulfillment handler that returns the result of running UTF-8 decode on its first argument.
     return WebIDL::upon_fulfillment(*promise, JS::create_heap_function(heap(), [&vm](JS::Value first_argument) -> WebIDL::ExceptionOr<JS::Value> {
     return WebIDL::upon_fulfillment(*promise, JS::create_heap_function(heap(), [&vm](JS::Value first_argument) -> WebIDL::ExceptionOr<JS::Value> {
@@ -401,7 +401,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> Blob::array_buffer()
     auto reader = reader_or_exception.release_value();
     auto reader = reader_or_exception.release_value();
 
 
     // 3. Let promise be the result of reading all bytes from stream with reader.
     // 3. Let promise be the result of reading all bytes from stream with reader.
-    auto promise = TRY(reader->read_all_bytes_deprecated());
+    auto promise = reader->read_all_bytes_deprecated();
 
 
     // 4. Return the result of transforming promise by a fulfillment handler that returns a new ArrayBuffer whose contents are its first argument.
     // 4. Return the result of transforming promise by a fulfillment handler that returns a new ArrayBuffer whose contents are its first argument.
     return WebIDL::upon_fulfillment(*promise, JS::create_heap_function(heap(), [&realm](JS::Value first_argument) -> WebIDL::ExceptionOr<JS::Value> {
     return WebIDL::upon_fulfillment(*promise, JS::create_heap_function(heap(), [&realm](JS::Value first_argument) -> WebIDL::ExceptionOr<JS::Value> {

+ 25 - 31
Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp

@@ -86,7 +86,7 @@ bool is_readable_stream_locked(ReadableStream const& stream)
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-cancel
 // https://streams.spec.whatwg.org/#readable-stream-cancel
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_cancel(ReadableStream& stream, JS::Value reason)
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_cancel(ReadableStream& stream, JS::Value reason)
 {
 {
     auto& realm = stream.realm();
     auto& realm = stream.realm();
 
 
@@ -121,9 +121,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_cancel(Re
     }
     }
 
 
     // 7. Let sourceCancelPromise be ! stream.[[controller]].[[CancelSteps]](reason).
     // 7. Let sourceCancelPromise be ! stream.[[controller]].[[CancelSteps]](reason).
-    auto source_cancel_promise = TRY(stream.controller()->visit([&](auto const& controller) {
+    auto source_cancel_promise = stream.controller()->visit([&](auto const& controller) {
         return controller->cancel_steps(reason);
         return controller->cancel_steps(reason);
-    }));
+    });
 
 
     // 8. Return the result of reacting to sourceCancelPromise with a fulfillment step that returns undefined.
     // 8. Return the result of reacting to sourceCancelPromise with a fulfillment step that returns undefined.
     auto react_result = WebIDL::react_to_promise(*source_cancel_promise,
     auto react_result = WebIDL::react_to_promise(*source_cancel_promise,
@@ -242,7 +242,7 @@ bool readable_stream_has_default_reader(ReadableStream const& stream)
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-pipe-to
 // https://streams.spec.whatwg.org/#readable-stream-pipe-to
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_pipe_to(ReadableStream& source, WritableStream& dest, bool, bool, bool, Optional<JS::Value> signal)
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_pipe_to(ReadableStream& source, WritableStream& dest, bool, bool, bool, Optional<JS::Value> signal)
 {
 {
     auto& realm = source.realm();
     auto& realm = source.realm();
 
 
@@ -319,7 +319,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_pipe_to(R
         WebIDL::reject_promise(realm, promise, error);
         WebIDL::reject_promise(realm, promise, error);
     };
     };
 
 
-    TRY(reader->read_all_bytes(move(success_steps), move(failure_steps)));
+    reader->read_all_bytes(move(success_steps), move(failure_steps));
 
 
     // 16. Return promise.
     // 16. Return promise.
     return promise;
     return promise;
@@ -420,7 +420,7 @@ public:
                     readable_stream_default_controller_error(controller2, completion.value().value());
                     readable_stream_default_controller_error(controller2, completion.value().value());
 
 
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
-                    auto cancel_result = MUST(readable_stream_cancel(m_stream, completion.value().value()));
+                    auto cancel_result = readable_stream_cancel(m_stream, completion.value().value());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
 
 
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
@@ -548,7 +548,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_default_tee(JS::Realm& r
         auto read_request = realm.heap().allocate_without_realm<DefaultStreamTeeReadRequest>(realm, stream, params, cancel_promise, clone_for_branch2);
         auto read_request = realm.heap().allocate_without_realm<DefaultStreamTeeReadRequest>(realm, stream, params, cancel_promise, clone_for_branch2);
 
 
         // 4. Perform ! ReadableStreamDefaultReaderRead(reader, readRequest).
         // 4. Perform ! ReadableStreamDefaultReaderRead(reader, readRequest).
-        MUST(readable_stream_default_reader_read(reader, read_request));
+        readable_stream_default_reader_read(reader, read_request);
 
 
         // 5. Return a promise resolved with undefined.
         // 5. Return a promise resolved with undefined.
         return WebIDL::create_resolved_promise(realm, JS::js_undefined());
         return WebIDL::create_resolved_promise(realm, JS::js_undefined());
@@ -571,7 +571,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_default_tee(JS::Realm& r
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
 
 
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
-            auto cancel_result = MUST(readable_stream_cancel(stream, composite_reason));
+            auto cancel_result = readable_stream_cancel(stream, composite_reason);
 
 
             // 3. Resolve cancelPromise with cancelResult.
             // 3. Resolve cancelPromise with cancelResult.
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
@@ -596,7 +596,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_default_tee(JS::Realm& r
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
 
 
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
-            auto cancel_result = MUST(readable_stream_cancel(stream, composite_reason));
+            auto cancel_result = readable_stream_cancel(stream, composite_reason);
 
 
             // 3. Resolve cancelPromise with cancelResult.
             // 3. Resolve cancelPromise with cancelResult.
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
@@ -733,7 +733,7 @@ public:
                     readable_byte_stream_controller_error(controller2, completion.value().value());
                     readable_byte_stream_controller_error(controller2, completion.value().value());
 
 
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
-                    auto cancel_result = MUST(readable_stream_cancel(m_stream, completion.value().value()));
+                    auto cancel_result = readable_stream_cancel(m_stream, completion.value().value());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
 
 
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
@@ -898,7 +898,7 @@ public:
                     readable_byte_stream_controller_error(other_controller, completion.value().value());
                     readable_byte_stream_controller_error(other_controller, completion.value().value());
 
 
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
                     // 3. Resolve cancelPromise with ! ReadableStreamCancel(stream, cloneResult.[[Value]]).
-                    auto cancel_result = MUST(readable_stream_cancel(m_stream, completion.value().value()));
+                    auto cancel_result = readable_stream_cancel(m_stream, completion.value().value());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
                     JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
 
 
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
                     WebIDL::resolve_promise(m_realm, m_cancel_promise, cancel_value);
@@ -1093,7 +1093,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& real
         auto read_request = realm.heap().allocate_without_realm<ByteStreamTeeDefaultReadRequest>(realm, stream, params, cancel_promise);
         auto read_request = realm.heap().allocate_without_realm<ByteStreamTeeDefaultReadRequest>(realm, stream, params, cancel_promise);
 
 
         // 3. Perform ! ReadableStreamDefaultReaderRead(reader, readRequest).
         // 3. Perform ! ReadableStreamDefaultReaderRead(reader, readRequest).
-        MUST(readable_stream_default_reader_read(params->reader.get<JS::NonnullGCPtr<ReadableStreamDefaultReader>>(), read_request));
+        readable_stream_default_reader_read(params->reader.get<JS::NonnullGCPtr<ReadableStreamDefaultReader>>(), read_request);
     });
     });
 
 
     // 16. Let pullWithBYOBReader be the following steps, given view and forBranch2:
     // 16. Let pullWithBYOBReader be the following steps, given view and forBranch2:
@@ -1104,7 +1104,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& real
             VERIFY((*default_reader)->read_requests().is_empty());
             VERIFY((*default_reader)->read_requests().is_empty());
 
 
             // 3. Perform ! ReadableStreamDefaultReaderRelease(reader).
             // 3. Perform ! ReadableStreamDefaultReaderRelease(reader).
-            MUST(readable_stream_default_reader_release(*default_reader));
+            readable_stream_default_reader_release(*default_reader);
 
 
             // 4. Set reader to ! AcquireReadableStreamBYOBReader(stream).
             // 4. Set reader to ! AcquireReadableStreamBYOBReader(stream).
             params->reader = MUST(acquire_readable_stream_byob_reader(stream));
             params->reader = MUST(acquire_readable_stream_byob_reader(stream));
@@ -1208,7 +1208,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& real
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
 
 
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
-            auto cancel_result = MUST(readable_stream_cancel(stream, composite_reason));
+            auto cancel_result = readable_stream_cancel(stream, composite_reason);
 
 
             // 3. Resolve cancelPromise with cancelResult.
             // 3. Resolve cancelPromise with cancelResult.
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
@@ -1233,7 +1233,7 @@ WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& real
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
             auto composite_reason = JS::Array::create_from(realm, AK::Array { params->reason1, params->reason2 });
 
 
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
             // 2. Let cancelResult be ! ReadableStreamCancel(stream, compositeReason).
-            auto cancel_result = MUST(readable_stream_cancel(stream, composite_reason));
+            auto cancel_result = readable_stream_cancel(stream, composite_reason);
 
 
             // 3. Resolve cancelPromise with cancelResult.
             // 3. Resolve cancelPromise with cancelResult.
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
             JS::NonnullGCPtr cancel_value = verify_cast<JS::Promise>(*cancel_result->promise().ptr());
@@ -1401,7 +1401,7 @@ void readable_stream_add_read_into_request(ReadableStream& stream, JS::NonnullGC
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-cancel
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-cancel
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin& reader, JS::Value reason)
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin& reader, JS::Value reason)
 {
 {
     // 1. Let stream be reader.[[stream]]
     // 1. Let stream be reader.[[stream]]
     auto stream = reader.stream();
     auto stream = reader.stream();
@@ -1410,7 +1410,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_reader_ge
     VERIFY(stream);
     VERIFY(stream);
 
 
     // 3. Return ! ReadableStreamCancel(stream, reason)
     // 3. Return ! ReadableStreamCancel(stream, reason)
-    return TRY(readable_stream_cancel(*stream, reason));
+    return readable_stream_cancel(*stream, reason);
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-initialize
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-initialize
@@ -1451,7 +1451,7 @@ void readable_stream_reader_generic_initialize(ReadableStreamReader reader, Read
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-release
 // https://streams.spec.whatwg.org/#readable-stream-reader-generic-release
-WebIDL::ExceptionOr<void> readable_stream_reader_generic_release(ReadableStreamGenericReaderMixin& reader)
+void readable_stream_reader_generic_release(ReadableStreamGenericReaderMixin& reader)
 {
 {
     // 1. Let stream be reader.[[stream]].
     // 1. Let stream be reader.[[stream]].
     auto stream = reader.stream();
     auto stream = reader.stream();
@@ -1478,15 +1478,13 @@ WebIDL::ExceptionOr<void> readable_stream_reader_generic_release(ReadableStreamG
     WebIDL::mark_promise_as_handled(*reader.closed_promise_capability());
     WebIDL::mark_promise_as_handled(*reader.closed_promise_capability());
 
 
     // 7. Perform ! stream.[[controller]].[[ReleaseSteps]]().
     // 7. Perform ! stream.[[controller]].[[ReleaseSteps]]().
-    TRY(stream->controller()->visit([](auto const& controller) { return controller->release_steps(); }));
+    stream->controller()->visit([](auto const& controller) { return controller->release_steps(); });
 
 
     // 8. Set stream.[[reader]] to undefined.
     // 8. Set stream.[[reader]] to undefined.
     stream->set_reader({});
     stream->set_reader({});
 
 
     // 9. Set reader.[[stream]] to undefined.
     // 9. Set reader.[[stream]] to undefined.
     reader.set_stream({});
     reader.set_stream({});
-
-    return {};
 }
 }
 
 
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreadererrorreadrequests
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreadererrorreadrequests
@@ -1626,7 +1624,7 @@ bool readable_byte_stream_controller_fill_pull_into_descriptor_from_queue(Readab
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-stream-default-reader-read
 // https://streams.spec.whatwg.org/#readable-stream-default-reader-read
-WebIDL::ExceptionOr<void> readable_stream_default_reader_read(ReadableStreamDefaultReader& reader, ReadRequest& read_request)
+void readable_stream_default_reader_read(ReadableStreamDefaultReader& reader, ReadRequest& read_request)
 {
 {
     // 1. Let stream be reader.[[stream]].
     // 1. Let stream be reader.[[stream]].
     auto stream = reader.stream();
     auto stream = reader.stream();
@@ -1651,12 +1649,10 @@ WebIDL::ExceptionOr<void> readable_stream_default_reader_read(ReadableStreamDefa
         VERIFY(stream->is_readable());
         VERIFY(stream->is_readable());
 
 
         // 2. Perform ! stream.[[controller]].[[PullSteps]](readRequest).
         // 2. Perform ! stream.[[controller]].[[PullSteps]](readRequest).
-        TRY(stream->controller()->visit([&](auto const& controller) {
+        stream->controller()->visit([&](auto const& controller) {
             return controller->pull_steps(read_request);
             return controller->pull_steps(read_request);
-        }));
+        });
     }
     }
-
-    return {};
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readable-byte-stream-controller-convert-pull-into-descriptor
 // https://streams.spec.whatwg.org/#readable-byte-stream-controller-convert-pull-into-descriptor
@@ -1841,20 +1837,18 @@ void readable_stream_byob_reader_read(ReadableStreamBYOBReader& reader, WebIDL::
 }
 }
 
 
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreaderrelease
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultreaderrelease
-WebIDL::ExceptionOr<void> readable_stream_default_reader_release(ReadableStreamDefaultReader& reader)
+void readable_stream_default_reader_release(ReadableStreamDefaultReader& reader)
 {
 {
     auto& realm = reader.realm();
     auto& realm = reader.realm();
 
 
     // 1. Perform ! ReadableStreamReaderGenericRelease(reader).
     // 1. Perform ! ReadableStreamReaderGenericRelease(reader).
-    TRY(readable_stream_reader_generic_release(reader));
+    readable_stream_reader_generic_release(reader);
 
 
     // 2. Let e be a new TypeError exception.
     // 2. Let e be a new TypeError exception.
     auto exception = JS::TypeError::create(realm, "Reader has been released"sv);
     auto exception = JS::TypeError::create(realm, "Reader has been released"sv);
 
 
     // 3. Perform ! ReadableStreamDefaultReaderErrorReadRequests(reader, e).
     // 3. Perform ! ReadableStreamDefaultReaderErrorReadRequests(reader, e).
     readable_stream_default_reader_error_read_requests(reader, exception);
     readable_stream_default_reader_error_read_requests(reader, exception);
-
-    return {};
 }
 }
 
 
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreambyobreaderrelease
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreambyobreaderrelease
@@ -1863,7 +1857,7 @@ void readable_stream_byob_reader_release(ReadableStreamBYOBReader& reader)
     auto& realm = reader.realm();
     auto& realm = reader.realm();
 
 
     // 1. Perform ! ReadableStreamReaderGenericRelease(reader).
     // 1. Perform ! ReadableStreamReaderGenericRelease(reader).
-    MUST(readable_stream_reader_generic_release(reader));
+    readable_stream_reader_generic_release(reader);
 
 
     // 2. Let e be a new TypeError exception.
     // 2. Let e be a new TypeError exception.
     auto exception = JS::TypeError::create(realm, "Reader has been released"sv);
     auto exception = JS::TypeError::create(realm, "Reader has been released"sv);

+ 6 - 6
Userland/Libraries/LibWeb/Streams/AbstractOperations.h

@@ -39,7 +39,7 @@ void readable_stream_close(ReadableStream&);
 void readable_stream_error(ReadableStream&, JS::Value error);
 void readable_stream_error(ReadableStream&, JS::Value error);
 void readable_stream_add_read_request(ReadableStream&, JS::NonnullGCPtr<ReadRequest>);
 void readable_stream_add_read_request(ReadableStream&, JS::NonnullGCPtr<ReadRequest>);
 void readable_stream_add_read_into_request(ReadableStream&, JS::NonnullGCPtr<ReadIntoRequest>);
 void readable_stream_add_read_into_request(ReadableStream&, JS::NonnullGCPtr<ReadIntoRequest>);
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_cancel(ReadableStream&, JS::Value reason);
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_cancel(ReadableStream&, JS::Value reason);
 void readable_stream_fulfill_read_into_request(ReadableStream&, JS::Value chunk, bool done);
 void readable_stream_fulfill_read_into_request(ReadableStream&, JS::Value chunk, bool done);
 void readable_stream_fulfill_read_request(ReadableStream&, JS::Value chunk, bool done);
 void readable_stream_fulfill_read_request(ReadableStream&, JS::Value chunk, bool done);
 size_t readable_stream_get_num_read_into_requests(ReadableStream const&);
 size_t readable_stream_get_num_read_into_requests(ReadableStream const&);
@@ -47,15 +47,15 @@ size_t readable_stream_get_num_read_requests(ReadableStream const&);
 bool readable_stream_has_byob_reader(ReadableStream const&);
 bool readable_stream_has_byob_reader(ReadableStream const&);
 bool readable_stream_has_default_reader(ReadableStream const&);
 bool readable_stream_has_default_reader(ReadableStream const&);
 
 
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_pipe_to(ReadableStream& source, WritableStream& dest, bool prevent_close, bool prevent_abort, bool prevent_cancel, Optional<JS::Value> signal);
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_pipe_to(ReadableStream& source, WritableStream& dest, bool prevent_close, bool prevent_abort, bool prevent_cancel, Optional<JS::Value> signal);
 
 
 WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_tee(JS::Realm&, ReadableStream&, bool clone_for_branch2);
 WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_tee(JS::Realm&, ReadableStream&, bool clone_for_branch2);
 WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_default_tee(JS::Realm& realm, ReadableStream& stream, bool clone_for_branch2);
 WebIDL::ExceptionOr<ReadableStreamPair> readable_stream_default_tee(JS::Realm& realm, ReadableStream& stream, bool clone_for_branch2);
 WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& realm, ReadableStream& stream);
 WebIDL::ExceptionOr<ReadableStreamPair> readable_byte_stream_tee(JS::Realm& realm, ReadableStream& stream);
 
 
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin&, JS::Value reason);
+JS::NonnullGCPtr<WebIDL::Promise> readable_stream_reader_generic_cancel(ReadableStreamGenericReaderMixin&, JS::Value reason);
 void readable_stream_reader_generic_initialize(ReadableStreamReader, ReadableStream&);
 void readable_stream_reader_generic_initialize(ReadableStreamReader, ReadableStream&);
-WebIDL::ExceptionOr<void> readable_stream_reader_generic_release(ReadableStreamGenericReaderMixin&);
+void readable_stream_reader_generic_release(ReadableStreamGenericReaderMixin&);
 
 
 void readable_stream_default_reader_error_read_requests(ReadableStreamDefaultReader&, JS::Value error);
 void readable_stream_default_reader_error_read_requests(ReadableStreamDefaultReader&, JS::Value error);
 void readable_stream_byob_reader_error_read_into_requests(ReadableStreamBYOBReader&, JS::Value error);
 void readable_stream_byob_reader_error_read_into_requests(ReadableStreamBYOBReader&, JS::Value error);
@@ -64,8 +64,8 @@ void readable_byte_stream_controller_pull_into(ReadableByteStreamController&, We
 void readable_stream_byob_reader_read(ReadableStreamBYOBReader&, WebIDL::ArrayBufferView&, ReadIntoRequest&);
 void readable_stream_byob_reader_read(ReadableStreamBYOBReader&, WebIDL::ArrayBufferView&, ReadIntoRequest&);
 void readable_byte_stream_controller_fill_head_pull_into_descriptor(ReadableByteStreamController const&, u64 size, PullIntoDescriptor&);
 void readable_byte_stream_controller_fill_head_pull_into_descriptor(ReadableByteStreamController const&, u64 size, PullIntoDescriptor&);
 
 
-WebIDL::ExceptionOr<void> readable_stream_default_reader_read(ReadableStreamDefaultReader&, ReadRequest&);
-WebIDL::ExceptionOr<void> readable_stream_default_reader_release(ReadableStreamDefaultReader&);
+void readable_stream_default_reader_read(ReadableStreamDefaultReader&, ReadRequest&);
+void readable_stream_default_reader_release(ReadableStreamDefaultReader&);
 void readable_stream_byob_reader_release(ReadableStreamBYOBReader&);
 void readable_stream_byob_reader_release(ReadableStreamBYOBReader&);
 WebIDL::ExceptionOr<void> set_up_readable_stream_default_reader(ReadableStreamDefaultReader&, ReadableStream&);
 WebIDL::ExceptionOr<void> set_up_readable_stream_default_reader(ReadableStreamDefaultReader&, ReadableStream&);
 WebIDL::ExceptionOr<void> set_up_readable_stream_byob_reader(ReadableStreamBYOBReader&, ReadableStream&);
 WebIDL::ExceptionOr<void> set_up_readable_stream_byob_reader(ReadableStreamBYOBReader&, ReadableStream&);

+ 5 - 9
Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp

@@ -91,7 +91,7 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::enqueue(JS::Handle<WebID
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rbs-controller-private-cancel
 // https://streams.spec.whatwg.org/#rbs-controller-private-cancel
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableByteStreamController::cancel_steps(JS::Value reason)
+JS::NonnullGCPtr<WebIDL::Promise> ReadableByteStreamController::cancel_steps(JS::Value reason)
 {
 {
     // 1. Perform ! ReadableByteStreamControllerClearPendingPullIntos(this).
     // 1. Perform ! ReadableByteStreamControllerClearPendingPullIntos(this).
     readable_byte_stream_controller_clear_pending_pull_intos(*this);
     readable_byte_stream_controller_clear_pending_pull_intos(*this);
@@ -110,7 +110,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableByteStreamControl
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rbs-controller-private-pull
 // https://streams.spec.whatwg.org/#rbs-controller-private-pull
-WebIDL::ExceptionOr<void> ReadableByteStreamController::pull_steps(JS::NonnullGCPtr<ReadRequest> read_request)
+void ReadableByteStreamController::pull_steps(JS::NonnullGCPtr<ReadRequest> read_request)
 {
 {
     auto& realm = this->realm();
     auto& realm = this->realm();
 
 
@@ -128,7 +128,7 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::pull_steps(JS::NonnullGC
         readable_byte_stream_controller_fill_read_request_from_queue(*this, read_request);
         readable_byte_stream_controller_fill_read_request_from_queue(*this, read_request);
 
 
         // 3. Return.
         // 3. Return.
-        return {};
+        return;
     }
     }
 
 
     // 4. Let autoAllocateChunkSize be this.[[autoAllocateChunkSize]].
     // 4. Let autoAllocateChunkSize be this.[[autoAllocateChunkSize]].
@@ -144,7 +144,7 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::pull_steps(JS::NonnullGC
             read_request->on_error(*buffer.throw_completion().value());
             read_request->on_error(*buffer.throw_completion().value());
 
 
             // 2. Return.
             // 2. Return.
-            return {};
+            return;
         }
         }
 
 
         // 3. Let pullIntoDescriptor be a new pull-into descriptor with buffer buffer.[[Value]], buffer byte length autoAllocateChunkSize, byte offset 0,
         // 3. Let pullIntoDescriptor be a new pull-into descriptor with buffer buffer.[[Value]], buffer byte length autoAllocateChunkSize, byte offset 0,
@@ -169,12 +169,10 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::pull_steps(JS::NonnullGC
 
 
     // 7. Perform ! ReadableByteStreamControllerCallPullIfNeeded(this).
     // 7. Perform ! ReadableByteStreamControllerCallPullIfNeeded(this).
     readable_byte_stream_controller_call_pull_if_needed(*this);
     readable_byte_stream_controller_call_pull_if_needed(*this);
-
-    return {};
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rbs-controller-private-pull
 // https://streams.spec.whatwg.org/#rbs-controller-private-pull
-WebIDL::ExceptionOr<void> ReadableByteStreamController::release_steps()
+void ReadableByteStreamController::release_steps()
 {
 {
     // 1. If this.[[pendingPullIntos]] is not empty,
     // 1. If this.[[pendingPullIntos]] is not empty,
     if (!m_pending_pull_intos.is_empty()) {
     if (!m_pending_pull_intos.is_empty()) {
@@ -188,8 +186,6 @@ WebIDL::ExceptionOr<void> ReadableByteStreamController::release_steps()
         m_pending_pull_intos.clear();
         m_pending_pull_intos.clear();
         m_pending_pull_intos.append(first_pending_pull_into);
         m_pending_pull_intos.append(first_pending_pull_into);
     }
     }
-
-    return {};
 }
 }
 
 
 void ReadableByteStreamController::visit_edges(Cell::Visitor& visitor)
 void ReadableByteStreamController::visit_edges(Cell::Visitor& visitor)

+ 3 - 3
Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h

@@ -127,9 +127,9 @@ public:
     JS::GCPtr<ReadableStream> stream() { return m_stream; }
     JS::GCPtr<ReadableStream> stream() { return m_stream; }
     void set_stream(JS::GCPtr<ReadableStream> stream) { m_stream = stream; }
     void set_stream(JS::GCPtr<ReadableStream> stream) { m_stream = stream; }
 
 
-    WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> cancel_steps(JS::Value reason);
-    WebIDL::ExceptionOr<void> pull_steps(JS::NonnullGCPtr<ReadRequest>);
-    WebIDL::ExceptionOr<void> release_steps();
+    JS::NonnullGCPtr<WebIDL::Promise> cancel_steps(JS::Value reason);
+    void pull_steps(JS::NonnullGCPtr<ReadRequest>);
+    void release_steps();
 
 
 private:
 private:
     explicit ReadableByteStreamController(JS::Realm&);
     explicit ReadableByteStreamController(JS::Realm&);

+ 3 - 3
Userland/Libraries/LibWeb/Streams/ReadableStream.cpp

@@ -94,7 +94,7 @@ WebIDL::ExceptionOr<JS::GCPtr<JS::Object>> ReadableStream::cancel(JS::Value reas
     }
     }
 
 
     // 2. Return ! ReadableStreamCancel(this, reason).
     // 2. Return ! ReadableStreamCancel(this, reason).
-    return TRY(readable_stream_cancel(*this, reason))->promise();
+    return readable_stream_cancel(*this, reason)->promise();
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rs-get-reader
 // https://streams.spec.whatwg.org/#rs-get-reader
@@ -125,7 +125,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStream>> ReadableStream::pipe_throu
     auto signal = options.signal ? JS::Value(options.signal) : JS::js_undefined();
     auto signal = options.signal ? JS::Value(options.signal) : JS::js_undefined();
 
 
     // 4. Let promise be ! ReadableStreamPipeTo(this, transform["writable"], options["preventClose"], options["preventAbort"], options["preventCancel"], signal).
     // 4. Let promise be ! ReadableStreamPipeTo(this, transform["writable"], options["preventClose"], options["preventAbort"], options["preventCancel"], signal).
-    auto promise = MUST(readable_stream_pipe_to(*this, *transform.writable, options.prevent_close, options.prevent_abort, options.prevent_cancel, signal));
+    auto promise = readable_stream_pipe_to(*this, *transform.writable, options.prevent_close, options.prevent_abort, options.prevent_cancel, signal);
 
 
     // 5. Set promise.[[PromiseIsHandled]] to true.
     // 5. Set promise.[[PromiseIsHandled]] to true.
     WebIDL::mark_promise_as_handled(*promise);
     WebIDL::mark_promise_as_handled(*promise);
@@ -156,7 +156,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Object>> ReadableStream::pipe_to(Writab
     auto signal = options.signal ? JS::Value(options.signal) : JS::js_undefined();
     auto signal = options.signal ? JS::Value(options.signal) : JS::js_undefined();
 
 
     // 4. Return ! ReadableStreamPipeTo(this, destination, options["preventClose"], options["preventAbort"], options["preventCancel"], signal).
     // 4. Return ! ReadableStreamPipeTo(this, destination, options["preventClose"], options["preventAbort"], options["preventCancel"], signal).
-    return MUST(readable_stream_pipe_to(*this, destination, options.prevent_close, options.prevent_abort, options.prevent_cancel, signal))->promise();
+    return readable_stream_pipe_to(*this, destination, options.prevent_close, options.prevent_abort, options.prevent_cancel, signal)->promise();
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readablestream-tee
 // https://streams.spec.whatwg.org/#readablestream-tee

+ 3 - 6
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.cpp

@@ -65,7 +65,7 @@ void ReadableStreamDefaultController::error(JS::Value error)
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rs-default-controller-private-cancel
 // https://streams.spec.whatwg.org/#rs-default-controller-private-cancel
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableStreamDefaultController::cancel_steps(JS::Value reason)
+JS::NonnullGCPtr<WebIDL::Promise> ReadableStreamDefaultController::cancel_steps(JS::Value reason)
 {
 {
     // 1. Perform ! ResetQueue(this).
     // 1. Perform ! ResetQueue(this).
     reset_queue(*this);
     reset_queue(*this);
@@ -81,7 +81,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableStreamDefaultCont
 }
 }
 
 
 // https://streams.spec.whatwg.org/#rs-default-controller-private-pull
 // https://streams.spec.whatwg.org/#rs-default-controller-private-pull
-WebIDL::ExceptionOr<void> ReadableStreamDefaultController::pull_steps(Web::Streams::ReadRequest& read_request)
+void ReadableStreamDefaultController::pull_steps(Web::Streams::ReadRequest& read_request)
 {
 {
     // 1. Let stream be this.[[stream]].
     // 1. Let stream be this.[[stream]].
     auto& stream = *m_stream;
     auto& stream = *m_stream;
@@ -115,15 +115,12 @@ WebIDL::ExceptionOr<void> ReadableStreamDefaultController::pull_steps(Web::Strea
         // 2. Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
         // 2. Perform ! ReadableStreamDefaultControllerCallPullIfNeeded(this).
         readable_stream_default_controller_can_pull_if_needed(*this);
         readable_stream_default_controller_can_pull_if_needed(*this);
     }
     }
-
-    return {};
 }
 }
 
 
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultcontroller-releasesteps
 // https://streams.spec.whatwg.org/#abstract-opdef-readablestreamdefaultcontroller-releasesteps
-WebIDL::ExceptionOr<void> ReadableStreamDefaultController::release_steps()
+void ReadableStreamDefaultController::release_steps()
 {
 {
     // 1. Return.
     // 1. Return.
-    return {};
 }
 }
 
 
 void ReadableStreamDefaultController::initialize(JS::Realm& realm)
 void ReadableStreamDefaultController::initialize(JS::Realm& realm)

+ 3 - 3
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultController.h

@@ -64,9 +64,9 @@ public:
     JS::GCPtr<ReadableStream> stream() { return m_stream; }
     JS::GCPtr<ReadableStream> stream() { return m_stream; }
     void set_stream(JS::GCPtr<ReadableStream> value) { m_stream = value; }
     void set_stream(JS::GCPtr<ReadableStream> value) { m_stream = value; }
 
 
-    WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> cancel_steps(JS::Value reason);
-    WebIDL::ExceptionOr<void> pull_steps(ReadRequest&);
-    WebIDL::ExceptionOr<void> release_steps();
+    JS::NonnullGCPtr<WebIDL::Promise> cancel_steps(JS::Value reason);
+    void pull_steps(ReadRequest&);
+    void release_steps();
 
 
 private:
 private:
     virtual void initialize(JS::Realm&) override;
     virtual void initialize(JS::Realm&) override;

+ 9 - 15
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp

@@ -94,11 +94,7 @@ void ReadLoopReadRequest::on_chunk(JS::Value chunk)
     //        up more than one chunk at a time, we may run into stack overflow problems.
     //        up more than one chunk at a time, we may run into stack overflow problems.
     //
     //
     // 3. Read-loop given reader, bytes, successSteps, and failureSteps.
     // 3. Read-loop given reader, bytes, successSteps, and failureSteps.
-    auto maybe_error = readable_stream_default_reader_read(m_reader, *this);
-    if (maybe_error.is_exception()) {
-        auto throw_completion = Bindings::dom_exception_to_throw_completion(m_vm, maybe_error.exception());
-        m_failure_steps(*throw_completion.release_error().value());
-    }
+    readable_stream_default_reader_read(m_reader, *this);
 }
 }
 
 
 // close steps
 // close steps
@@ -179,14 +175,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> ReadableStreamDefaultReader::
     auto read_request = heap().allocate_without_realm<DefaultReaderReadRequest>(realm, promise_capability);
     auto read_request = heap().allocate_without_realm<DefaultReaderReadRequest>(realm, promise_capability);
 
 
     // 4. Perform ! ReadableStreamDefaultReaderRead(this, readRequest).
     // 4. Perform ! ReadableStreamDefaultReaderRead(this, readRequest).
-    TRY(readable_stream_default_reader_read(*this, read_request));
+    readable_stream_default_reader_read(*this, read_request);
 
 
     // 5. Return promise.
     // 5. Return promise.
     return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise()) };
     return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise()) };
 }
 }
 
 
 // https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
 // https://streams.spec.whatwg.org/#readablestreamdefaultreader-read-all-bytes
-WebIDL::ExceptionOr<void> ReadableStreamDefaultReader::read_all_bytes(ReadLoopReadRequest::SuccessSteps success_steps, ReadLoopReadRequest::FailureSteps failure_steps)
+void ReadableStreamDefaultReader::read_all_bytes(ReadLoopReadRequest::SuccessSteps success_steps, ReadLoopReadRequest::FailureSteps failure_steps)
 {
 {
     auto& realm = this->realm();
     auto& realm = this->realm();
     auto& vm = realm.vm();
     auto& vm = realm.vm();
@@ -196,15 +192,13 @@ WebIDL::ExceptionOr<void> ReadableStreamDefaultReader::read_all_bytes(ReadLoopRe
     auto read_request = heap().allocate_without_realm<ReadLoopReadRequest>(vm, realm, *this, move(success_steps), move(failure_steps));
     auto read_request = heap().allocate_without_realm<ReadLoopReadRequest>(vm, realm, *this, move(success_steps), move(failure_steps));
 
 
     // 2. Perform ! ReadableStreamDefaultReaderRead(this, readRequest).
     // 2. Perform ! ReadableStreamDefaultReaderRead(this, readRequest).
-    TRY(readable_stream_default_reader_read(*this, read_request));
-
-    return {};
+    readable_stream_default_reader_read(*this, read_request);
 }
 }
 
 
 // FIXME: This function is a promise-based wrapper around "read all bytes". The spec changed this function to not use promises
 // FIXME: This function is a promise-based wrapper around "read all bytes". The spec changed this function to not use promises
 //        in https://github.com/whatwg/streams/commit/f894acdd417926a2121710803cef593e15127964 - however, it seems that the
 //        in https://github.com/whatwg/streams/commit/f894acdd417926a2121710803cef593e15127964 - however, it seems that the
 //        FileAPI blob specification has not been updated to match, see: https://github.com/w3c/FileAPI/issues/187.
 //        FileAPI blob specification has not been updated to match, see: https://github.com/w3c/FileAPI/issues/187.
-WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableStreamDefaultReader::read_all_bytes_deprecated()
+JS::NonnullGCPtr<WebIDL::Promise> ReadableStreamDefaultReader::read_all_bytes_deprecated()
 {
 {
     auto& realm = this->realm();
     auto& realm = this->realm();
 
 
@@ -223,20 +217,20 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableStreamDefaultRead
         WebIDL::reject_promise(realm, promise, error);
         WebIDL::reject_promise(realm, promise, error);
     };
     };
 
 
-    TRY(read_all_bytes(move(success_steps), move(failure_steps)));
+    read_all_bytes(move(success_steps), move(failure_steps));
 
 
     return promise;
     return promise;
 }
 }
 
 
 // https://streams.spec.whatwg.org/#default-reader-release-lock
 // https://streams.spec.whatwg.org/#default-reader-release-lock
-WebIDL::ExceptionOr<void> ReadableStreamDefaultReader::release_lock()
+void ReadableStreamDefaultReader::release_lock()
 {
 {
     // 1. If this.[[stream]] is undefined, return.
     // 1. If this.[[stream]] is undefined, return.
     if (!m_stream)
     if (!m_stream)
-        return {};
+        return;
 
 
     // 2. Perform ! ReadableStreamDefaultReaderRelease(this).
     // 2. Perform ! ReadableStreamDefaultReaderRelease(this).
-    return readable_stream_default_reader_release(*this);
+    readable_stream_default_reader_release(*this);
 }
 }
 
 
 }
 }

+ 3 - 3
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.h

@@ -75,10 +75,10 @@ public:
 
 
     WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> read();
     WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> read();
 
 
-    WebIDL::ExceptionOr<void> read_all_bytes(ReadLoopReadRequest::SuccessSteps, ReadLoopReadRequest::FailureSteps);
-    WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> read_all_bytes_deprecated();
+    void read_all_bytes(ReadLoopReadRequest::SuccessSteps, ReadLoopReadRequest::FailureSteps);
+    JS::NonnullGCPtr<WebIDL::Promise> read_all_bytes_deprecated();
 
 
-    WebIDL::ExceptionOr<void> release_lock();
+    void release_lock();
 
 
     SinglyLinkedList<JS::NonnullGCPtr<ReadRequest>>& read_requests() { return m_read_requests; }
     SinglyLinkedList<JS::NonnullGCPtr<ReadRequest>>& read_requests() { return m_read_requests; }
 
 

+ 1 - 1
Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp

@@ -31,7 +31,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> ReadableStreamGenericReaderMi
     }
     }
 
 
     // 2. Return ! ReadableStreamReaderGenericCancel(this, reason).
     // 2. Return ! ReadableStreamReaderGenericCancel(this, reason).
-    auto promise_capability = TRY(readable_stream_reader_generic_cancel(*this, reason));
+    auto promise_capability = readable_stream_reader_generic_cancel(*this, reason);
     return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise().ptr()) };
     return JS::NonnullGCPtr { verify_cast<JS::Promise>(*promise_capability->promise().ptr()) };
 }
 }