LibWeb: Implement ReadableStreamBYOBReader constructor

This commit is contained in:
Shannon Booth 2023-08-27 12:55:25 +12:00 committed by Andrew Kaster
parent 2418a033d4
commit c279d514e9
Notes: sideshowbarker 2024-07-17 01:51:00 +09:00
3 changed files with 20 additions and 2 deletions

View file

@ -1,12 +1,15 @@
/*
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/PromiseCapability.h>
#include <LibWeb/Streams/AbstractOperations.h>
#include <LibWeb/Streams/ReadableStream.h>
#include <LibWeb/Streams/ReadableStreamBYOBReader.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::Streams {
@ -16,6 +19,17 @@ ReadableStreamBYOBReader::ReadableStreamBYOBReader(JS::Realm& realm)
{
}
// https://streams.spec.whatwg.org/#byob-reader-constructor
WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> ReadableStreamBYOBReader::construct_impl(JS::Realm& realm, JS::NonnullGCPtr<ReadableStream> stream)
{
auto reader = realm.heap().allocate<ReadableStreamBYOBReader>(realm, realm);
// 1. Perform ? SetUpReadableStreamBYOBReader(this, stream).
TRY(set_up_readable_stream_byob_reader(reader, *stream));
return reader;
}
void ReadableStreamBYOBReader::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);