Commit bbe81b2d authored by Nidhi Jaju's avatar Nidhi Jaju Committed by Commit Bot

Add ReadableStreamGetReaderOptions dictionary to Readable Streams

In an effort to change the blink implementation of readable
streams to better match the Web IDL descriptions in the Streams
API Standard, this CL adds the ReadableStreamGerReaderOptions
dictionary [1] to the ReadableStream class. This allows us to
remove GetReaderValidateOptions() as well, which makes the code
simpler.

[1] https://streams.spec.whatwg.org/#dictdef-readablestreamgetreaderoptions

Bug: 1093862
Change-Id: I6539e6da1434c2258832e3000b2015818849a0e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517214
Commit-Queue: Nidhi Jaju <nidhijaju@google.com>
Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824333}
parent f19f9e01
...@@ -273,6 +273,8 @@ generated_dictionary_sources_in_core = [ ...@@ -273,6 +273,8 @@ generated_dictionary_sources_in_core = [
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_queuing_strategy_init.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_queuing_strategy_init.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_byob_read_result.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_byob_read_result.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_byob_read_result.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_byob_read_result.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_get_reader_options.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_stream_get_reader_options.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_writable_pair.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_writable_pair.cc",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_writable_pair.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_readable_writable_pair.h",
"$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_reporting_observer_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_reporting_observer_options.cc",
......
...@@ -490,6 +490,7 @@ static_idl_files_in_core = get_path_info( ...@@ -490,6 +490,7 @@ static_idl_files_in_core = get_path_info(
"//third_party/blink/renderer/core/streams/readable_stream_byob_request.idl", "//third_party/blink/renderer/core/streams/readable_stream_byob_request.idl",
"//third_party/blink/renderer/core/streams/readable_stream_default_controller.idl", "//third_party/blink/renderer/core/streams/readable_stream_default_controller.idl",
"//third_party/blink/renderer/core/streams/readable_stream_default_reader.idl", "//third_party/blink/renderer/core/streams/readable_stream_default_reader.idl",
"//third_party/blink/renderer/core/streams/readable_stream_get_reader_options.idl",
"//third_party/blink/renderer/core/streams/readable_writable_pair.idl", "//third_party/blink/renderer/core/streams/readable_writable_pair.idl",
"//third_party/blink/renderer/core/streams/stream_pipe_options.idl", "//third_party/blink/renderer/core/streams/stream_pipe_options.idl",
"//third_party/blink/renderer/core/streams/transform_stream.idl", "//third_party/blink/renderer/core/streams/transform_stream.idl",
......
...@@ -740,6 +740,7 @@ core_dictionary_idl_files = ...@@ -740,6 +740,7 @@ core_dictionary_idl_files =
"page/scrolling/scroll_state_init.idl", "page/scrolling/scroll_state_init.idl",
"resize_observer/resize_observer_options.idl", "resize_observer/resize_observer_options.idl",
"streams/readable_stream_byob_read_result.idl", "streams/readable_stream_byob_read_result.idl",
"streams/readable_stream_get_reader_options.idl",
"streams/readable_writable_pair.idl", "streams/readable_writable_pair.idl",
"streams/stream_pipe_options.idl", "streams/stream_pipe_options.idl",
"streams/queuing_strategy_init.idl", "streams/queuing_strategy_init.idl",
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "third_party/blink/renderer/core/streams/miscellaneous_operations.h" #include "third_party/blink/renderer/core/streams/miscellaneous_operations.h"
#include "third_party/blink/renderer/core/streams/promise_handler.h" #include "third_party/blink/renderer/core/streams/promise_handler.h"
#include "third_party/blink/renderer/core/streams/readable_stream_default_controller.h" #include "third_party/blink/renderer/core/streams/readable_stream_default_controller.h"
#include "third_party/blink/renderer/core/streams/readable_stream_get_reader_options.h"
#include "third_party/blink/renderer/core/streams/readable_stream_reader.h" #include "third_party/blink/renderer/core/streams/readable_stream_reader.h"
#include "third_party/blink/renderer/core/streams/readable_writable_pair.h" #include "third_party/blink/renderer/core/streams/readable_writable_pair.h"
#include "third_party/blink/renderer/core/streams/stream_algorithms.h" #include "third_party/blink/renderer/core/streams/stream_algorithms.h"
...@@ -1209,24 +1210,26 @@ ReadableStreamDefaultReader* ReadableStream::getReader( ...@@ -1209,24 +1210,26 @@ ReadableStreamDefaultReader* ReadableStream::getReader(
ScriptState* script_state, ScriptState* script_state,
ExceptionState& exception_state) { ExceptionState& exception_state) {
// https://streams.spec.whatwg.org/#rs-get-reader // https://streams.spec.whatwg.org/#rs-get-reader
// 2. If mode is undefined, return ? AcquireReadableStreamDefaultReader(this, // 1. If options["mode"] does not exist, return ?
// true). // AcquireReadableStreamDefaultReader(this).
return AcquireDefaultReader(script_state, this, true, exception_state); return AcquireDefaultReader(script_state, this, true, exception_state);
} }
ReadableStreamDefaultReader* ReadableStream::getReader( ReadableStreamReader* ReadableStream::getReader(
ScriptState* script_state, ScriptState* script_state,
ScriptValue options, ReadableStreamGetReaderOptions* options,
ExceptionState& exception_state) { ExceptionState& exception_state) {
// https://streams.spec.whatwg.org/#rs-get-reader // https://streams.spec.whatwg.org/#rs-get-reader
// Since we don't support byob readers, the only thing // Since byob readers are not completely implemented yet, this function should
// GetReaderValidateOptions() needs to do is throw an exception if // just call the default getReader().
// |options.mode| is invalid. // TODO(nidhijaju): Add assertion options["mode"] is "byob" and return
GetReaderValidateOptions(script_state, options, exception_state); // ? AcquireReadableStreamBYOBReader(this) according to spec, once byob
if (exception_state.HadException()) { // readers have been implemented.
if (options->hasMode()) {
DCHECK_EQ(options->mode(), "byob");
exception_state.ThrowTypeError("byob not implemented");
return nullptr; return nullptr;
} }
return getReader(script_state, exception_state); return getReader(script_state, exception_state);
} }
...@@ -1805,51 +1808,6 @@ int ReadableStream::GetNumReadRequests(const ReadableStream* stream) { ...@@ -1805,51 +1808,6 @@ int ReadableStream::GetNumReadRequests(const ReadableStream* stream) {
// TODO(ricea): Functions for transferable streams. // TODO(ricea): Functions for transferable streams.
// //
void ReadableStream::GetReaderValidateOptions(ScriptState* script_state,
ScriptValue options,
ExceptionState& exception_state) {
// https://streams.spec.whatwg.org/#rs-get-reader
// The unpacking of |options| is indicated as part of the signature of the
// function in the standard.
v8::TryCatch block(script_state->GetIsolate());
v8::Local<v8::Value> mode;
v8::Local<v8::String> mode_string;
v8::Local<v8::Context> context = script_state->GetContext();
if (options.V8Value()->IsUndefined()) {
mode = v8::Undefined(script_state->GetIsolate());
} else {
v8::Local<v8::Object> v8_options;
if (!options.V8Value()->ToObject(context).ToLocal(&v8_options)) {
exception_state.RethrowV8Exception(block.Exception());
return;
}
if (!v8_options->Get(context, V8String(script_state->GetIsolate(), "mode"))
.ToLocal(&mode)) {
exception_state.RethrowV8Exception(block.Exception());
return;
}
}
// 3. Set mode to ? ToString(mode).
if (!mode->ToString(context).ToLocal(&mode_string)) {
exception_state.RethrowV8Exception(block.Exception());
return;
}
// 4. If mode is "byob", return ? AcquireReadableStreamBYOBReader(this, true).
if (ToCoreString(mode_string) == "byob") {
// TODO(ricea): Support BYOB readers.
exception_state.ThrowTypeError("invalid mode");
return;
}
if (!mode->IsUndefined()) {
// 5. Throw a RangeError exception.
exception_state.ThrowRangeError("invalid mode");
return;
}
}
ScriptValue ReadableStream::CallTeeAndReturnBranchArray( ScriptValue ReadableStream::CallTeeAndReturnBranchArray(
ScriptState* script_state, ScriptState* script_state,
ReadableStream* readable, ReadableStream* readable,
......
...@@ -21,6 +21,7 @@ class AbortSignal; ...@@ -21,6 +21,7 @@ class AbortSignal;
class ExceptionState; class ExceptionState;
class MessagePort; class MessagePort;
class ReadableStreamDefaultController; class ReadableStreamDefaultController;
class ReadableStreamGetReaderOptions;
class ReadableWritablePair; class ReadableWritablePair;
class ScriptPromise; class ScriptPromise;
class ScriptState; class ScriptState;
...@@ -112,9 +113,9 @@ class CORE_EXPORT ReadableStream : public ScriptWrappable { ...@@ -112,9 +113,9 @@ class CORE_EXPORT ReadableStream : public ScriptWrappable {
ReadableStreamDefaultReader* getReader(ScriptState*, ExceptionState&); ReadableStreamDefaultReader* getReader(ScriptState*, ExceptionState&);
// https://streams.spec.whatwg.org/#rs-get-reader // https://streams.spec.whatwg.org/#rs-get-reader
ReadableStreamDefaultReader* getReader(ScriptState*, ReadableStreamReader* getReader(ScriptState*,
ScriptValue options, ReadableStreamGetReaderOptions* options,
ExceptionState&); ExceptionState&);
ReadableStream* pipeThrough(ScriptState*, ReadableStream* pipeThrough(ScriptState*,
ReadableWritablePair* transform, ReadableWritablePair* transform,
...@@ -269,12 +270,6 @@ class CORE_EXPORT ReadableStream : public ScriptWrappable { ...@@ -269,12 +270,6 @@ class CORE_EXPORT ReadableStream : public ScriptWrappable {
// TODO(ricea): Functions for transferable streams. // TODO(ricea): Functions for transferable streams.
// //
// Validates the "options" argument to ReadableStream::getReader().
// If an exception is thrown validation failed.
static void GetReaderValidateOptions(ScriptState*,
ScriptValue options,
ExceptionState&);
// Calls Tee() on |readable|, converts the two branches to a JavaScript array // Calls Tee() on |readable|, converts the two branches to a JavaScript array
// and returns them. // and returns them.
static ScriptValue CallTeeAndReturnBranchArray( static ScriptValue CallTeeAndReturnBranchArray(
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
// https://streams.spec.whatwg.org/#rs-class // https://streams.spec.whatwg.org/#rs-class
enum ReadableStreamReaderMode { "byob" };
[ [
Exposed=(Window,Worker,Worklet) Exposed=(Window,Worker,Worklet)
] interface ReadableStream { ] interface ReadableStream {
...@@ -11,7 +13,7 @@ ...@@ -11,7 +13,7 @@
// TODO(yhirano): function length is different from what's specced. Fix it. // TODO(yhirano): function length is different from what's specced. Fix it.
[RaisesException, CallWith=ScriptState] Promise<any> cancel(optional any reason); [RaisesException, CallWith=ScriptState] Promise<any> cancel(optional any reason);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamGetReader] ReadableStreamDefaultReader getReader(optional any mode); [RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamGetReader] ReadableStreamDefaultReader getReader(optional ReadableStreamGetReaderOptions options);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeThrough] ReadableStream pipeThrough( [RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeThrough] ReadableStream pipeThrough(
ReadableWritablePair transform, optional StreamPipeOptions options); ReadableWritablePair transform, optional StreamPipeOptions options);
[RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeTo] Promise<any> pipeTo( [RaisesException, CallWith=ScriptState, MeasureAs=ReadableStreamPipeTo] Promise<any> pipeTo(
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// https://streams.spec.whatwg.org/#dictdef-readablestreamgetreaderoptions
dictionary ReadableStreamGetReaderOptions {
ReadableStreamReaderMode mode;
};
This is a testharness.js-based test.
PASS ReadableStreamDefaultReader constructor should get a ReadableStream object as argument
PASS ReadableStreamDefaultReader closed should always return the same promise object
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via direct construction)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via direct construction)
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via getReader)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via getReader)
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is closed
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is errored
PASS Reading from a reader for an empty stream will wait until a chunk is available
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through
PASS Getting a second reader after erroring the stream and releasing the reader should succeed
PASS ReadableStreamDefaultReader closed promise should be rejected with undefined if that is the error
PASS ReadableStreamDefaultReader: if start rejects with no parameter, it should error the stream with an undefined error
PASS Erroring a ReadableStream after checking closed should reject ReadableStreamDefaultReader closed promise
PASS Erroring a ReadableStream before checking closed should reject ReadableStreamDefaultReader closed promise
PASS Reading twice on a stream that gets closed
PASS Reading twice on a closed stream
PASS Reading twice on an errored stream
PASS Reading twice on a stream that gets errored
FAIL getReader() should call ToString() on mode assert_throws_js: getReader() should throw function "() => rs.getReader({ mode })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS controller.close() should clear the list of pending read requests
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS ReadableStreamDefaultReader constructor should get a ReadableStream object as argument
PASS ReadableStreamDefaultReader closed should always return the same promise object
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via direct construction)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via direct construction)
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via getReader)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via getReader)
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is closed
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is errored
PASS Reading from a reader for an empty stream will wait until a chunk is available
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through
PASS Getting a second reader after erroring the stream and releasing the reader should succeed
PASS ReadableStreamDefaultReader closed promise should be rejected with undefined if that is the error
PASS ReadableStreamDefaultReader: if start rejects with no parameter, it should error the stream with an undefined error
PASS Erroring a ReadableStream after checking closed should reject ReadableStreamDefaultReader closed promise
PASS Erroring a ReadableStream before checking closed should reject ReadableStreamDefaultReader closed promise
PASS Reading twice on a stream that gets closed
PASS Reading twice on a closed stream
PASS Reading twice on an errored stream
PASS Reading twice on a stream that gets errored
FAIL getReader() should call ToString() on mode assert_throws_js: getReader() should throw function "() => rs.getReader({ mode })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS controller.close() should clear the list of pending read requests
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS ReadableStreamDefaultReader constructor should get a ReadableStream object as argument
PASS ReadableStreamDefaultReader closed should always return the same promise object
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via direct construction)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via direct construction)
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via getReader)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via getReader)
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is closed
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is errored
PASS Reading from a reader for an empty stream will wait until a chunk is available
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through
PASS Getting a second reader after erroring the stream and releasing the reader should succeed
PASS ReadableStreamDefaultReader closed promise should be rejected with undefined if that is the error
PASS ReadableStreamDefaultReader: if start rejects with no parameter, it should error the stream with an undefined error
PASS Erroring a ReadableStream after checking closed should reject ReadableStreamDefaultReader closed promise
PASS Erroring a ReadableStream before checking closed should reject ReadableStreamDefaultReader closed promise
PASS Reading twice on a stream that gets closed
PASS Reading twice on a closed stream
PASS Reading twice on an errored stream
PASS Reading twice on a stream that gets errored
FAIL getReader() should call ToString() on mode assert_throws_js: getReader() should throw function "() => rs.getReader({ mode })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS controller.close() should clear the list of pending read requests
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS ReadableStreamDefaultReader constructor should get a ReadableStream object as argument
PASS ReadableStreamDefaultReader closed should always return the same promise object
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via direct construction)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via direct construction)
PASS Constructing a ReadableStreamDefaultReader directly should fail if the stream is already locked (via getReader)
PASS Getting a ReadableStreamDefaultReader via getReader should fail if the stream is already locked (via getReader)
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is closed
PASS Constructing a ReadableStreamDefaultReader directly should be OK if the stream is errored
PASS Reading from a reader for an empty stream will wait until a chunk is available
PASS cancel() on a reader does not release the reader
PASS closed should be fulfilled after stream is closed (.closed access before acquiring)
PASS closed should be rejected after reader releases its lock (multiple stream locks)
PASS Multiple readers can access the stream in sequence
PASS Cannot use an already-released reader to unlock a stream again
PASS cancel() on a released reader is a no-op and does not pass through
PASS Getting a second reader after erroring the stream and releasing the reader should succeed
PASS ReadableStreamDefaultReader closed promise should be rejected with undefined if that is the error
PASS ReadableStreamDefaultReader: if start rejects with no parameter, it should error the stream with an undefined error
PASS Erroring a ReadableStream after checking closed should reject ReadableStreamDefaultReader closed promise
PASS Erroring a ReadableStream before checking closed should reject ReadableStreamDefaultReader closed promise
PASS Reading twice on a stream that gets closed
PASS Reading twice on a closed stream
PASS Reading twice on an errored stream
PASS Reading twice on a stream that gets errored
FAIL getReader() should call ToString() on mode assert_throws_js: getReader() should throw function "() => rs.getReader({ mode })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS controller.close() should clear the list of pending read requests
Harness: the test ran to completion.
...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu ...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu
PASS ReadableStream constructor will not tolerate initial garbage as pull argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument
PASS ReadableStream start should be called with the proper thisArg PASS ReadableStream start should be called with the proper thisArg
PASS ReadableStream start controller parameter should be extensible PASS ReadableStream start controller parameter should be extensible
FAIL default ReadableStream getReader() should only accept mode:undefined assert_throws_js: function "() => (new ReadableStream()).getReader({ mode: 'potato' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError") PASS default ReadableStream getReader() should only accept mode:undefined
PASS ReadableStream should be able to call start method within prototype chain of its source PASS ReadableStream should be able to call start method within prototype chain of its source
PASS ReadableStream start should be able to return a promise PASS ReadableStream start should be able to return a promise
PASS ReadableStream start should be able to return a promise and reject it PASS ReadableStream start should be able to return a promise and reject it
......
...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu ...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu
PASS ReadableStream constructor will not tolerate initial garbage as pull argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument
PASS ReadableStream start should be called with the proper thisArg PASS ReadableStream start should be called with the proper thisArg
PASS ReadableStream start controller parameter should be extensible PASS ReadableStream start controller parameter should be extensible
FAIL default ReadableStream getReader() should only accept mode:undefined assert_throws_js: function "() => (new ReadableStream()).getReader({ mode: 'potato' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError") PASS default ReadableStream getReader() should only accept mode:undefined
PASS ReadableStream should be able to call start method within prototype chain of its source PASS ReadableStream should be able to call start method within prototype chain of its source
PASS ReadableStream start should be able to return a promise PASS ReadableStream start should be able to return a promise
PASS ReadableStream start should be able to return a promise and reject it PASS ReadableStream start should be able to return a promise and reject it
......
...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu ...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu
PASS ReadableStream constructor will not tolerate initial garbage as pull argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument
PASS ReadableStream start should be called with the proper thisArg PASS ReadableStream start should be called with the proper thisArg
PASS ReadableStream start controller parameter should be extensible PASS ReadableStream start controller parameter should be extensible
FAIL default ReadableStream getReader() should only accept mode:undefined assert_throws_js: function "() => (new ReadableStream()).getReader({ mode: 'potato' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError") PASS default ReadableStream getReader() should only accept mode:undefined
PASS ReadableStream should be able to call start method within prototype chain of its source PASS ReadableStream should be able to call start method within prototype chain of its source
PASS ReadableStream start should be able to return a promise PASS ReadableStream start should be able to return a promise
PASS ReadableStream start should be able to return a promise and reject it PASS ReadableStream start should be able to return a promise and reject it
......
...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu ...@@ -7,7 +7,7 @@ PASS ReadableStream constructor will not tolerate initial garbage as cancel argu
PASS ReadableStream constructor will not tolerate initial garbage as pull argument PASS ReadableStream constructor will not tolerate initial garbage as pull argument
PASS ReadableStream start should be called with the proper thisArg PASS ReadableStream start should be called with the proper thisArg
PASS ReadableStream start controller parameter should be extensible PASS ReadableStream start controller parameter should be extensible
FAIL default ReadableStream getReader() should only accept mode:undefined assert_throws_js: function "() => (new ReadableStream()).getReader({ mode: 'potato' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError") PASS default ReadableStream getReader() should only accept mode:undefined
PASS ReadableStream should be able to call start method within prototype chain of its source PASS ReadableStream should be able to call start method within prototype chain of its source
PASS ReadableStream start should be able to return a promise PASS ReadableStream start should be able to return a promise
PASS ReadableStream start should be able to return a promise and reject it PASS ReadableStream start should be able to return a promise and reject it
......
This is a testharness.js-based test.
Found 86 tests; 85 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Running templatedRSEmpty with ReadableStream (empty)
PASS ReadableStream (empty): instances have the correct methods and properties
FAIL ReadableStream (empty): calling getReader with invalid arguments should throw appropriate errors assert_throws_js: empty string mode should throw function "() => rs.getReader({ mode: '' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Running templatedRSEmptyReader with ReadableStream (empty) reader
PASS ReadableStream (empty) reader: instances have the correct methods and properties
PASS ReadableStream (empty) reader: locked should be true
PASS ReadableStream (empty) reader: read() should never settle
PASS ReadableStream (empty) reader: two read()s should both never settle
PASS ReadableStream (empty) reader: read() should return distinct promises each time
PASS ReadableStream (empty) reader: getReader() again on the stream should fail
PASS ReadableStream (empty) reader: releasing the lock with pending read requests should throw but the read requests should stay pending
PASS ReadableStream (empty) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause closed calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause locked to become false
PASS ReadableStream (empty) reader: canceling via the reader should cause the reader to act closed
PASS ReadableStream (empty) reader: canceling via the stream should fail
PASS Running templatedRSClosed with ReadableStream (closed via call in start)
PASS ReadableStream (closed via call in start): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via call in start): locked should be false
PASS ReadableStream (closed via call in start): getReader() should be OK
PASS ReadableStream (closed via call in start): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via call in start): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed before getting reader)
PASS ReadableStream reader (closed before getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed before getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed before getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosedReader with ReadableStream reader (closed after getting reader)
PASS ReadableStream reader (closed after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosed with ReadableStream (closed via cancel)
PASS ReadableStream (closed via cancel): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via cancel): locked should be false
PASS ReadableStream (closed via cancel): getReader() should be OK
PASS ReadableStream (closed via cancel): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via cancel): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed via cancel after getting reader)
PASS ReadableStream reader (closed via cancel after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed via cancel after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed via cancel after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed via cancel after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSErrored with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via call in start): read() twice should give the error each time
PASS ReadableStream (errored via call in start): locked should be false
PASS Running templatedRSErroredSyncOnly with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): should be able to obtain a second reader, with the correct closed promise
PASS ReadableStream (errored via call in start): should not be able to obtain additional readers if we don't release the first lock
PASS ReadableStream (errored via call in start): cancel() should return a distinct rejected promise each time
PASS ReadableStream (errored via call in start): reader cancel() should return a distinct rejected promise each time
PASS Running templatedRSErrored with ReadableStream (errored via returning a rejected promise in start)
PASS ReadableStream (errored via returning a rejected promise in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via returning a rejected promise in start): read() twice should give the error each time
PASS ReadableStream (errored via returning a rejected promise in start): locked should be false
PASS Running templatedRSErroredReader with ReadableStream (errored via returning a rejected promise in start) reader
PASS ReadableStream (errored via returning a rejected promise in start) reader: closed should reject with the error
PASS ReadableStream (errored via returning a rejected promise in start) reader: releasing the lock should cause closed to reject and change identity
PASS ReadableStream (errored via returning a rejected promise in start) reader: read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored before getting reader)
PASS ReadableStream reader (errored before getting reader): closed should reject with the error
PASS ReadableStream reader (errored before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored before getting reader): read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored after getting reader)
PASS ReadableStream reader (errored after getting reader): closed should reject with the error
PASS ReadableStream reader (errored after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored after getting reader): read() should reject with the error
PASS Running templatedRSTwoChunksOpenReader with ReadableStream (two chunks enqueued, still open) reader
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (sequential)
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (nested)
PASS ReadableStream (two chunks enqueued, still open) reader: read() should return distinct promises each time
PASS ReadableStream (two chunks enqueued, still open) reader: cancel() after a read() should still give that single read result
PASS Running templatedRSTwoChunksClosedReader with ReadableStream (two chunks enqueued, then closed) reader
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (sequential)
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (nested)
PASS ReadableStream (two chunks enqueued, then closed) reader: draining the stream via read() should cause the reader closed promise to fulfill, but locked stays true
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock after the stream is closed should cause locked to become false
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (two chunks enqueued, then closed) reader: reader's closed property always returns the same promise
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 86 tests; 85 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Running templatedRSEmpty with ReadableStream (empty)
PASS ReadableStream (empty): instances have the correct methods and properties
FAIL ReadableStream (empty): calling getReader with invalid arguments should throw appropriate errors assert_throws_js: empty string mode should throw function "() => rs.getReader({ mode: '' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Running templatedRSEmptyReader with ReadableStream (empty) reader
PASS ReadableStream (empty) reader: instances have the correct methods and properties
PASS ReadableStream (empty) reader: locked should be true
PASS ReadableStream (empty) reader: read() should never settle
PASS ReadableStream (empty) reader: two read()s should both never settle
PASS ReadableStream (empty) reader: read() should return distinct promises each time
PASS ReadableStream (empty) reader: getReader() again on the stream should fail
PASS ReadableStream (empty) reader: releasing the lock with pending read requests should throw but the read requests should stay pending
PASS ReadableStream (empty) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause closed calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause locked to become false
PASS ReadableStream (empty) reader: canceling via the reader should cause the reader to act closed
PASS ReadableStream (empty) reader: canceling via the stream should fail
PASS Running templatedRSClosed with ReadableStream (closed via call in start)
PASS ReadableStream (closed via call in start): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via call in start): locked should be false
PASS ReadableStream (closed via call in start): getReader() should be OK
PASS ReadableStream (closed via call in start): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via call in start): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed before getting reader)
PASS ReadableStream reader (closed before getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed before getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed before getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosedReader with ReadableStream reader (closed after getting reader)
PASS ReadableStream reader (closed after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosed with ReadableStream (closed via cancel)
PASS ReadableStream (closed via cancel): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via cancel): locked should be false
PASS ReadableStream (closed via cancel): getReader() should be OK
PASS ReadableStream (closed via cancel): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via cancel): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed via cancel after getting reader)
PASS ReadableStream reader (closed via cancel after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed via cancel after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed via cancel after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed via cancel after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSErrored with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via call in start): read() twice should give the error each time
PASS ReadableStream (errored via call in start): locked should be false
PASS Running templatedRSErroredSyncOnly with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): should be able to obtain a second reader, with the correct closed promise
PASS ReadableStream (errored via call in start): should not be able to obtain additional readers if we don't release the first lock
PASS ReadableStream (errored via call in start): cancel() should return a distinct rejected promise each time
PASS ReadableStream (errored via call in start): reader cancel() should return a distinct rejected promise each time
PASS Running templatedRSErrored with ReadableStream (errored via returning a rejected promise in start)
PASS ReadableStream (errored via returning a rejected promise in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via returning a rejected promise in start): read() twice should give the error each time
PASS ReadableStream (errored via returning a rejected promise in start): locked should be false
PASS Running templatedRSErroredReader with ReadableStream (errored via returning a rejected promise in start) reader
PASS ReadableStream (errored via returning a rejected promise in start) reader: closed should reject with the error
PASS ReadableStream (errored via returning a rejected promise in start) reader: releasing the lock should cause closed to reject and change identity
PASS ReadableStream (errored via returning a rejected promise in start) reader: read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored before getting reader)
PASS ReadableStream reader (errored before getting reader): closed should reject with the error
PASS ReadableStream reader (errored before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored before getting reader): read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored after getting reader)
PASS ReadableStream reader (errored after getting reader): closed should reject with the error
PASS ReadableStream reader (errored after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored after getting reader): read() should reject with the error
PASS Running templatedRSTwoChunksOpenReader with ReadableStream (two chunks enqueued, still open) reader
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (sequential)
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (nested)
PASS ReadableStream (two chunks enqueued, still open) reader: read() should return distinct promises each time
PASS ReadableStream (two chunks enqueued, still open) reader: cancel() after a read() should still give that single read result
PASS Running templatedRSTwoChunksClosedReader with ReadableStream (two chunks enqueued, then closed) reader
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (sequential)
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (nested)
PASS ReadableStream (two chunks enqueued, then closed) reader: draining the stream via read() should cause the reader closed promise to fulfill, but locked stays true
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock after the stream is closed should cause locked to become false
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (two chunks enqueued, then closed) reader: reader's closed property always returns the same promise
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 86 tests; 85 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Running templatedRSEmpty with ReadableStream (empty)
PASS ReadableStream (empty): instances have the correct methods and properties
FAIL ReadableStream (empty): calling getReader with invalid arguments should throw appropriate errors assert_throws_js: empty string mode should throw function "() => rs.getReader({ mode: '' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Running templatedRSEmptyReader with ReadableStream (empty) reader
PASS ReadableStream (empty) reader: instances have the correct methods and properties
PASS ReadableStream (empty) reader: locked should be true
PASS ReadableStream (empty) reader: read() should never settle
PASS ReadableStream (empty) reader: two read()s should both never settle
PASS ReadableStream (empty) reader: read() should return distinct promises each time
PASS ReadableStream (empty) reader: getReader() again on the stream should fail
PASS ReadableStream (empty) reader: releasing the lock with pending read requests should throw but the read requests should stay pending
PASS ReadableStream (empty) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause closed calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause locked to become false
PASS ReadableStream (empty) reader: canceling via the reader should cause the reader to act closed
PASS ReadableStream (empty) reader: canceling via the stream should fail
PASS Running templatedRSClosed with ReadableStream (closed via call in start)
PASS ReadableStream (closed via call in start): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via call in start): locked should be false
PASS ReadableStream (closed via call in start): getReader() should be OK
PASS ReadableStream (closed via call in start): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via call in start): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed before getting reader)
PASS ReadableStream reader (closed before getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed before getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed before getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosedReader with ReadableStream reader (closed after getting reader)
PASS ReadableStream reader (closed after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosed with ReadableStream (closed via cancel)
PASS ReadableStream (closed via cancel): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via cancel): locked should be false
PASS ReadableStream (closed via cancel): getReader() should be OK
PASS ReadableStream (closed via cancel): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via cancel): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed via cancel after getting reader)
PASS ReadableStream reader (closed via cancel after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed via cancel after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed via cancel after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed via cancel after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSErrored with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via call in start): read() twice should give the error each time
PASS ReadableStream (errored via call in start): locked should be false
PASS Running templatedRSErroredSyncOnly with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): should be able to obtain a second reader, with the correct closed promise
PASS ReadableStream (errored via call in start): should not be able to obtain additional readers if we don't release the first lock
PASS ReadableStream (errored via call in start): cancel() should return a distinct rejected promise each time
PASS ReadableStream (errored via call in start): reader cancel() should return a distinct rejected promise each time
PASS Running templatedRSErrored with ReadableStream (errored via returning a rejected promise in start)
PASS ReadableStream (errored via returning a rejected promise in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via returning a rejected promise in start): read() twice should give the error each time
PASS ReadableStream (errored via returning a rejected promise in start): locked should be false
PASS Running templatedRSErroredReader with ReadableStream (errored via returning a rejected promise in start) reader
PASS ReadableStream (errored via returning a rejected promise in start) reader: closed should reject with the error
PASS ReadableStream (errored via returning a rejected promise in start) reader: releasing the lock should cause closed to reject and change identity
PASS ReadableStream (errored via returning a rejected promise in start) reader: read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored before getting reader)
PASS ReadableStream reader (errored before getting reader): closed should reject with the error
PASS ReadableStream reader (errored before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored before getting reader): read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored after getting reader)
PASS ReadableStream reader (errored after getting reader): closed should reject with the error
PASS ReadableStream reader (errored after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored after getting reader): read() should reject with the error
PASS Running templatedRSTwoChunksOpenReader with ReadableStream (two chunks enqueued, still open) reader
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (sequential)
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (nested)
PASS ReadableStream (two chunks enqueued, still open) reader: read() should return distinct promises each time
PASS ReadableStream (two chunks enqueued, still open) reader: cancel() after a read() should still give that single read result
PASS Running templatedRSTwoChunksClosedReader with ReadableStream (two chunks enqueued, then closed) reader
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (sequential)
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (nested)
PASS ReadableStream (two chunks enqueued, then closed) reader: draining the stream via read() should cause the reader closed promise to fulfill, but locked stays true
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock after the stream is closed should cause locked to become false
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (two chunks enqueued, then closed) reader: reader's closed property always returns the same promise
Harness: the test ran to completion.
This is a testharness.js-based test.
Found 86 tests; 85 PASS, 1 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Running templatedRSEmpty with ReadableStream (empty)
PASS ReadableStream (empty): instances have the correct methods and properties
FAIL ReadableStream (empty): calling getReader with invalid arguments should throw appropriate errors assert_throws_js: empty string mode should throw function "() => rs.getReader({ mode: '' })" threw object "RangeError: Failed to execute 'getReader' on 'ReadableStream': invalid mode" ("RangeError") expected instance of function "function TypeError() { [native code] }" ("TypeError")
PASS Running templatedRSEmptyReader with ReadableStream (empty) reader
PASS ReadableStream (empty) reader: instances have the correct methods and properties
PASS ReadableStream (empty) reader: locked should be true
PASS ReadableStream (empty) reader: read() should never settle
PASS ReadableStream (empty) reader: two read()s should both never settle
PASS ReadableStream (empty) reader: read() should return distinct promises each time
PASS ReadableStream (empty) reader: getReader() again on the stream should fail
PASS ReadableStream (empty) reader: releasing the lock with pending read requests should throw but the read requests should stay pending
PASS ReadableStream (empty) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause closed calls to reject with a TypeError
PASS ReadableStream (empty) reader: releasing the lock should cause locked to become false
PASS ReadableStream (empty) reader: canceling via the reader should cause the reader to act closed
PASS ReadableStream (empty) reader: canceling via the stream should fail
PASS Running templatedRSClosed with ReadableStream (closed via call in start)
PASS ReadableStream (closed via call in start): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via call in start): locked should be false
PASS ReadableStream (closed via call in start): getReader() should be OK
PASS ReadableStream (closed via call in start): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via call in start): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed before getting reader)
PASS ReadableStream reader (closed before getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed before getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed before getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed before getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosedReader with ReadableStream reader (closed after getting reader)
PASS ReadableStream reader (closed after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSClosed with ReadableStream (closed via cancel)
PASS ReadableStream (closed via cancel): cancel() should return a distinct fulfilled promise each time
PASS ReadableStream (closed via cancel): locked should be false
PASS ReadableStream (closed via cancel): getReader() should be OK
PASS ReadableStream (closed via cancel): should be able to acquire multiple readers if they are released in succession
PASS ReadableStream (closed via cancel): should not be able to acquire a second reader if we don't release the first one
PASS Running templatedRSClosedReader with ReadableStream reader (closed via cancel after getting reader)
PASS ReadableStream reader (closed via cancel after getting reader): read() should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() multiple times should fulfill with { value: undefined, done: true }
PASS ReadableStream reader (closed via cancel after getting reader): read() should work when used within another read() fulfill callback
PASS ReadableStream reader (closed via cancel after getting reader): closed should fulfill with undefined
PASS ReadableStream reader (closed via cancel after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (closed via cancel after getting reader): cancel() should return a distinct fulfilled promise each time
PASS Running templatedRSErrored with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via call in start): read() twice should give the error each time
PASS ReadableStream (errored via call in start): locked should be false
PASS Running templatedRSErroredSyncOnly with ReadableStream (errored via call in start)
PASS ReadableStream (errored via call in start): should be able to obtain a second reader, with the correct closed promise
PASS ReadableStream (errored via call in start): should not be able to obtain additional readers if we don't release the first lock
PASS ReadableStream (errored via call in start): cancel() should return a distinct rejected promise each time
PASS ReadableStream (errored via call in start): reader cancel() should return a distinct rejected promise each time
PASS Running templatedRSErrored with ReadableStream (errored via returning a rejected promise in start)
PASS ReadableStream (errored via returning a rejected promise in start): getReader() should return a reader that acts errored
PASS ReadableStream (errored via returning a rejected promise in start): read() twice should give the error each time
PASS ReadableStream (errored via returning a rejected promise in start): locked should be false
PASS Running templatedRSErroredReader with ReadableStream (errored via returning a rejected promise in start) reader
PASS ReadableStream (errored via returning a rejected promise in start) reader: closed should reject with the error
PASS ReadableStream (errored via returning a rejected promise in start) reader: releasing the lock should cause closed to reject and change identity
PASS ReadableStream (errored via returning a rejected promise in start) reader: read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored before getting reader)
PASS ReadableStream reader (errored before getting reader): closed should reject with the error
PASS ReadableStream reader (errored before getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored before getting reader): read() should reject with the error
PASS Running templatedRSErroredReader with ReadableStream reader (errored after getting reader)
PASS ReadableStream reader (errored after getting reader): closed should reject with the error
PASS ReadableStream reader (errored after getting reader): releasing the lock should cause closed to reject and change identity
PASS ReadableStream reader (errored after getting reader): read() should reject with the error
PASS Running templatedRSTwoChunksOpenReader with ReadableStream (two chunks enqueued, still open) reader
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (sequential)
PASS ReadableStream (two chunks enqueued, still open) reader: calling read() twice without waiting will eventually give both chunks (nested)
PASS ReadableStream (two chunks enqueued, still open) reader: read() should return distinct promises each time
PASS ReadableStream (two chunks enqueued, still open) reader: cancel() after a read() should still give that single read result
PASS Running templatedRSTwoChunksClosedReader with ReadableStream (two chunks enqueued, then closed) reader
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (sequential)
PASS ReadableStream (two chunks enqueued, then closed) reader: third read(), without waiting, should give { value: undefined, done: true } (nested)
PASS ReadableStream (two chunks enqueued, then closed) reader: draining the stream via read() should cause the reader closed promise to fulfill, but locked stays true
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock after the stream is closed should cause locked to become false
PASS ReadableStream (two chunks enqueued, then closed) reader: releasing the lock should cause further read() calls to reject with a TypeError
PASS ReadableStream (two chunks enqueued, then closed) reader: reader's closed property always returns the same promise
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment