mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
LibWeb: Add ReadableStreamGetReaderOptions to ReadableStream.getReader
Co-Authored-By: Matthew Olsson <mattco@serenityos.org>
This commit is contained in:
parent
729f4838c2
commit
0f040456a7
4 changed files with 26 additions and 8 deletions
|
@ -93,14 +93,17 @@ WebIDL::ExceptionOr<JS::GCPtr<JS::Object>> ReadableStream::cancel(JS::Value reas
|
|||
}
|
||||
|
||||
// https://streams.spec.whatwg.org/#rs-get-reader
|
||||
WebIDL::ExceptionOr<ReadableStreamReader> ReadableStream::get_reader()
|
||||
WebIDL::ExceptionOr<ReadableStreamReader> ReadableStream::get_reader(ReadableStreamGetReaderOptions const& options)
|
||||
{
|
||||
// FIXME:
|
||||
// 1. If options["mode"] does not exist, return ? AcquireReadableStreamDefaultReader(this).
|
||||
// 2. Assert: options["mode"] is "byob".
|
||||
// 3. Return ? AcquireReadableStreamBYOBReader(this).
|
||||
if (!options.mode.has_value())
|
||||
return TRY(acquire_readable_stream_default_reader(*this));
|
||||
|
||||
return TRY(acquire_readable_stream_default_reader(*this));
|
||||
// 2. Assert: options["mode"] is "byob".
|
||||
VERIFY(*options.mode == Bindings::ReadableStreamReaderMode::Byob);
|
||||
|
||||
// 3. Return ? AcquireReadableStreamBYOBReader(this).
|
||||
return TRY(acquire_readable_stream_byob_reader(*this));
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<void> ReadableStream::initialize(JS::Realm& realm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue