mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +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
2 changed files with 16 additions and 0 deletions
|
@ -46,6 +46,21 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamDefaultReader>> acquire_reada
|
||||||
return reader;
|
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
|
// https://streams.spec.whatwg.org/#is-readable-stream-locked
|
||||||
bool is_readable_stream_locked(ReadableStream const& stream)
|
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)>;
|
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<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&);
|
bool is_readable_stream_locked(ReadableStream const&);
|
||||||
|
|
||||||
SizeAlgorithm extract_size_algorithm(QueuingStrategy const&);
|
SizeAlgorithm extract_size_algorithm(QueuingStrategy const&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue