From 572a7bb313d98f263df7e65767467593903ffb9a Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 29 Apr 2024 18:15:07 -0400 Subject: [PATCH] LibWeb: Remove exceptional return types from infallible stream AOs --- Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp | 8 ++------ Userland/Libraries/LibWeb/Streams/AbstractOperations.h | 4 ++-- Userland/Libraries/LibWeb/Streams/TransformStream.cpp | 2 +- .../LibWeb/Streams/WritableStreamDefaultWriter.cpp | 6 +++--- .../LibWeb/Streams/WritableStreamDefaultWriter.h | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index f43406bf855..6496ba67260 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -4012,7 +4012,7 @@ Optional writable_stream_default_writer_get_desired_size(WritableStreamD } // https://streams.spec.whatwg.org/#writable-stream-default-writer-release -WebIDL::ExceptionOr writable_stream_default_writer_release(WritableStreamDefaultWriter& writer) +void writable_stream_default_writer_release(WritableStreamDefaultWriter& writer) { auto& realm = writer.realm(); @@ -4039,8 +4039,6 @@ WebIDL::ExceptionOr writable_stream_default_writer_release(WritableStreamD // 8. Set writer.[[stream]] to undefined. writer.set_stream({}); - - return {}; } // https://streams.spec.whatwg.org/#writable-stream-default-writer-write @@ -4592,7 +4590,7 @@ void set_up_transform_stream_default_controller(TransformStream& stream, Transfo } // https://streams.spec.whatwg.org/#set-up-transform-stream-default-controller-from-transformer -WebIDL::ExceptionOr set_up_transform_stream_default_controller_from_transformer(TransformStream& stream, JS::Value transformer, Transformer& transformer_dict) +void set_up_transform_stream_default_controller_from_transformer(TransformStream& stream, JS::Value transformer, Transformer& transformer_dict) { auto& realm = stream.realm(); auto& vm = realm.vm(); @@ -4643,8 +4641,6 @@ WebIDL::ExceptionOr set_up_transform_stream_default_controller_from_transf // 6. Perform ! SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm). set_up_transform_stream_default_controller(stream, *controller, transform_algorithm, flush_algorithm); - - return {}; } // https://streams.spec.whatwg.org/#transform-stream-default-controller-clear-algorithms diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h index 1fdbe8e346a..9a75e91fcb4 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h @@ -147,7 +147,7 @@ JS::NonnullGCPtr writable_stream_default_writer_close(WritableS 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&); -WebIDL::ExceptionOr writable_stream_default_writer_release(WritableStreamDefaultWriter&); +void writable_stream_default_writer_release(WritableStreamDefaultWriter&); JS::NonnullGCPtr writable_stream_default_writer_write(WritableStreamDefaultWriter&, JS::Value chunk); WebIDL::ExceptionOr set_up_writable_stream_default_controller(WritableStream&, WritableStreamDefaultController&, JS::NonnullGCPtr, JS::NonnullGCPtr, JS::NonnullGCPtr, JS::NonnullGCPtr, double high_water_mark, JS::NonnullGCPtr); @@ -166,7 +166,7 @@ void writable_stream_default_controller_write(WritableStreamDefaultController&, 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 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); void transform_stream_default_controller_error(TransformStreamDefaultController&, JS::Value error); diff --git a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp index ef637c259a2..835d2b28784 100644 --- a/Userland/Libraries/LibWeb/Streams/TransformStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/TransformStream.cpp @@ -58,7 +58,7 @@ WebIDL::ExceptionOr> TransformStream::construc 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)); + set_up_transform_stream_default_controller_from_transformer(*stream, transformer, transformer_dict); // 12. If transformerDict["start"] exists, then resolve startPromise with the result of invoking // transformerDict["start"] with argument list « this.[[controller]] » and callback this value transformer. diff --git a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp index 874c056bb27..04b87a8a9ec 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp +++ b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp @@ -90,19 +90,19 @@ JS::GCPtr WritableStreamDefaultWriter::close() } // https://streams.spec.whatwg.org/#default-writer-release-lock -WebIDL::ExceptionOr WritableStreamDefaultWriter::release_lock() +void WritableStreamDefaultWriter::release_lock() { // 1. Let stream be this.[[stream]]. // 2. If stream is undefined, return. if (!m_stream) - return {}; + return; // 3. Assert: stream.[[writer]] is not undefined. VERIFY(m_stream->writer()); // 4. Perform ! WritableStreamDefaultWriterRelease(this). - return writable_stream_default_writer_release(*this); + writable_stream_default_writer_release(*this); } // https://streams.spec.whatwg.org/#default-writer-write diff --git a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h index 2d188425a0e..4b85f4e301c 100644 --- a/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h +++ b/Userland/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h @@ -30,7 +30,7 @@ public: JS::GCPtr ready(); JS::GCPtr abort(JS::Value reason); JS::GCPtr close(); - WebIDL::ExceptionOr release_lock(); + void release_lock(); JS::GCPtr write(JS::Value chunk); JS::GCPtr closed_promise() { return m_closed_promise; }