1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

LibWeb: Add AO initialize_readable_stream()

This commit is contained in:
Kenneth Myhra 2023-07-08 08:18:47 +02:00 committed by Andreas Kling
parent f91c150cfc
commit 8e6b386ff7
2 changed files with 15 additions and 0 deletions

View file

@ -1178,6 +1178,20 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStream>> create_writable_stream(JS:
return stream; return stream;
} }
// https://streams.spec.whatwg.org/#initialize-readable-stream
void initialize_readable_stream(ReadableStream& stream)
{
// 1. Set stream.[[state]] to "readable".
stream.set_state(ReadableStream::State::Readable);
// 2. Set stream.[[reader]] and stream.[[storedError]] to undefined.
stream.set_reader({});
stream.set_stored_error({});
// 3. Set stream.[[disturbed]] to false.
stream.set_disturbed(false);
}
// https://streams.spec.whatwg.org/#initialize-writable-stream // https://streams.spec.whatwg.org/#initialize-writable-stream
void initialize_writable_stream(WritableStream& stream) void initialize_writable_stream(WritableStream& stream)
{ {

View file

@ -91,6 +91,7 @@ void readable_byte_stream_controller_invalidate_byob_request(ReadableByteStreamC
bool readable_byte_stream_controller_should_call_pull(ReadableByteStreamController const&); bool readable_byte_stream_controller_should_call_pull(ReadableByteStreamController const&);
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStream>> create_writable_stream(JS::Realm& realm, StartAlgorithm&& start_algorithm, WriteAlgorithm&& write_algorithm, CloseAlgorithm&& close_algorithm, AbortAlgorithm&& abort_algorithm, double high_water_mark, SizeAlgorithm&& size_algorithm); WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStream>> create_writable_stream(JS::Realm& realm, StartAlgorithm&& start_algorithm, WriteAlgorithm&& write_algorithm, CloseAlgorithm&& close_algorithm, AbortAlgorithm&& abort_algorithm, double high_water_mark, SizeAlgorithm&& size_algorithm);
void initialize_readable_stream(ReadableStream&);
void initialize_writable_stream(WritableStream&); void initialize_writable_stream(WritableStream&);
WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> acquire_writable_stream_default_writer(WritableStream&); WebIDL::ExceptionOr<JS::NonnullGCPtr<WritableStreamDefaultWriter>> acquire_writable_stream_default_writer(WritableStream&);