LibWeb: Return GC::Ref for some Stream promise returning functions

These will never return null.
This commit is contained in:
Shannon Booth 2024-11-17 04:39:34 +13:00 committed by Andreas Kling
parent ab309dcc58
commit 8d93cac983
Notes: github-actions[bot] 2024-11-16 17:34:55 +00:00
4 changed files with 10 additions and 10 deletions

View file

@ -58,7 +58,7 @@ bool WritableStream::locked() const
}
// https://streams.spec.whatwg.org/#ws-close
GC::Ptr<WebIDL::Promise> WritableStream::close()
GC::Ref<WebIDL::Promise> WritableStream::close()
{
auto& realm = this->realm();
@ -79,7 +79,7 @@ GC::Ptr<WebIDL::Promise> WritableStream::close()
}
// https://streams.spec.whatwg.org/#ws-abort
GC::Ptr<WebIDL::Promise> WritableStream::abort(JS::Value reason)
GC::Ref<WebIDL::Promise> WritableStream::abort(JS::Value reason)
{
auto& realm = this->realm();

View file

@ -49,8 +49,8 @@ public:
virtual ~WritableStream() = default;
bool locked() const;
GC::Ptr<WebIDL::Promise> abort(JS::Value reason);
GC::Ptr<WebIDL::Promise> close();
GC::Ref<WebIDL::Promise> abort(JS::Value reason);
GC::Ref<WebIDL::Promise> close();
WebIDL::ExceptionOr<GC::Ref<WritableStreamDefaultWriter>> get_writer();
bool backpressure() const { return m_backpressure; }

View file

@ -52,7 +52,7 @@ GC::Ptr<WebIDL::Promise> WritableStreamDefaultWriter::ready()
}
// https://streams.spec.whatwg.org/#default-writer-abort
GC::Ptr<WebIDL::Promise> WritableStreamDefaultWriter::abort(JS::Value reason)
GC::Ref<WebIDL::Promise> WritableStreamDefaultWriter::abort(JS::Value reason)
{
auto& realm = this->realm();
@ -67,7 +67,7 @@ GC::Ptr<WebIDL::Promise> WritableStreamDefaultWriter::abort(JS::Value reason)
}
// https://streams.spec.whatwg.org/#default-writer-close
GC::Ptr<WebIDL::Promise> WritableStreamDefaultWriter::close()
GC::Ref<WebIDL::Promise> WritableStreamDefaultWriter::close()
{
auto& realm = this->realm();
@ -106,7 +106,7 @@ void WritableStreamDefaultWriter::release_lock()
}
// https://streams.spec.whatwg.org/#default-writer-write
GC::Ptr<WebIDL::Promise> WritableStreamDefaultWriter::write(JS::Value chunk)
GC::Ref<WebIDL::Promise> WritableStreamDefaultWriter::write(JS::Value chunk)
{
auto& realm = this->realm();

View file

@ -28,10 +28,10 @@ public:
GC::Ptr<WebIDL::Promise> closed();
WebIDL::ExceptionOr<Optional<double>> desired_size() const;
GC::Ptr<WebIDL::Promise> ready();
GC::Ptr<WebIDL::Promise> abort(JS::Value reason);
GC::Ptr<WebIDL::Promise> close();
GC::Ref<WebIDL::Promise> abort(JS::Value reason);
GC::Ref<WebIDL::Promise> close();
void release_lock();
GC::Ptr<WebIDL::Promise> write(JS::Value chunk);
GC::Ref<WebIDL::Promise> write(JS::Value chunk);
GC::Ptr<WebIDL::Promise> closed_promise() { return m_closed_promise; }
void set_closed_promise(GC::Ptr<WebIDL::Promise> value) { m_closed_promise = value; }