Sfoglia il codice sorgente

LibWeb: Fix some missing initialize overrides for some Streams classes

This is some more motivation for me to get around to automatically
generate these initialize calls at some point.
Shannon Booth 1 anno fa
parent
commit
1e607f5775

+ 8 - 0
Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.cpp

@@ -1,9 +1,11 @@
 /*
 /*
  * 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 <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/Streams/ReadableByteStreamController.h>
 #include <LibWeb/Streams/ReadableByteStreamController.h>
 #include <LibWeb/Streams/ReadableStream.h>
 #include <LibWeb/Streams/ReadableStream.h>
 #include <LibWeb/Streams/ReadableStreamBYOBRequest.h>
 #include <LibWeb/Streams/ReadableStreamBYOBRequest.h>
@@ -51,6 +53,12 @@ ReadableByteStreamController::ReadableByteStreamController(JS::Realm& realm)
 {
 {
 }
 }
 
 
+void ReadableByteStreamController::initialize(JS::Realm& realm)
+{
+    Base::initialize(realm);
+    set_prototype(&Bindings::ensure_web_prototype<Bindings::ReadableByteStreamControllerPrototype>(realm, "ReadableByteStreamController"_fly_string));
+}
+
 // https://streams.spec.whatwg.org/#rbs-controller-private-cancel
 // https://streams.spec.whatwg.org/#rbs-controller-private-cancel
 WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableByteStreamController::cancel_steps(JS::Value reason)
 WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> ReadableByteStreamController::cancel_steps(JS::Value reason)
 {
 {

+ 2 - 0
Userland/Libraries/LibWeb/Streams/ReadableByteStreamController.h

@@ -130,6 +130,8 @@ private:
 
 
     virtual void visit_edges(Cell::Visitor&) override;
     virtual void visit_edges(Cell::Visitor&) override;
 
 
+    virtual void initialize(JS::Realm&) override;
+
     // https://streams.spec.whatwg.org/#readablebytestreamcontroller-autoallocatechunksize
     // https://streams.spec.whatwg.org/#readablebytestreamcontroller-autoallocatechunksize
     // A positive integer, when the automatic buffer allocation feature is enabled. In that case, this value specifies the size of buffer to allocate. It is undefined otherwise.
     // A positive integer, when the automatic buffer allocation feature is enabled. In that case, this value specifies the size of buffer to allocate. It is undefined otherwise.
     Optional<u64> m_auto_allocate_chunk_size;
     Optional<u64> m_auto_allocate_chunk_size;

+ 7 - 0
Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.cpp

@@ -5,6 +5,7 @@
  * SPDX-License-Identifier: BSD-2-Clause
  * SPDX-License-Identifier: BSD-2-Clause
  */
  */
 
 
+#include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/Streams/ReadableByteStreamController.h>
 #include <LibWeb/Streams/ReadableByteStreamController.h>
 #include <LibWeb/Streams/ReadableStreamBYOBRequest.h>
 #include <LibWeb/Streams/ReadableStreamBYOBRequest.h>
 #include <LibWeb/WebIDL/Buffers.h>
 #include <LibWeb/WebIDL/Buffers.h>
@@ -25,6 +26,12 @@ ReadableStreamBYOBRequest::ReadableStreamBYOBRequest(JS::Realm& realm)
 {
 {
 }
 }
 
 
+void ReadableStreamBYOBRequest::initialize(JS::Realm& realm)
+{
+    Base::initialize(realm);
+    set_prototype(&Bindings::ensure_web_prototype<Bindings::ReadableStreamBYOBRequestPrototype>(realm, "ReadableStreamBYOBRequest"_fly_string));
+}
+
 void ReadableStreamBYOBRequest::visit_edges(Cell::Visitor& visitor)
 void ReadableStreamBYOBRequest::visit_edges(Cell::Visitor& visitor)
 {
 {
     Base::visit_edges(visitor);
     Base::visit_edges(visitor);

+ 2 - 0
Userland/Libraries/LibWeb/Streams/ReadableStreamBYOBRequest.h

@@ -31,6 +31,8 @@ public:
 private:
 private:
     explicit ReadableStreamBYOBRequest(JS::Realm&);
     explicit ReadableStreamBYOBRequest(JS::Realm&);
 
 
+    virtual void initialize(JS::Realm&) override;
+
     virtual void visit_edges(Cell::Visitor&) override;
     virtual void visit_edges(Cell::Visitor&) override;
 
 
     // https://streams.spec.whatwg.org/#readablestreambyobrequest-controller
     // https://streams.spec.whatwg.org/#readablestreambyobrequest-controller