File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
Userland/Libraries/LibWeb/Streams Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -186,6 +186,22 @@ void ReadableStream::close()
186
186
});
187
187
}
188
188
189
+ // https://streams.spec.whatwg.org/#readablestream-error
190
+ void ReadableStream::error (JS::Value error)
191
+ {
192
+ controller ()->visit (
193
+ // 1. If stream.[[controller]] implements ReadableByteStreamController, then perform
194
+ // ! ReadableByteStreamControllerError(stream.[[controller]], e).
195
+ [&](JS::NonnullGCPtr<ReadableByteStreamController> controller) {
196
+ readable_byte_stream_controller_error (controller, error);
197
+ },
198
+
199
+ // 2. Otherwise, perform ! ReadableStreamDefaultControllerError(stream.[[controller]], e).
200
+ [&](JS::NonnullGCPtr<ReadableStreamDefaultController> controller) {
201
+ readable_stream_default_controller_error (controller, error);
202
+ });
203
+ }
204
+
189
205
void ReadableStream::initialize (JS::Realm& realm)
190
206
{
191
207
Base::initialize (realm);
Original file line number Diff line number Diff line change @@ -80,6 +80,7 @@ class ReadableStream final : public Bindings::PlatformObject {
80
80
WebIDL::ExceptionOr<ReadableStreamPair> tee ();
81
81
82
82
void close ();
83
+ void error (JS::Value);
83
84
84
85
Optional<ReadableStreamController>& controller () { return m_controller; }
85
86
void set_controller (Optional<ReadableStreamController> value) { m_controller = move (value); }
You can’t perform that action at this time.
0 commit comments