From 8d93cac983a10e2da8d6fb80c268434a34e6db1f Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 17 Nov 2024 04:39:34 +1300 Subject: [PATCH] LibWeb: Return GC::Ref for some Stream promise returning functions These will never return null. --- Libraries/LibWeb/Streams/WritableStream.cpp | 4 ++-- Libraries/LibWeb/Streams/WritableStream.h | 4 ++-- Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp | 6 +++--- Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Libraries/LibWeb/Streams/WritableStream.cpp b/Libraries/LibWeb/Streams/WritableStream.cpp index b1727ace990..cb10b02a35b 100644 --- a/Libraries/LibWeb/Streams/WritableStream.cpp +++ b/Libraries/LibWeb/Streams/WritableStream.cpp @@ -58,7 +58,7 @@ bool WritableStream::locked() const } // https://streams.spec.whatwg.org/#ws-close -GC::Ptr WritableStream::close() +GC::Ref WritableStream::close() { auto& realm = this->realm(); @@ -79,7 +79,7 @@ GC::Ptr WritableStream::close() } // https://streams.spec.whatwg.org/#ws-abort -GC::Ptr WritableStream::abort(JS::Value reason) +GC::Ref WritableStream::abort(JS::Value reason) { auto& realm = this->realm(); diff --git a/Libraries/LibWeb/Streams/WritableStream.h b/Libraries/LibWeb/Streams/WritableStream.h index df5e531d8ee..508d3fde72e 100644 --- a/Libraries/LibWeb/Streams/WritableStream.h +++ b/Libraries/LibWeb/Streams/WritableStream.h @@ -49,8 +49,8 @@ public: virtual ~WritableStream() = default; bool locked() const; - GC::Ptr abort(JS::Value reason); - GC::Ptr close(); + GC::Ref abort(JS::Value reason); + GC::Ref close(); WebIDL::ExceptionOr> get_writer(); bool backpressure() const { return m_backpressure; } diff --git a/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp b/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp index 7f5f63fc587..0967e1b6d18 100644 --- a/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp +++ b/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.cpp @@ -52,7 +52,7 @@ GC::Ptr WritableStreamDefaultWriter::ready() } // https://streams.spec.whatwg.org/#default-writer-abort -GC::Ptr WritableStreamDefaultWriter::abort(JS::Value reason) +GC::Ref WritableStreamDefaultWriter::abort(JS::Value reason) { auto& realm = this->realm(); @@ -67,7 +67,7 @@ GC::Ptr WritableStreamDefaultWriter::abort(JS::Value reason) } // https://streams.spec.whatwg.org/#default-writer-close -GC::Ptr WritableStreamDefaultWriter::close() +GC::Ref WritableStreamDefaultWriter::close() { auto& realm = this->realm(); @@ -106,7 +106,7 @@ void WritableStreamDefaultWriter::release_lock() } // https://streams.spec.whatwg.org/#default-writer-write -GC::Ptr WritableStreamDefaultWriter::write(JS::Value chunk) +GC::Ref WritableStreamDefaultWriter::write(JS::Value chunk) { auto& realm = this->realm(); diff --git a/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h b/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h index fe3ac5718f8..bee59a6ba19 100644 --- a/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h +++ b/Libraries/LibWeb/Streams/WritableStreamDefaultWriter.h @@ -28,10 +28,10 @@ public: GC::Ptr closed(); WebIDL::ExceptionOr> desired_size() const; GC::Ptr ready(); - GC::Ptr abort(JS::Value reason); - GC::Ptr close(); + GC::Ref abort(JS::Value reason); + GC::Ref close(); void release_lock(); - GC::Ptr write(JS::Value chunk); + GC::Ref write(JS::Value chunk); GC::Ptr closed_promise() { return m_closed_promise; } void set_closed_promise(GC::Ptr value) { m_closed_promise = value; }