1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

LibWeb: Implement WritableStreamDefaultWriter.releaseLock()

This commit is contained in:
Matthew Olsson 2023-04-02 10:52:01 -07:00 committed by Linus Groh
parent 5f4da20a56
commit 6bbd920008
5 changed files with 69 additions and 1 deletions

View file

@ -87,6 +87,22 @@ WebIDL::ExceptionOr<JS::GCPtr<JS::Object>> WritableStreamDefaultWriter::close()
return TRY(writable_stream_default_writer_close(*this))->promise();
}
// https://streams.spec.whatwg.org/#default-writer-release-lock
WebIDL::ExceptionOr<void> WritableStreamDefaultWriter::release_lock()
{
// 1. Let stream be this.[[stream]].
// 2. If stream is undefined, return.
if (!m_stream)
return {};
// 3. Assert: stream.[[writer]] is not undefined.
VERIFY(m_stream->writer());
// 4. Perform ! WritableStreamDefaultWriterRelease(this).
return writable_stream_default_writer_release(*this);
}
WritableStreamDefaultWriter::WritableStreamDefaultWriter(JS::Realm& realm)
: Bindings::PlatformObject(realm)
{