diff --git a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp index f00ade606fe..fb4c5bcf8f8 100644 --- a/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp +++ b/Userland/Libraries/LibWeb/FileAPI/FileReader.cpp @@ -139,7 +139,7 @@ WebIDL::ExceptionOr FileReader::read_operation(Blob& blob, Type type, Opti ByteBuffer bytes; // 8. Let chunkPromise be the result of reading a chunk from stream with reader. - auto chunk_promise = TRY(reader->read()); + auto chunk_promise = reader->read(); // 9. Let isFirstChunk be true. bool is_first_chunk = true; @@ -183,7 +183,7 @@ WebIDL::ExceptionOr FileReader::read_operation(Blob& blob, Type type, Opti // FIXME: 3. If roughly 50ms have passed since these steps were last invoked, queue a task to fire a progress event called progress at fr. // 4. Set chunkPromise to the result of reading a chunk from stream with reader. - chunk_promise = MUST(reader->read()); + chunk_promise = reader->read(); } // 5. Otherwise, if chunkPromise is fulfilled with an object whose done property is true, queue a task to run the following steps and abort this algorithm: else if (chunk_promise->state() == JS::Promise::State::Fulfilled && done.as_bool()) { diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 1633bad0dcd..5f364815a81 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -738,7 +738,7 @@ Vector> Window::pdf_viewer_mime_type_objects() } // https://streams.spec.whatwg.org/#count-queuing-strategy-size-function -WebIDL::ExceptionOr> Window::count_queuing_strategy_size_function() +JS::NonnullGCPtr Window::count_queuing_strategy_size_function() { auto& realm = this->realm(); @@ -760,7 +760,7 @@ WebIDL::ExceptionOr> Window::count_queuin } // https://streams.spec.whatwg.org/#byte-length-queuing-strategy-size-function -WebIDL::ExceptionOr> Window::byte_length_queuing_strategy_size_function() +JS::NonnullGCPtr Window::byte_length_queuing_strategy_size_function() { auto& realm = this->realm(); diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index cd61ebb2848..1b4b23534b1 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -127,8 +127,8 @@ public: CrossOriginPropertyDescriptorMap const& cross_origin_property_descriptor_map() const { return m_cross_origin_property_descriptor_map; } CrossOriginPropertyDescriptorMap& cross_origin_property_descriptor_map() { return m_cross_origin_property_descriptor_map; } - WebIDL::ExceptionOr> count_queuing_strategy_size_function(); - WebIDL::ExceptionOr> byte_length_queuing_strategy_size_function(); + JS::NonnullGCPtr count_queuing_strategy_size_function(); + JS::NonnullGCPtr byte_length_queuing_strategy_size_function(); // JS API functions JS::NonnullGCPtr window() const; diff --git a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp index a7eefe9b335..50f5da4ab32 100644 --- a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp +++ b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.cpp @@ -9,14 +9,13 @@ #include #include #include -#include namespace Web::Streams { JS_DEFINE_ALLOCATOR(ByteLengthQueuingStrategy); // https://streams.spec.whatwg.org/#blqs-constructor -WebIDL::ExceptionOr> ByteLengthQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init) +JS::NonnullGCPtr ByteLengthQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init) { // The new ByteLengthQueuingStrategy(init) constructor steps are: // 1. Set this.[[highWaterMark]] to init["highWaterMark"]. @@ -32,7 +31,7 @@ ByteLengthQueuingStrategy::ByteLengthQueuingStrategy(JS::Realm& realm, double hi ByteLengthQueuingStrategy::~ByteLengthQueuingStrategy() = default; // https://streams.spec.whatwg.org/#blqs-size -WebIDL::ExceptionOr> ByteLengthQueuingStrategy::size() +JS::NonnullGCPtr ByteLengthQueuingStrategy::size() { // 1. Return this's relevant global object's byte length queuing strategy size function. return global_object().byte_length_queuing_strategy_size_function(); diff --git a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.h b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.h index 56fd421066c..7940b42952b 100644 --- a/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.h +++ b/Userland/Libraries/LibWeb/Streams/ByteLengthQueuingStrategy.h @@ -20,7 +20,7 @@ class ByteLengthQueuingStrategy final : public Bindings::PlatformObject { JS_DECLARE_ALLOCATOR(ByteLengthQueuingStrategy); public: - static WebIDL::ExceptionOr> construct_impl(JS::Realm&, QueuingStrategyInit const&); + static JS::NonnullGCPtr construct_impl(JS::Realm&, QueuingStrategyInit const&); virtual ~ByteLengthQueuingStrategy() override; @@ -32,7 +32,7 @@ public: return m_high_water_mark; } - WebIDL::ExceptionOr> size(); + JS::NonnullGCPtr size(); private: explicit ByteLengthQueuingStrategy(JS::Realm&, double high_water_mark); diff --git a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp index 9b28ca4a5c3..ada0e0bbeb2 100644 --- a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp +++ b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.cpp @@ -9,14 +9,13 @@ #include #include #include -#include namespace Web::Streams { JS_DEFINE_ALLOCATOR(CountQueuingStrategy); // https://streams.spec.whatwg.org/#blqs-constructor -WebIDL::ExceptionOr> CountQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init) +JS::NonnullGCPtr CountQueuingStrategy::construct_impl(JS::Realm& realm, QueuingStrategyInit const& init) { // The new CountQueuingStrategy(init) constructor steps are: // 1. Set this.[[highWaterMark]] to init["highWaterMark"]. @@ -32,7 +31,7 @@ CountQueuingStrategy::CountQueuingStrategy(JS::Realm& realm, double high_water_m CountQueuingStrategy::~CountQueuingStrategy() = default; // https://streams.spec.whatwg.org/#cqs-size -WebIDL::ExceptionOr> CountQueuingStrategy::size() +JS::NonnullGCPtr CountQueuingStrategy::size() { // 1. Return this's relevant global object's count queuing strategy size function. return global_object().count_queuing_strategy_size_function(); diff --git a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.h b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.h index b2bd040813c..17cb26d1eb6 100644 --- a/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.h +++ b/Userland/Libraries/LibWeb/Streams/CountQueuingStrategy.h @@ -20,7 +20,7 @@ class CountQueuingStrategy final : public Bindings::PlatformObject { JS_DECLARE_ALLOCATOR(CountQueuingStrategy); public: - static WebIDL::ExceptionOr> construct_impl(JS::Realm&, QueuingStrategyInit const&); + static JS::NonnullGCPtr construct_impl(JS::Realm&, QueuingStrategyInit const&); virtual ~CountQueuingStrategy() override; @@ -32,7 +32,7 @@ public: return m_high_water_mark; } - WebIDL::ExceptionOr> size(); + JS::NonnullGCPtr size(); private: explicit CountQueuingStrategy(JS::Realm&, double high_water_mark); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp index 21bbfdeddd8..c5e51553e8a 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.cpp @@ -83,7 +83,7 @@ bool ReadableStream::locked() const } // https://streams.spec.whatwg.org/#rs-cancel -WebIDL::ExceptionOr> ReadableStream::cancel(JS::Value reason) +JS::NonnullGCPtr ReadableStream::cancel(JS::Value reason) { auto& realm = this->realm(); @@ -134,7 +134,7 @@ WebIDL::ExceptionOr> ReadableStream::pipe_throu return JS::NonnullGCPtr { *transform.readable }; } -WebIDL::ExceptionOr> ReadableStream::pipe_to(WritableStream& destination, StreamPipeOptions const& options) +JS::NonnullGCPtr ReadableStream::pipe_to(WritableStream& destination, StreamPipeOptions const& options) { auto& realm = this->realm(); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStream.h b/Userland/Libraries/LibWeb/Streams/ReadableStream.h index 9b039146073..c77ffd45b2d 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStream.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStream.h @@ -73,10 +73,10 @@ public: virtual ~ReadableStream() override; bool locked() const; - WebIDL::ExceptionOr> cancel(JS::Value reason); + JS::NonnullGCPtr cancel(JS::Value reason); WebIDL::ExceptionOr get_reader(ReadableStreamGetReaderOptions const& = {}); WebIDL::ExceptionOr> pipe_through(ReadableWritablePair transform, StreamPipeOptions const& = {}); - WebIDL::ExceptionOr> pipe_to(WritableStream& destination, StreamPipeOptions const& = {}); + JS::NonnullGCPtr pipe_to(WritableStream& destination, StreamPipeOptions const& = {}); WebIDL::ExceptionOr tee(); Optional& controller() { return m_controller; } diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp index 07b721c837b..185e273efc1 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.cpp @@ -107,7 +107,7 @@ private: JS_DEFINE_ALLOCATOR(BYOBReaderReadIntoRequest); // https://streams.spec.whatwg.org/#byob-reader-read -WebIDL::ExceptionOr> ReadableStreamBYOBReader::read(JS::Handle& view) +JS::NonnullGCPtr ReadableStreamBYOBReader::read(JS::Handle& view) { auto& realm = this->realm(); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.h b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.h index 9fc15f5cd0c..5f34fbf58be 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBReader.h @@ -45,7 +45,7 @@ public: virtual ~ReadableStreamBYOBReader() override = default; - WebIDL::ExceptionOr> read(JS::Handle&); + JS::NonnullGCPtr read(JS::Handle&); void release_lock(); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp index 328b0a41ddc..14a47493944 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp @@ -152,7 +152,7 @@ private: JS_DEFINE_ALLOCATOR(DefaultReaderReadRequest); // https://streams.spec.whatwg.org/#default-reader-read -WebIDL::ExceptionOr> ReadableStreamDefaultReader::read() +JS::NonnullGCPtr ReadableStreamDefaultReader::read() { auto& realm = this->realm(); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.h b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.h index ed68be25cd4..3bdddc1f15c 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.h @@ -73,7 +73,7 @@ public: virtual ~ReadableStreamDefaultReader() override = default; - WebIDL::ExceptionOr> read(); + JS::NonnullGCPtr read(); void read_all_bytes(ReadLoopReadRequest::SuccessSteps, ReadLoopReadRequest::FailureSteps); JS::NonnullGCPtr read_all_bytes_deprecated(); diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp index 6de2c11dd99..4a75b695ff7 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.cpp @@ -9,20 +9,19 @@ #include #include #include -#include #include namespace Web::Streams { // https://streams.spec.whatwg.org/#generic-reader-closed -WebIDL::ExceptionOr> ReadableStreamGenericReaderMixin::closed() +JS::GCPtr ReadableStreamGenericReaderMixin::closed() { // 1. Return this.[[closedPromise]]. return JS::GCPtr { verify_cast(*m_closed_promise->promise()) }; } // https://streams.spec.whatwg.org/#generic-reader-cancel -WebIDL::ExceptionOr> ReadableStreamGenericReaderMixin::cancel(JS::Value reason) +JS::NonnullGCPtr ReadableStreamGenericReaderMixin::cancel(JS::Value reason) { // 1. If this.[[stream]] is undefined, return a promise rejected with a TypeError exception. if (!m_stream) { diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.h b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.h index 5fb50289880..6b8579e5cd5 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamGenericReader.h @@ -19,9 +19,9 @@ class ReadableStreamGenericReaderMixin { public: virtual ~ReadableStreamGenericReaderMixin() = default; - WebIDL::ExceptionOr> closed(); + JS::GCPtr closed(); - WebIDL::ExceptionOr> cancel(JS::Value reason); + JS::NonnullGCPtr cancel(JS::Value reason); JS::GCPtr stream() const { return m_stream; } void set_stream(JS::GCPtr stream) { m_stream = stream; }