diff --git a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp index 336e28b8bc3..9961de3827c 100644 --- a/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp +++ b/Userland/Libraries/LibWeb/Fetch/BodyInit.cpp @@ -49,12 +49,12 @@ WebIDL::ExceptionOr extract_body(JS::Realm& realm, } // 3. Otherwise, if object is a Blob object, set stream to the result of running object’s get stream. else if (auto const* blob_handle = object.get_pointer>()) { - stream = TRY(blob_handle->cell()->get_stream()); + stream = blob_handle->cell()->get_stream(); } // 4. Otherwise, set stream to a new ReadableStream object, and set up stream with byte reading support. else { stream = realm.heap().allocate(realm, realm); - TRY(Streams::set_up_readable_stream_controller_with_byte_reading_support(*stream)); + Streams::set_up_readable_stream_controller_with_byte_reading_support(*stream); } // 5. Assert: stream is a ReadableStream object. diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp index 420a75d0c21..10f0a138a44 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.cpp @@ -288,14 +288,14 @@ WebIDL::ExceptionOr> Blob::slice(Optional start, Opt } // https://w3c.github.io/FileAPI/#dom-blob-stream -WebIDL::ExceptionOr> Blob::stream() +JS::NonnullGCPtr Blob::stream() { // The stream() method, when invoked, must return the result of calling get stream on this. - return this->get_stream(); + return get_stream(); } // https://w3c.github.io/FileAPI/#blob-get-stream -WebIDL::ExceptionOr> Blob::get_stream() +JS::NonnullGCPtr Blob::get_stream() { auto& realm = this->realm(); @@ -303,7 +303,7 @@ WebIDL::ExceptionOr> Blob::get_stream( auto stream = realm.heap().allocate(realm, realm); // 2. Set up stream with byte reading support. - TRY(set_up_readable_stream_controller_with_byte_reading_support(stream)); + set_up_readable_stream_controller_with_byte_reading_support(stream); // FIXME: 3. Run the following steps in parallel: { @@ -357,13 +357,13 @@ WebIDL::ExceptionOr> Blob::get_stream( } // https://w3c.github.io/FileAPI/#dom-blob-text -WebIDL::ExceptionOr> Blob::text() +JS::NonnullGCPtr Blob::text() { auto& realm = this->realm(); auto& vm = realm.vm(); // 1. Let stream be the result of calling get stream on this. - auto stream = TRY(this->get_stream()); + auto stream = get_stream(); // 2. Let reader be the result of getting a reader from stream. If that threw an exception, return a new promise rejected with that exception. auto reader_or_exception = acquire_readable_stream_default_reader(*stream); @@ -387,12 +387,12 @@ WebIDL::ExceptionOr> Blob::text() } // https://w3c.github.io/FileAPI/#dom-blob-arraybuffer -WebIDL::ExceptionOr> Blob::array_buffer() +JS::NonnullGCPtr Blob::array_buffer() { auto& realm = this->realm(); // 1. Let stream be the result of calling get stream on this. - auto stream = TRY(this->get_stream()); + auto stream = get_stream(); // 2. Let reader be the result of getting a reader from stream. If that threw an exception, return a new promise rejected with that exception. auto reader_or_exception = acquire_readable_stream_default_reader(*stream); diff --git a/Userland/Libraries/LibWeb/FileAPI/Blob.h b/Userland/Libraries/LibWeb/FileAPI/Blob.h index c01c4cfb61b..1159b883d74 100644 --- a/Userland/Libraries/LibWeb/FileAPI/Blob.h +++ b/Userland/Libraries/LibWeb/FileAPI/Blob.h @@ -47,13 +47,13 @@ public: WebIDL::ExceptionOr> slice(Optional start = {}, Optional end = {}, Optional const& content_type = {}); - WebIDL::ExceptionOr> stream(); - WebIDL::ExceptionOr> text(); - WebIDL::ExceptionOr> array_buffer(); + JS::NonnullGCPtr stream(); + JS::NonnullGCPtr text(); + JS::NonnullGCPtr array_buffer(); ReadonlyBytes bytes() const { return m_byte_buffer.bytes(); } - WebIDL::ExceptionOr> get_stream(); + JS::NonnullGCPtr get_stream(); virtual StringView interface_name() const override { return "Blob"sv; } diff --git a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp index 66e9d2edd66..f00ade606fe 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp @@ -130,7 +130,7 @@ WebIDL::ExceptionOr FileReader::read_operation(Blob& blob, Type type, Opti m_error = {}; // 5. Let stream be the result of calling get stream on blob. - auto stream = TRY(blob.get_stream()); + auto stream = blob.get_stream(); // 6. Let reader be the result of getting a reader from stream. auto reader = TRY(acquire_readable_stream_default_reader(*stream)); diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 589e918d02a..f43406bf855 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -3148,7 +3148,7 @@ WebIDL::ExceptionOr readable_byte_stream_controller_enqueue(ReadableByteSt readable_byte_stream_controller_invalidate_byob_request(controller); // 4. Set firstPendingPullInto’s buffer to ! TransferArrayBuffer(firstPendingPullInto’s buffer). - first_pending_pull_into.buffer = TRY(transfer_array_buffer(realm, first_pending_pull_into.buffer)); + first_pending_pull_into.buffer = MUST(transfer_array_buffer(realm, first_pending_pull_into.buffer)); // 5. If firstPendingPullInto’s reader type is "none", perform ? ReadableByteStreamControllerEnqueueDetachedPullIntoToQueue(controller, firstPendingPullInto). if (first_pending_pull_into.reader_type == ReaderType::None) @@ -3394,7 +3394,7 @@ PullIntoDescriptor readable_byte_stream_controller_shift_pending_pull_into(Reada } // https://streams.spec.whatwg.org/#readablestream-set-up-with-byte-reading-support -WebIDL::ExceptionOr set_up_readable_stream_controller_with_byte_reading_support(ReadableStream& stream, JS::GCPtr pull_algorithm, JS::GCPtr cancel_algorithm, double high_water_mark) +void set_up_readable_stream_controller_with_byte_reading_support(ReadableStream& stream, JS::GCPtr pull_algorithm, JS::GCPtr cancel_algorithm, double high_water_mark) { auto& realm = stream.realm(); @@ -3436,9 +3436,7 @@ WebIDL::ExceptionOr set_up_readable_stream_controller_with_byte_reading_su auto controller = stream.heap().allocate(realm, realm); // 6. Perform ! SetUpReadableByteStreamController(stream, controller, startAlgorithm, pullAlgorithmWrapper, cancelAlgorithmWrapper, highWaterMark, undefined). - TRY(set_up_readable_byte_stream_controller(stream, controller, start_algorithm, pull_algorithm_wrapper, cancel_algorithm_wrapper, high_water_mark, JS::js_undefined())); - - return {}; + MUST(set_up_readable_byte_stream_controller(stream, controller, start_algorithm, pull_algorithm_wrapper, cancel_algorithm_wrapper, high_water_mark, JS::js_undefined())); } // https://streams.spec.whatwg.org/#writable-stream-abort @@ -3495,7 +3493,7 @@ JS::NonnullGCPtr writable_stream_abort(WritableStream& stream, } // https://streams.spec.whatwg.org/#writable-stream-close -WebIDL::ExceptionOr> writable_stream_close(WritableStream& stream) +JS::NonnullGCPtr writable_stream_close(WritableStream& stream) { auto& realm = stream.realm(); @@ -3529,7 +3527,7 @@ WebIDL::ExceptionOr> writable_stream_close(Wri WebIDL::resolve_promise(realm, *writer->ready_promise(), JS::js_undefined()); // 9. Perform ! WritableStreamDefaultControllerClose(stream.[[controller]]). - TRY(writable_stream_default_controller_close(*stream.controller())); + writable_stream_default_controller_close(*stream.controller()); // 10. Return promise. return promise; @@ -3942,7 +3940,7 @@ JS::NonnullGCPtr writable_stream_default_writer_abort(WritableS } // https://streams.spec.whatwg.org/#writable-stream-default-writer-close -WebIDL::ExceptionOr> writable_stream_default_writer_close(WritableStreamDefaultWriter& writer) +JS::NonnullGCPtr writable_stream_default_writer_close(WritableStreamDefaultWriter& writer) { // 1. Let stream be writer.[[stream]]. auto stream = writer.stream(); @@ -4313,15 +4311,13 @@ void writable_stream_default_controller_clear_algorithms(WritableStreamDefaultCo } // https://streams.spec.whatwg.org/#writable-stream-default-controller-close -WebIDL::ExceptionOr writable_stream_default_controller_close(WritableStreamDefaultController& controller) +void writable_stream_default_controller_close(WritableStreamDefaultController& controller) { // 1. Perform ! EnqueueValueWithSize(controller, close sentinel, 0). - TRY(enqueue_value_with_size(controller, create_close_sentinel(), JS::Value(0.0))); + MUST(enqueue_value_with_size(controller, create_close_sentinel(), JS::Value(0.0))); // 2. Perform ! WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller). writable_stream_default_controller_advance_queue_if_needed(controller); - - return {}; } // https://streams.spec.whatwg.org/#writable-stream-default-controller-error @@ -4512,7 +4508,7 @@ void writable_stream_default_controller_write(WritableStreamDefaultController& c } // https://streams.spec.whatwg.org/#initialize-transform-stream -WebIDL::ExceptionOr initialize_transform_stream(TransformStream& stream, JS::NonnullGCPtr start_promise, double writable_high_water_mark, JS::NonnullGCPtr writable_size_algorithm, double readable_high_water_mark, JS::NonnullGCPtr readable_size_algorithm) +void initialize_transform_stream(TransformStream& stream, JS::NonnullGCPtr start_promise, double writable_high_water_mark, JS::NonnullGCPtr writable_size_algorithm, double readable_high_water_mark, JS::NonnullGCPtr readable_size_algorithm) { auto& realm = stream.realm(); @@ -4534,7 +4530,7 @@ WebIDL::ExceptionOr initialize_transform_stream(TransformStream& stream, J // 3. Let abortAlgorithm be the following steps, taking a reason argument: auto abort_algorithm = JS::create_heap_function(realm.heap(), [&stream](JS::Value reason) { // 1. Return ! TransformStreamDefaultSinkAbortAlgorithm(stream, reason). - return MUST(transform_stream_default_sink_abort_algorithm(stream, reason)); + return transform_stream_default_sink_abort_algorithm(stream, reason); }); // 4. Let closeAlgorithm be the following steps: @@ -4544,37 +4540,35 @@ WebIDL::ExceptionOr initialize_transform_stream(TransformStream& stream, J }); // 5. Set stream.[[writable]] to ! CreateWritableStream(startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, writableHighWaterMark, writableSizeAlgorithm). - stream.set_writable(TRY(create_writable_stream(realm, writable_start_algorithm, write_algorithm, close_algorithm, abort_algorithm, writable_high_water_mark, writable_size_algorithm))); + stream.set_writable(MUST(create_writable_stream(realm, writable_start_algorithm, write_algorithm, close_algorithm, abort_algorithm, writable_high_water_mark, writable_size_algorithm))); // 6. Let pullAlgorithm be the following steps: auto pull_algorithm = JS::create_heap_function(realm.heap(), [&stream]() { // 1. Return ! TransformStreamDefaultSourcePullAlgorithm(stream). - return MUST(transform_stream_default_source_pull_algorithm(stream)); + return transform_stream_default_source_pull_algorithm(stream); }); // 7. Let cancelAlgorithm be the following steps, taking a reason argument: auto cancel_algorithm = JS::create_heap_function(realm.heap(), [&stream, &realm](JS::Value reason) { // 1. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, reason). - MUST(transform_stream_error_writable_and_unblock_write(stream, reason)); + transform_stream_error_writable_and_unblock_write(stream, reason); // 2. Return a promise resolved with undefined. return WebIDL::create_resolved_promise(realm, JS::js_undefined()); }); // 8. Set stream.[[readable]] to ! CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm). - stream.set_readable(TRY(create_readable_stream(realm, readable_start_algorithm, pull_algorithm, cancel_algorithm, readable_high_water_mark, readable_size_algorithm))); + stream.set_readable(MUST(create_readable_stream(realm, readable_start_algorithm, pull_algorithm, cancel_algorithm, readable_high_water_mark, readable_size_algorithm))); // 9. Set stream.[[backpressure]] and stream.[[backpressureChangePromise]] to undefined. stream.set_backpressure({}); stream.set_backpressure_change_promise({}); // 10. Perform ! TransformStreamSetBackpressure(stream, true). - TRY(transform_stream_set_backpressure(stream, true)); + transform_stream_set_backpressure(stream, true); // 11. Set stream.[[controller]] to undefined. stream.set_controller({}); - - return {}; } // https://streams.spec.whatwg.org/#set-up-transform-stream-default-controller @@ -4688,7 +4682,7 @@ WebIDL::ExceptionOr transform_stream_default_controller_enqueue(TransformS auto throw_completion = Bindings::dom_exception_to_throw_completion(vm, enqueue_result.exception()); // 1. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, enqueueResult.[[Value]]). - TRY(transform_stream_error_writable_and_unblock_write(*stream, throw_completion.value().value())); + transform_stream_error_writable_and_unblock_write(*stream, throw_completion.value().value()); // 2. Throw stream.[[readable]].[[storedError]]. return JS::throw_completion(stream->readable()->stored_error()); @@ -4703,23 +4697,21 @@ WebIDL::ExceptionOr transform_stream_default_controller_enqueue(TransformS VERIFY(backpressure); // 2. Perform ! TransformStreamSetBackpressure(stream, true). - TRY(transform_stream_set_backpressure(*stream, true)); + transform_stream_set_backpressure(*stream, true); } return {}; } // https://streams.spec.whatwg.org/#transform-stream-default-controller-error -WebIDL::ExceptionOr transform_stream_default_controller_error(TransformStreamDefaultController& controller, JS::Value error) +void transform_stream_default_controller_error(TransformStreamDefaultController& controller, JS::Value error) { // 1. Perform ! TransformStreamError(controller.[[stream]], e). - TRY(transform_stream_error(*controller.stream(), error)); - - return {}; + transform_stream_error(*controller.stream(), error); } // https://streams.spec.whatwg.org/#transform-stream-default-controller-terminate -WebIDL::ExceptionOr transform_stream_default_controller_terminate(TransformStreamDefaultController& controller) +void transform_stream_default_controller_terminate(TransformStreamDefaultController& controller) { auto& realm = controller.realm(); @@ -4737,9 +4729,7 @@ WebIDL::ExceptionOr transform_stream_default_controller_terminate(Transfor auto error = JS::TypeError::create(realm, "Stream has been terminated."sv); // 5. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, error). - TRY(transform_stream_error_writable_and_unblock_write(*stream, error)); - - return {}; + transform_stream_error_writable_and_unblock_write(*stream, error); } // https://streams.spec.whatwg.org/#transform-stream-default-controller-perform-transform @@ -4755,7 +4745,7 @@ JS::NonnullGCPtr transform_stream_default_controller_perform_tr {}, JS::create_heap_function(realm.heap(), [&controller](JS::Value reason) -> WebIDL::ExceptionOr { // 1. Perform ! TransformStreamError(controller.[[stream]], r). - TRY(transform_stream_error(*controller.stream(), reason)); + transform_stream_error(*controller.stream(), reason); // 2. Throw r. return JS::throw_completion(reason); @@ -4765,12 +4755,12 @@ JS::NonnullGCPtr transform_stream_default_controller_perform_tr } // https://streams.spec.whatwg.org/#transform-stream-default-sink-abort-algorithm -WebIDL::ExceptionOr> transform_stream_default_sink_abort_algorithm(TransformStream& stream, JS::Value reason) +JS::NonnullGCPtr transform_stream_default_sink_abort_algorithm(TransformStream& stream, JS::Value reason) { auto& realm = stream.realm(); // 1. Perform ! TransformStreamError(stream, reason). - TRY(transform_stream_error(stream, reason)); + transform_stream_error(stream, reason); // 2. Return a promise resolved with undefined. return WebIDL::create_resolved_promise(realm, JS::js_undefined()); @@ -4811,7 +4801,7 @@ JS::NonnullGCPtr transform_stream_default_sink_close_algorithm( // 2. If flushPromise was rejected with reason r, then: JS::create_heap_function(realm.heap(), [&stream, readable](JS::Value reason) -> WebIDL::ExceptionOr { // 1. Perform ! TransformStreamError(stream, r). - TRY(transform_stream_error(stream, reason)); + transform_stream_error(stream, reason); // 2. Throw readable.[[storedError]]. return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, readable->stored_error().as_string().utf8_string() }; @@ -4867,7 +4857,7 @@ JS::NonnullGCPtr transform_stream_default_sink_write_algorithm( return transform_stream_default_controller_perform_transform(*controller, chunk); } -WebIDL::ExceptionOr> transform_stream_default_source_pull_algorithm(TransformStream& stream) +JS::NonnullGCPtr transform_stream_default_source_pull_algorithm(TransformStream& stream) { // 1. Assert: stream.[[backpressure]] is true. VERIFY(stream.backpressure().has_value() && *stream.backpressure()); @@ -4876,14 +4866,14 @@ WebIDL::ExceptionOr> transform_stream_default_ VERIFY(stream.backpressure_change_promise()); // 3. Perform ! TransformStreamSetBackpressure(stream, false). - TRY(transform_stream_set_backpressure(stream, false)); + transform_stream_set_backpressure(stream, false); // 4. Return stream.[[backpressureChangePromise]]. return JS::NonnullGCPtr { *stream.backpressure_change_promise() }; } // https://streams.spec.whatwg.org/#transform-stream-error -WebIDL::ExceptionOr transform_stream_error(TransformStream& stream, JS::Value error) +void transform_stream_error(TransformStream& stream, JS::Value error) { VERIFY(stream.readable()->controller().has_value() && stream.readable()->controller()->has>()); @@ -4893,13 +4883,11 @@ WebIDL::ExceptionOr transform_stream_error(TransformStream& stream, JS::Va readable_stream_default_controller_error(*readable_controller, error); // 2. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, e). - TRY(transform_stream_error_writable_and_unblock_write(stream, error)); - - return {}; + transform_stream_error_writable_and_unblock_write(stream, error); } // https://streams.spec.whatwg.org/#transform-stream-error-writable-and-unblock-write -WebIDL::ExceptionOr transform_stream_error_writable_and_unblock_write(TransformStream& stream, JS::Value error) +void transform_stream_error_writable_and_unblock_write(TransformStream& stream, JS::Value error) { // 1. Perform ! TransformStreamDefaultControllerClearAlgorithms(stream.[[controller]]). transform_stream_default_controller_clear_algorithms(*stream.controller()); @@ -4909,13 +4897,11 @@ WebIDL::ExceptionOr transform_stream_error_writable_and_unblock_write(Tran // 3. If stream.[[backpressure]] is true, perform ! TransformStreamSetBackpressure(stream, false). if (stream.backpressure().has_value() && *stream.backpressure()) - TRY(transform_stream_set_backpressure(stream, false)); - - return {}; + transform_stream_set_backpressure(stream, false); } // https://streams.spec.whatwg.org/#transform-stream-set-backpressure -WebIDL::ExceptionOr transform_stream_set_backpressure(TransformStream& stream, bool backpressure) +void transform_stream_set_backpressure(TransformStream& stream, bool backpressure) { auto& realm = stream.realm(); @@ -4931,8 +4917,6 @@ WebIDL::ExceptionOr transform_stream_set_backpressure(TransformStream& str // 4. Set stream.[[backpressure]] to backpressure. stream.set_backpressure(backpressure); - - return {}; } // https://streams.spec.whatwg.org/#is-non-negative-number diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h index 1f08cce740c..1fdbe8e346a 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h @@ -81,7 +81,7 @@ Optional readable_stream_default_controller_get_desired_size(ReadableStr bool readable_stream_default_controller_can_close_or_enqueue(ReadableStreamDefaultController&); WebIDL::ExceptionOr set_up_readable_stream_default_controller(ReadableStream&, ReadableStreamDefaultController&, JS::NonnullGCPtr, JS::NonnullGCPtr, JS::NonnullGCPtr, double high_water_mark, JS::NonnullGCPtr); WebIDL::ExceptionOr set_up_readable_stream_default_controller_from_underlying_source(ReadableStream&, JS::Value underlying_source_value, UnderlyingSource, double high_water_mark, JS::NonnullGCPtr); -WebIDL::ExceptionOr set_up_readable_stream_controller_with_byte_reading_support(ReadableStream&, JS::GCPtr = {}, JS::GCPtr = {}, double high_water_mark = 0); +void set_up_readable_stream_controller_with_byte_reading_support(ReadableStream&, JS::GCPtr = {}, JS::GCPtr = {}, double high_water_mark = 0); WebIDL::ExceptionOr set_up_readable_byte_stream_controller(ReadableStream&, ReadableByteStreamController&, JS::NonnullGCPtr, JS::NonnullGCPtr, JS::NonnullGCPtr, double high_water_mark, JS::Value auto_allocate_chunk_size); WebIDL::ExceptionOr set_up_readable_byte_stream_controller_from_underlying_source(ReadableStream&, JS::Value underlying_source, UnderlyingSource const& underlying_source_dict, double high_water_mark); JS::GCPtr readable_byte_stream_controller_get_byob_request(JS::NonnullGCPtr); @@ -125,7 +125,7 @@ WebIDL::ExceptionOr> acquire_writa bool is_writable_stream_locked(WritableStream const&); WebIDL::ExceptionOr set_up_writable_stream_default_writer(WritableStreamDefaultWriter&, WritableStream&); JS::NonnullGCPtr writable_stream_abort(WritableStream&, JS::Value reason); -WebIDL::ExceptionOr> writable_stream_close(WritableStream&); +JS::NonnullGCPtr writable_stream_close(WritableStream&); JS::NonnullGCPtr writable_stream_add_write_request(WritableStream&); bool writable_stream_close_queued_or_in_flight(WritableStream const&); @@ -143,7 +143,7 @@ void writable_stream_start_erroring(WritableStream&, JS::Value reason); void writable_stream_update_backpressure(WritableStream&, bool backpressure); JS::NonnullGCPtr writable_stream_default_writer_abort(WritableStreamDefaultWriter&, JS::Value reason); -WebIDL::ExceptionOr> writable_stream_default_writer_close(WritableStreamDefaultWriter&); +JS::NonnullGCPtr writable_stream_default_writer_close(WritableStreamDefaultWriter&); void writable_stream_default_writer_ensure_closed_promise_rejected(WritableStreamDefaultWriter&, JS::Value error); void writable_stream_default_writer_ensure_ready_promise_rejected(WritableStreamDefaultWriter&, JS::Value error); Optional writable_stream_default_writer_get_desired_size(WritableStreamDefaultWriter const&); @@ -154,7 +154,7 @@ WebIDL::ExceptionOr set_up_writable_stream_default_controller(WritableStre WebIDL::ExceptionOr set_up_writable_stream_default_controller_from_underlying_sink(WritableStream&, JS::Value underlying_sink_value, UnderlyingSink&, double high_water_mark, JS::NonnullGCPtr size_algorithm); void writable_stream_default_controller_advance_queue_if_needed(WritableStreamDefaultController&); void writable_stream_default_controller_clear_algorithms(WritableStreamDefaultController&); -WebIDL::ExceptionOr writable_stream_default_controller_close(WritableStreamDefaultController&); +void writable_stream_default_controller_close(WritableStreamDefaultController&); void writable_stream_default_controller_error(WritableStreamDefaultController&, JS::Value error); void writable_stream_default_controller_error_if_needed(WritableStreamDefaultController&, JS::Value error); bool writable_stream_default_controller_get_backpressure(WritableStreamDefaultController const&); @@ -164,21 +164,21 @@ void writable_stream_default_controller_process_close(WritableStreamDefaultContr void writable_stream_default_controller_process_write(WritableStreamDefaultController&, JS::Value chunk); void writable_stream_default_controller_write(WritableStreamDefaultController&, JS::Value chunk, JS::Value chunk_size); -WebIDL::ExceptionOr initialize_transform_stream(TransformStream&, JS::NonnullGCPtr start_promise, double writable_high_water_mark, JS::NonnullGCPtr writable_size_algorithm, double readable_high_water_mark, JS::NonnullGCPtr readable_size_algorithm); +void initialize_transform_stream(TransformStream&, JS::NonnullGCPtr start_promise, double writable_high_water_mark, JS::NonnullGCPtr writable_size_algorithm, double readable_high_water_mark, JS::NonnullGCPtr readable_size_algorithm); void set_up_transform_stream_default_controller(TransformStream&, TransformStreamDefaultController&, JS::NonnullGCPtr, JS::NonnullGCPtr); WebIDL::ExceptionOr set_up_transform_stream_default_controller_from_transformer(TransformStream&, JS::Value transformer, Transformer&); void transform_stream_default_controller_clear_algorithms(TransformStreamDefaultController&); WebIDL::ExceptionOr transform_stream_default_controller_enqueue(TransformStreamDefaultController&, JS::Value chunk); -WebIDL::ExceptionOr transform_stream_default_controller_error(TransformStreamDefaultController&, JS::Value error); -WebIDL::ExceptionOr transform_stream_default_controller_terminate(TransformStreamDefaultController&); +void transform_stream_default_controller_error(TransformStreamDefaultController&, JS::Value error); +void transform_stream_default_controller_terminate(TransformStreamDefaultController&); JS::NonnullGCPtr transform_stream_default_controller_perform_transform(TransformStreamDefaultController&, JS::Value chunk); -WebIDL::ExceptionOr> transform_stream_default_sink_abort_algorithm(TransformStream&, JS::Value reason); +JS::NonnullGCPtr transform_stream_default_sink_abort_algorithm(TransformStream&, JS::Value reason); JS::NonnullGCPtr transform_stream_default_sink_close_algorithm(TransformStream&); JS::NonnullGCPtr transform_stream_default_sink_write_algorithm(TransformStream&, JS::Value chunk); -WebIDL::ExceptionOr> transform_stream_default_source_pull_algorithm(TransformStream&); -WebIDL::ExceptionOr transform_stream_error(TransformStream&, JS::Value error); -WebIDL::ExceptionOr transform_stream_error_writable_and_unblock_write(TransformStream&, JS::Value error); -WebIDL::ExceptionOr transform_stream_set_backpressure(TransformStream&, bool backpressure); +JS::NonnullGCPtr transform_stream_default_source_pull_algorithm(TransformStream&); +void transform_stream_error(TransformStream&, JS::Value error); +void transform_stream_error_writable_and_unblock_write(TransformStream&, JS::Value error); +void transform_stream_set_backpressure(TransformStream&, bool backpressure); bool is_non_negative_number(JS::Value); bool can_transfer_array_buffer(JS::ArrayBuffer const& array_buffer); diff --git a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp index 180ef5e5bdf..ef637c259a2 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp @@ -54,9 +54,8 @@ WebIDL::ExceptionOr> TransformStream::construc // 9. Let startPromise be a new promise. auto start_promise = WebIDL::create_promise(realm); - // 10. Perform ! InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, - // readableHighWaterMark, readableSizeAlgorithm). - TRY(initialize_transform_stream(*stream, start_promise, writable_high_water_mark, move(writable_size_algorithm), readable_high_water_mark, move(readable_size_algorithm))); + // 10. Perform ! InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm). + initialize_transform_stream(*stream, start_promise, writable_high_water_mark, move(writable_size_algorithm), readable_high_water_mark, move(readable_size_algorithm)); // 11. Perform ? SetUpTransformStreamDefaultControllerFromTransformer(this, transformer, transformerDict). TRY(set_up_transform_stream_default_controller_from_transformer(*stream, transformer, transformer_dict)); diff --git a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp index b63ef00c833..7a0391a77d2 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp +++ b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.cpp @@ -56,21 +56,17 @@ WebIDL::ExceptionOr TransformStreamDefaultController::enqueue(Optional TransformStreamDefaultController::error(Optional reason) +void TransformStreamDefaultController::error(Optional reason) { // 1. Perform ? TransformStreamDefaultControllerError(this, e). - TRY(transform_stream_default_controller_error(*this, reason.has_value() ? reason.value() : JS::js_undefined())); - - return {}; + transform_stream_default_controller_error(*this, reason.has_value() ? reason.value() : JS::js_undefined()); } // https://streams.spec.whatwg.org/#ts-default-controller-terminate -WebIDL::ExceptionOr TransformStreamDefaultController::terminate() +void TransformStreamDefaultController::terminate() { // 1. Perform ? TransformStreamDefaultControllerTerminate(this). - TRY(transform_stream_default_controller_terminate(*this)); - - return {}; + transform_stream_default_controller_terminate(*this); } } diff --git a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.h b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.h index cd6bf0c171d..e9f7a4cff76 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.h +++ b/Userland/Libraries/LibWeb/Streams/TransformStreamDefaultController.h @@ -21,8 +21,8 @@ public: Optional desired_size(); WebIDL::ExceptionOr enqueue(Optional chunk); - WebIDL::ExceptionOr error(Optional reason = {}); - WebIDL::ExceptionOr terminate(); + void error(Optional reason = {}); + void terminate(); JS::GCPtr flush_algorithm() { return m_flush_algorithm; } void set_flush_algorithm(JS::GCPtr&& value) { m_flush_algorithm = move(value); } diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp index feeb9146186..0a500380cf2 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.cpp @@ -58,7 +58,7 @@ bool WritableStream::locked() const } // https://streams.spec.whatwg.org/#ws-close -WebIDL::ExceptionOr> WritableStream::close() +JS::GCPtr WritableStream::close() { auto& realm = this->realm(); @@ -75,7 +75,7 @@ WebIDL::ExceptionOr> WritableStream::close() } // 3. Return ! WritableStreamClose(this). - return TRY(writable_stream_close(*this))->promise(); + return writable_stream_close(*this)->promise(); } // https://streams.spec.whatwg.org/#ws-abort diff --git a/Userland/Libraries/LibWeb/Streams/WritableStream.h b/Userland/Libraries/LibWeb/Streams/WritableStream.h index 8ec667785cb..933824c46f8 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStream.h +++ b/Userland/Libraries/LibWeb/Streams/WritableStream.h @@ -50,7 +50,7 @@ public: bool locked() const; JS::GCPtr abort(JS::Value reason); - WebIDL::ExceptionOr> close(); + JS::GCPtr close(); WebIDL::ExceptionOr> get_writer(); bool backpressure() const { return m_backpressure; } diff --git a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp index dc9b52c4997..874c056bb27 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp @@ -52,7 +52,7 @@ JS::GCPtr WritableStreamDefaultWriter::ready() } // https://streams.spec.whatwg.org/#default-writer-abort -WebIDL::ExceptionOr> WritableStreamDefaultWriter::abort(JS::Value reason) +JS::GCPtr WritableStreamDefaultWriter::abort(JS::Value reason) { auto& realm = this->realm(); @@ -67,7 +67,7 @@ WebIDL::ExceptionOr> WritableStreamDefaultWriter::abort(JS } // https://streams.spec.whatwg.org/#default-writer-close -WebIDL::ExceptionOr> WritableStreamDefaultWriter::close() +JS::GCPtr WritableStreamDefaultWriter::close() { auto& realm = this->realm(); @@ -86,7 +86,7 @@ WebIDL::ExceptionOr> WritableStreamDefaultWriter::close() } // 4. Return ! WritableStreamDefaultWriterClose(this). - return TRY(writable_stream_default_writer_close(*this))->promise(); + return writable_stream_default_writer_close(*this)->promise(); } // https://streams.spec.whatwg.org/#default-writer-release-lock @@ -106,7 +106,7 @@ WebIDL::ExceptionOr WritableStreamDefaultWriter::release_lock() } // https://streams.spec.whatwg.org/#default-writer-write -WebIDL::ExceptionOr> WritableStreamDefaultWriter::write(JS::Value chunk) +JS::GCPtr WritableStreamDefaultWriter::write(JS::Value chunk) { auto& realm = this->realm(); diff --git a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h index 6f82fc5c77a..2d188425a0e 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h +++ b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h @@ -28,10 +28,10 @@ public: JS::GCPtr closed(); WebIDL::ExceptionOr> desired_size() const; JS::GCPtr ready(); - WebIDL::ExceptionOr> abort(JS::Value reason); - WebIDL::ExceptionOr> close(); + JS::GCPtr abort(JS::Value reason); + JS::GCPtr close(); WebIDL::ExceptionOr release_lock(); - WebIDL::ExceptionOr> write(JS::Value chunk); + JS::GCPtr write(JS::Value chunk); JS::GCPtr closed_promise() { return m_closed_promise; } void set_closed_promise(JS::GCPtr value) { m_closed_promise = value; }