From a9a3dcd9525c808eec37d98d53a9a98c7ec40913 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sat, 25 Nov 2023 22:18:43 +1300 Subject: [PATCH] LibWeb: Use ArrayBufferView in ReadableStreamBYOBRequest --- .../Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp | 4 +++- .../Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h | 7 ++++--- .../Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.idl | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp index 97a926d5cc..96bf1bfc68 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp @@ -1,18 +1,20 @@ /* * Copyright (c) 2023, Matthew Olsson + * Copyright (c) 2023, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ #include #include +#include namespace Web::Streams { JS_DEFINE_ALLOCATOR(ReadableStreamBYOBRequest); // https://streams.spec.whatwg.org/#rs-byob-request-view -JS::GCPtr ReadableStreamBYOBRequest::view() +JS::GCPtr ReadableStreamBYOBRequest::view() { // 1. Return this.[[view]]. return m_view; diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h index ab73147f43..1ac211a20b 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2023, Matthew Olsson + * Copyright (c) 2023, Shannon Booth * * SPDX-License-Identifier: BSD-2-Clause */ @@ -21,11 +22,11 @@ class ReadableStreamBYOBRequest : public Bindings::PlatformObject { public: virtual ~ReadableStreamBYOBRequest() override = default; - JS::GCPtr view(); + JS::GCPtr view(); void set_controller(JS::GCPtr value) { m_controller = value; } - void set_view(JS::GCPtr value) { m_view = value; } + void set_view(JS::GCPtr value) { m_view = value; } private: explicit ReadableStreamBYOBRequest(JS::Realm&); @@ -38,7 +39,7 @@ private: // https://streams.spec.whatwg.org/#readablestreambyobrequest-view // A typed array representing the destination region to which the controller can write generated data, or null after the BYOB request has been invalidated. - JS::GCPtr m_view; + JS::GCPtr m_view; }; } diff --git a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.idl b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.idl index d02b60b630..9efd281b8e 100644 --- a/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.idl +++ b/Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.idl @@ -1,8 +1,7 @@ // https://streams.spec.whatwg.org/#readablestreambyobrequest [Exposed=*] interface ReadableStreamBYOBRequest { - // FIXME: This should be an ArrayBufferView - readonly attribute any view; + readonly attribute ArrayBufferView? view; // FIXME: undefined respond([EnforceRange] unsigned long long bytesWritten); // FIXME: undefined respondWithNewView(ArrayBufferView view);