mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibWeb: Add AO initialize_writable_stream()
This commit is contained in:
parent
641b9edd89
commit
7d8f24c227
Notes:
sideshowbarker
2024-07-16 23:08:48 +09:00
Author: https://github.com/kennethmyhra
Commit: 7d8f24c227
Pull-request: https://github.com/SerenityOS/serenity/pull/19998
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/shannonbooth
2 changed files with 25 additions and 0 deletions
|
@ -1156,6 +1156,29 @@ bool readable_byte_stream_controller_should_call_pull(ReadableByteStreamControll
|
|||
return false;
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#initialize-writable-stream
|
||||
void initialize_writable_stream(WritableStream& stream)
|
||||
{
|
||||
// 1. Set stream.[[state]] to "writable".
|
||||
stream.set_state(WritableStream::State::Writable);
|
||||
|
||||
// 2. Set stream.[[storedError]], stream.[[writer]], stream.[[controller]], stream.[[inFlightWriteRequest]],
|
||||
// stream.[[closeRequest]], stream.[[inFlightCloseRequest]], and stream.[[pendingAbortRequest]] to undefined.
|
||||
stream.set_stored_error(JS::js_undefined());
|
||||
stream.set_writer({});
|
||||
stream.set_controller({});
|
||||
stream.set_in_flight_write_request({});
|
||||
stream.set_close_request({});
|
||||
stream.set_in_flight_close_request({});
|
||||
stream.set_pending_abort_request({});
|
||||
|
||||
// 3. Set stream.[[writeRequests]] to a new empty list.
|
||||
stream.write_requests().clear();
|
||||
|
||||
// 4. Set stream.[[backpressure]] to false.
|
||||
stream.set_backpressure(false);
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#acquire-writable-stream-default-writer
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> acquire_writable_stream_default_writer(WritableStream& stream)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,8 @@ WebIDL::ExceptionOr<void> readable_byte_stream_controller_handle_queue_drain(Rea
|
|||
void readable_byte_stream_controller_invalidate_byob_request(ReadableByteStreamController&);
|
||||
bool readable_byte_stream_controller_should_call_pull(ReadableByteStreamController const&);
|
||||
|
||||
void initialize_writable_stream(WritableStream&);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> acquire_writable_stream_default_writer(WritableStream&);
|
||||
bool is_writable_stream_locked(WritableStream const&);
|
||||
WebIDL::ExceptionOr<void> set_up_writable_stream_default_writer(WritableStreamDefaultWriter&, WritableStream&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue