mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:37:35 +00:00
LibWeb: Implement ReadableStreamBYOBReader constructor
This commit is contained in:
parent
2418a033d4
commit
c279d514e9
3 changed files with 20 additions and 2 deletions
|
@ -1,12 +1,15 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
|
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
|
||||||
|
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibJS/Runtime/PromiseCapability.h>
|
#include <LibJS/Runtime/PromiseCapability.h>
|
||||||
|
#include <LibWeb/Streams/AbstractOperations.h>
|
||||||
#include <LibWeb/Streams/ReadableStream.h>
|
#include <LibWeb/Streams/ReadableStream.h>
|
||||||
#include <LibWeb/Streams/ReadableStreamBYOBReader.h>
|
#include <LibWeb/Streams/ReadableStreamBYOBReader.h>
|
||||||
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||||
|
|
||||||
namespace Web::Streams {
|
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)
|
void ReadableStreamBYOBReader::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
|
|
|
@ -37,6 +37,8 @@ class ReadableStreamBYOBReader final
|
||||||
WEB_PLATFORM_OBJECT(ReadableStreamBYOBReader, Bindings::PlatformObject);
|
WEB_PLATFORM_OBJECT(ReadableStreamBYOBReader, Bindings::PlatformObject);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ReadableStreamBYOBReader>> construct_impl(JS::Realm&, JS::NonnullGCPtr<ReadableStream>);
|
||||||
|
|
||||||
virtual ~ReadableStreamBYOBReader() override = default;
|
virtual ~ReadableStreamBYOBReader() override = default;
|
||||||
|
|
||||||
Vector<NonnullRefPtr<ReadIntoRequest>>& read_into_requests() { return m_read_into_requests; }
|
Vector<NonnullRefPtr<ReadIntoRequest>>& read_into_requests() { return m_read_into_requests; }
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
#import <Streams/ReadableStream.idl>
|
||||||
#import <Streams/ReadableStreamGenericReader.idl>
|
#import <Streams/ReadableStreamGenericReader.idl>
|
||||||
|
|
||||||
|
// https://streams.spec.whatwg.org/#readablestreambyobreader
|
||||||
[Exposed=*]
|
[Exposed=*]
|
||||||
interface ReadableStreamBYOBReader {
|
interface ReadableStreamBYOBReader {
|
||||||
// FIXME: Implement
|
constructor(ReadableStream stream);
|
||||||
// constructor(ReadableStream stream);
|
|
||||||
|
|
||||||
|
// FIXME: Implement
|
||||||
// Promise<ReadableStreamReadResult> read(ArrayBufferView view);
|
// Promise<ReadableStreamReadResult> read(ArrayBufferView view);
|
||||||
// undefined releaseLock();
|
// undefined releaseLock();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue