mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-18 15:32:56 +00:00
LibWeb: Implement the Streams AcquireReadableStreamBYOBReader AO
Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
This commit is contained in:
parent
9ccadf61a2
commit
729f4838c2
|
@ -46,6 +46,21 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamDefaultReader>> acquire_reada
|
|||
return reader;
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#acquire-readable-stream-byob-reader
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> acquire_readable_stream_byob_reader(ReadableStream& stream)
|
||||
{
|
||||
auto& realm = stream.realm();
|
||||
|
||||
// 1. Let reader be a new ReadableStreamBYOBReader.
|
||||
auto reader = TRY(realm.heap().allocate<ReadableStreamBYOBReader>(realm, realm));
|
||||
|
||||
// 2. Perform ? SetUpReadableStreamBYOBReader(reader, stream).
|
||||
TRY(set_up_readable_stream_byob_reader(reader, stream));
|
||||
|
||||
// 3. Return reader.
|
||||
return reader;
|
||||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#is-readable-stream-locked
|
||||
bool is_readable_stream_locked(ReadableStream const& stream)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ using CloseAlgorithm = JS::SafeFunction<WebIDL::ExceptionOr<JS::NonnullGCPtr<Web
|
|||
using WriteAlgorithm = JS::SafeFunction<WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>>(JS::Value)>;
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamDefaultReader>> acquire_readable_stream_default_reader(ReadableStream&);
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> acquire_readable_stream_byob_reader(ReadableStream&);
|
||||
bool is_readable_stream_locked(ReadableStream const&);
|
||||
|
||||
SizeAlgorithm extract_size_algorithm(QueuingStrategy const&);
|
||||
|
|
Loading…
Reference in a new issue