Commit 22f1175d authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

Update WritableStream to latest standard version

Update WritableStream to match the standard version
https://github.com/whatwg/streams/commit/7b8dffe8ec270bb918340e011349e2c1b5521a15.

* Significant user-visible changes:

Method lookups are now cached at construction time. Changing
underlyingSink.write after construction will no longer do anything. This
is https://github.com/whatwg/streams/pull/860.

When abort(reason) is called, the stored error will now be set to
|reason| instead of a TypeError. This is
https://github.com/whatwg/streams/pull/903.

* Significant internal changes:

CreateWritableStream() operation is now exported. TransformStream will
be modified to use this in a follow-up CL. This is
https://github.com/whatwg/streams/pull/857.

New common operations ValidateAndNormalizeQueuingStrategy,
MakeSizeAlgorithmFromSizeFunction, CreateAlgorithmFromUnderlyingMethod
and CreateAlgorithmFromUnderlyingMethodPassingController are
implemented.

Remove PromiseCallOrNoop0 and PromiseCallOrNoop2 as they are no longer
used.

Update external/wpt/streams test expectations for the massive reduction
in failures. Also chromium simple-queue tests expected abort() to result
in a TypeError, and needed updating. Also remove the expectation that
external/wpt/streams/readable-streams general.html will Timeout, since
none of the other tests using general.js are marked Timeout.

Bug: 820246, 820387, 626703
Change-Id: Id1364921c37b03cdf3c89e201079292b13b9214c
Reviewed-on: https://chromium-review.googlesource.com/961566
Commit-Queue: Adam Rice <ricea@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543659}
parent 77b2f6c2
......@@ -1987,7 +1987,6 @@ crbug.com/626703 external/wpt/screen-orientation/onchange-event.html [ Timeout ]
crbug.com/626703 external/wpt/screen-orientation/onchange-event-subframe.html [ Timeout ]
crbug.com/626703 external/wpt/service-workers/service-worker/update-bytecheck.https.html [ Timeout ]
crbug.com/626703 external/wpt/speech-api/SpeechSynthesis-speak-twice.html [ Timeout ]
crbug.com/626703 external/wpt/streams/readable-streams/general.html [ Failure Timeout ]
crbug.com/626703 external/wpt/svg/linking/reftests/href-filter-element.html [ Failure ]
crbug.com/626703 external/wpt/wasm/wasm_indexeddb_test.https.html [ Failure ]
crbug.com/626703 external/wpt/wasm/wasm_local_iframe_test.html [ Failure ]
......
This is a testharness.js-based test.
PASS Errors must be propagated backward: starts errored; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = undefined (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = null (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = false (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = -0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = NaN (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = a (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 1 (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = Symbol() (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = [object Object] (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write, preventCancel = true; preventAbort = true
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true, preventAbort = true, preventClose = true
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel = true
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel omitted (but cancel is never called)
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = true
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; fulfilled cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; rejected cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel = true assert_throws: function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Errors must be propagated backward: erroring via the controller errors once pending write completes
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Errors must be propagated backward: starts errored; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = undefined (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = null (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = false (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = -0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = NaN (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = a (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 1 (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = Symbol() (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = [object Object] (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write, preventCancel = true; preventAbort = true
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true, preventAbort = true, preventClose = true
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel = true
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel omitted (but cancel is never called)
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = true
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; fulfilled cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; rejected cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel = true assert_throws: function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Errors must be propagated backward: erroring via the controller errors once pending write completes
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS Errors must be propagated backward: starts errored; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = undefined (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = null (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = false (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = -0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = NaN (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = a (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 1 (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = Symbol() (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = [object Object] (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write, preventCancel = true; preventAbort = true
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true, preventAbort = true, preventClose = true
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel = true
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel omitted (but cancel is never called)
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = true
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; fulfilled cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; rejected cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel = true assert_throws: function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Errors must be propagated backward: erroring via the controller errors once pending write completes
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Errors must be propagated backward: starts errored; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = undefined (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = null (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = false (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = -0 (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = NaN (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = (falsy); fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = a (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = 1 (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = Symbol() (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = [object Object] (truthy)
PASS Errors must be propagated backward: becomes errored before piping due to write, preventCancel = true; preventAbort = true
PASS Errors must be propagated backward: becomes errored before piping due to write; preventCancel = true, preventAbort = true, preventClose = true
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write; preventCancel = true
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored during piping due to write, but async; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel omitted; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel omitted (but cancel is never called)
PASS Errors must be propagated backward: becomes errored after piping due to last write; source is closed; preventCancel = true
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; fulfilled cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = false; rejected cancel promise
PASS Errors must be propagated backward: becomes errored after piping; dest never desires chunks; preventCancel = true
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; fulfilled cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel omitted; rejected cancel promise assert_equals: the promise must reject with error1 expected object "error1: error1!" but got object "TypeError: The stream is in the process of being aborted"
FAIL Errors must be propagated backward: becomes errored before piping via abort; preventCancel = true assert_throws: function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Errors must be propagated backward: erroring via the controller errors once pending write completes
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Piping from an errored readable stream to an errored writable stream
PASS Piping from an errored readable stream to an errored writable stream; preventAbort = true
FAIL Piping from an errored readable stream to a closing writable stream assert_throws: closed must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Piping from an errored readable stream to a closed writable stream
PASS Piping from a closed readable stream to an errored writable stream
PASS Piping from a closed readable stream to a closed writable stream
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Piping from an errored readable stream to an errored writable stream
PASS Piping from an errored readable stream to an errored writable stream; preventAbort = true
FAIL Piping from an errored readable stream to a closing writable stream assert_throws: closed must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Piping from an errored readable stream to a closed writable stream
PASS Piping from a closed readable stream to an errored writable stream
PASS Piping from a closed readable stream to a closed writable stream
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS Piping from an errored readable stream to an errored writable stream
PASS Piping from an errored readable stream to an errored writable stream; preventAbort = true
FAIL Piping from an errored readable stream to a closing writable stream assert_throws: closed must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Piping from an errored readable stream to a closed writable stream
PASS Piping from a closed readable stream to an errored writable stream
PASS Piping from a closed readable stream to a closed writable stream
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Piping from an errored readable stream to an errored writable stream
PASS Piping from an errored readable stream to an errored writable stream; preventAbort = true
FAIL Piping from an errored readable stream to a closing writable stream assert_throws: closed must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1!" ("error1")
PASS Piping from an errored readable stream to a closed writable stream
PASS Piping from a closed readable stream to an errored writable stream
PASS Piping from a closed readable stream to a closed writable stream
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS ReadableStream can be constructed with no errors
PASS ReadableStream can't be constructed with garbage
PASS ReadableStream can't be constructed with an invalid type
PASS ReadableStream instances should have the correct list of properties
PASS ReadableStream constructor should throw for non-function start arguments
FAIL ReadableStream constructor will not tolerate initial garbage as cancel argument assert_throws: constructor should throw function "() => new ReadableStream({ cancel: '2' })" did not throw
FAIL ReadableStream constructor will not tolerate initial garbage as pull argument assert_throws: constructor should throw function "() => new ReadableStream({ pull: { } })" did not throw
FAIL ReadableStream start should be called with the proper parameters assert_equals: constructor should have no parameters expected 0 but got 5
PASS ReadableStream start controller parameter should be extensible
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 start should be able to return a promise
PASS ReadableStream start should be able to return a promise and reject it
PASS ReadableStream should be able to enqueue different objects.
PASS ReadableStream: if pull rejects, it should error the stream
PASS ReadableStream: should only call pull once upon starting the stream
PASS ReadableStream: should call pull when trying to read from a started, empty stream
PASS ReadableStream: should only call pull once on a non-empty stream read from before start fulfills
PASS ReadableStream: should only call pull once on a non-empty stream read from after start fulfills
PASS ReadableStream: should call pull in reaction to read()ing the last chunk, if not draining
PASS ReadableStream: should not call pull() in reaction to read()ing the last chunk, if draining
PASS ReadableStream: should not call pull until the previous pull call's promise fulfills
PASS ReadableStream: should pull after start, and after every read
PASS ReadableStream: should not call pull after start if the stream is now closed
PASS ReadableStream: should call pull after enqueueing from inside pull (with no read requests), if strategy allows
PASS ReadableStream pull should be able to close a stream.
PASS ReadableStream pull should be able to error a stream.
PASS ReadableStream pull should be able to error a stream and throw.
PASS ReadableStream: enqueue should throw when the stream is readable but draining
PASS ReadableStream: enqueue should throw when the stream is closed
PASS ReadableStream: should call underlying source methods as methods
FAIL ReadableStream: desiredSize when closed assert_equals: after closing, desiredSize must be 0 expected 0 but got 10
FAIL ReadableStream: desiredSize when errored assert_equals: after erroring, desiredSize must be null expected (object) null but got (number) 10
PASS ReadableStream strategies: the default strategy should give desiredSize of 1 to start, decreasing by 1 per enqueue
PASS ReadableStream strategies: the default strategy should continue giving desiredSize of 1 if the chunks are read immediately
PASS ReadableStream integration test: adapting a random push source
PASS ReadableStream integration test: adapting a sync pull source
PASS ReadableStream integration test: adapting an async pull source
Harness: the test ran to completion.
......@@ -10,14 +10,14 @@ PASS when strategy.size calls controller.error() then throws, the constructor sh
PASS cancelling the readable side should error the writable
PASS it should be possible to error the readable between close requested and complete
PASS an exception from transform() should error the stream if terminate has been requested but not completed
FAIL abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed
PASS abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed
PASS controller.error() should do nothing the second time it is called
PASS controller.error() should do nothing after readable.cancel()
FAIL controller.error() should do nothing after writable.abort() has completed assert_throws: closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS controller.error() should do nothing after writable.abort() has completed
PASS controller.error() should do nothing after a transformer method has thrown an exception
PASS erroring during write with backpressure should result in the write failing
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: read() should reject function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL the readable should be errored with the reason passed to the writable abort() method assert_throws: read() should reject with thrownError function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
Harness: the test ran to completion.
......@@ -10,14 +10,14 @@ PASS when strategy.size calls controller.error() then throws, the constructor sh
PASS cancelling the readable side should error the writable
PASS it should be possible to error the readable between close requested and complete
PASS an exception from transform() should error the stream if terminate has been requested but not completed
FAIL abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed
PASS abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed
PASS controller.error() should do nothing the second time it is called
PASS controller.error() should do nothing after readable.cancel()
FAIL controller.error() should do nothing after writable.abort() has completed assert_throws: closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS controller.error() should do nothing after writable.abort() has completed
PASS controller.error() should do nothing after a transformer method has thrown an exception
PASS erroring during write with backpressure should result in the write failing
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: read() should reject function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL the readable should be errored with the reason passed to the writable abort() method assert_throws: read() should reject with thrownError function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
Harness: the test ran to completion.
......@@ -11,14 +11,14 @@ PASS when strategy.size calls controller.error() then throws, the constructor sh
PASS cancelling the readable side should error the writable
PASS it should be possible to error the readable between close requested and complete
PASS an exception from transform() should error the stream if terminate has been requested but not completed
FAIL abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed
PASS abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed
PASS controller.error() should do nothing the second time it is called
PASS controller.error() should do nothing after readable.cancel()
FAIL controller.error() should do nothing after writable.abort() has completed assert_throws: closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS controller.error() should do nothing after writable.abort() has completed
PASS controller.error() should do nothing after a transformer method has thrown an exception
PASS erroring during write with backpressure should result in the write failing
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: read() should reject function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL the readable should be errored with the reason passed to the writable abort() method assert_throws: read() should reject with thrownError function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
Harness: the test ran to completion.
......@@ -10,14 +10,14 @@ PASS when strategy.size calls controller.error() then throws, the constructor sh
PASS cancelling the readable side should error the writable
PASS it should be possible to error the readable between close requested and complete
PASS an exception from transform() should error the stream if terminate has been requested but not completed
FAIL abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed assert_throws: writer.closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS abort should set the close reason for the writable when it happens before cancel during start, but cancel should still succeed
PASS abort should set the close reason for the writable when it happens before cancel during underlying sink write, but cancel should still succeed
PASS controller.error() should do nothing the second time it is called
PASS controller.error() should do nothing after readable.cancel()
FAIL controller.error() should do nothing after writable.abort() has completed assert_throws: closed should reject with thrownError function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
PASS controller.error() should do nothing after writable.abort() has completed
PASS controller.error() should do nothing after a transformer method has thrown an exception
PASS erroring during write with backpressure should result in the write failing
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL a write() that was waiting for backpressure should reject if the writable is aborted assert_throws: read() should reject function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
FAIL the readable should be errored with the reason passed to the writable abort() method assert_throws: read() should reject with thrownError function "function() { throw e }" threw object "TypeError: The writable stream has been aborted" ("TypeError") expected object "error1: bad things are happening!" ("error1")
Harness: the test ran to completion.
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = error1
Found 54 tests; 26 PASS, 28 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL Aborting a WritableStream before it starts should cause the writer's unsettled ready promise to reject assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream should cause the writer's fulfilled ready promise to reset to a rejected one assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() on a released writer rejects
FAIL Aborting a WritableStream immediately prevents future writes assert_throws: write(1) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream prevents further writes after any that are in progress assert_throws: write(2) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value
PASS WritableStream if sink's abort throws, the promise returned by writer.abort() rejects
FAIL WritableStream if sink's abort throws, the promise returned by multiple writer.abort()s is the same and rejects assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
PASS WritableStream if sink's abort throws, the promise returned by ws.abort() rejects
PASS WritableStream if sink's abort throws, for an abort performed during a write, the promise returned by ws.abort() rejects
PASS Aborting a WritableStream passes through the given reason
FAIL Aborting a WritableStream puts it in an errored state with the error passed to abort() assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the reason supplied assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Closing but then immediately aborting a WritableStream causes the stream to error assert_throws: close() should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Closing a WritableStream and aborting it while it closes causes the stream to ignore the abort attempt
PASS Aborting a WritableStream after it is closed is a no-op
FAIL WritableStream should NOT call underlying sink's close if no abort is supplied (historical) assert_throws: closed should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS returning a thenable from abort() should work
FAIL .closed should not resolve before fulfilled write() assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL .closed should not resolve before rejected write(); write() error should not overwrite abort() error assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL writes should be satisfied in order when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writes should be satisfied in order after rejected write when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL close() should reject with abort reason why abort() is first error assert_throws: writer.close() should reject with error from underlying write() function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS underlying abort() should not be called until underlying write() completes
PASS underlying abort() should not be called if underlying close() has started
PASS if underlying close() has started and then rejects, the abort() and close() promises should reject with the underlying close rejection reason
FAIL an abort() that happens during a write() should trigger the underlying abort() even with a close() queued assert_throws: promise returned by close() should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL if a writer is created for a stream with a pending abort, its ready should be rejected with the abort error assert_throws: ready of the second writer should be rejected with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS writer close() promise should resolve before abort() promise
PASS writer.ready should reject on controller error without waiting for underlying write
FAIL writer.abort() while there is an in-flight write, and then finish the write with rejection assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight write, and then finish the write assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight close, and then finish the close assert_throws: writer.ready must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS controller.error(), writer.abort() while there is an in-flight write, and then finish the write
PASS controller.error(), writer.abort() while there is an in-flight close, and then finish the close
PASS releaseLock() while aborting should reject the original closed promise
PASS releaseLock() during delayed async abort() should reject the writer.closed promise
PASS sink abort() should not be called until sink start() is done
PASS if start attempts to error the controller after abort() has been called, then it should lose
PASS stream abort() promise should still resolve if sink start() rejects
FAIL writer abort() during sink start() should replace the writer.ready promise synchronously assert_throws: writerReady2 should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL promises returned from other writer methods should be rejected when writer abort() happens during sink start() assert_throws: second write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() should succeed despite rejection from write
PASS abort() should be rejected with the rejection returned from close()
FAIL a rejecting sink.write() should not prevent sink.abort() from being called assert_throws: closed should reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS when start errors after stream abort(), underlying sink abort() should be called anyway
FAIL when calling abort() twice on the same stream, both should give the same promise that fulfills with undefined assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
FAIL when calling abort() twice on the same stream, but sequentially so so there's no pending abort the second time, both should fulfill with undefined promise_test: Unhandled rejection with value: object "TypeError: The stream is in the process of being aborted"
FAIL calling abort() on an errored stream should fulfill with undefined promise_test: Unhandled rejection with value: object "error1: error1"
PASS sink abort() should not be called if stream was erroring due to controller.error() before abort() was called
PASS sink abort() should not be called if stream was erroring due to bad strategy before abort() was called
FAIL abort with no arguments should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with an undefined argument should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with a string argument should set the stored error to that argument assert_equals: e should be 'string argument' expected (string) "string argument" but got (object) object "TypeError: The stream is in the process of being aborted"
Harness: the test ran to completion.
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = error1
Found 54 tests; 26 PASS, 28 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL Aborting a WritableStream before it starts should cause the writer's unsettled ready promise to reject assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream should cause the writer's fulfilled ready promise to reset to a rejected one assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() on a released writer rejects
FAIL Aborting a WritableStream immediately prevents future writes assert_throws: write(1) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream prevents further writes after any that are in progress assert_throws: write(2) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value
PASS WritableStream if sink's abort throws, the promise returned by writer.abort() rejects
FAIL WritableStream if sink's abort throws, the promise returned by multiple writer.abort()s is the same and rejects assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
PASS WritableStream if sink's abort throws, the promise returned by ws.abort() rejects
PASS WritableStream if sink's abort throws, for an abort performed during a write, the promise returned by ws.abort() rejects
PASS Aborting a WritableStream passes through the given reason
FAIL Aborting a WritableStream puts it in an errored state with the error passed to abort() assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the reason supplied assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Closing but then immediately aborting a WritableStream causes the stream to error assert_throws: close() should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Closing a WritableStream and aborting it while it closes causes the stream to ignore the abort attempt
PASS Aborting a WritableStream after it is closed is a no-op
FAIL WritableStream should NOT call underlying sink's close if no abort is supplied (historical) assert_throws: closed should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS returning a thenable from abort() should work
FAIL .closed should not resolve before fulfilled write() assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL .closed should not resolve before rejected write(); write() error should not overwrite abort() error assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL writes should be satisfied in order when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writes should be satisfied in order after rejected write when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL close() should reject with abort reason why abort() is first error assert_throws: writer.close() should reject with error from underlying write() function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS underlying abort() should not be called until underlying write() completes
PASS underlying abort() should not be called if underlying close() has started
PASS if underlying close() has started and then rejects, the abort() and close() promises should reject with the underlying close rejection reason
FAIL an abort() that happens during a write() should trigger the underlying abort() even with a close() queued assert_throws: promise returned by close() should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL if a writer is created for a stream with a pending abort, its ready should be rejected with the abort error assert_throws: ready of the second writer should be rejected with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS writer close() promise should resolve before abort() promise
PASS writer.ready should reject on controller error without waiting for underlying write
FAIL writer.abort() while there is an in-flight write, and then finish the write with rejection assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight write, and then finish the write assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight close, and then finish the close assert_throws: writer.ready must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS controller.error(), writer.abort() while there is an in-flight write, and then finish the write
PASS controller.error(), writer.abort() while there is an in-flight close, and then finish the close
PASS releaseLock() while aborting should reject the original closed promise
PASS releaseLock() during delayed async abort() should reject the writer.closed promise
PASS sink abort() should not be called until sink start() is done
PASS if start attempts to error the controller after abort() has been called, then it should lose
PASS stream abort() promise should still resolve if sink start() rejects
FAIL writer abort() during sink start() should replace the writer.ready promise synchronously assert_throws: writerReady2 should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL promises returned from other writer methods should be rejected when writer abort() happens during sink start() assert_throws: second write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() should succeed despite rejection from write
PASS abort() should be rejected with the rejection returned from close()
FAIL a rejecting sink.write() should not prevent sink.abort() from being called assert_throws: closed should reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS when start errors after stream abort(), underlying sink abort() should be called anyway
FAIL when calling abort() twice on the same stream, both should give the same promise that fulfills with undefined assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
FAIL when calling abort() twice on the same stream, but sequentially so so there's no pending abort the second time, both should fulfill with undefined promise_test: Unhandled rejection with value: object "TypeError: The stream is in the process of being aborted"
FAIL calling abort() on an errored stream should fulfill with undefined promise_test: Unhandled rejection with value: object "error1: error1"
PASS sink abort() should not be called if stream was erroring due to controller.error() before abort() was called
PASS sink abort() should not be called if stream was erroring due to bad strategy before abort() was called
FAIL abort with no arguments should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with an undefined argument should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with a string argument should set the stored error to that argument assert_equals: e should be 'string argument' expected (string) "string argument" but got (object) object "TypeError: The stream is in the process of being aborted"
Harness: the test ran to completion.
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = error1
PASS Service worker test setup
FAIL Aborting a WritableStream before it starts should cause the writer's unsettled ready promise to reject assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream should cause the writer's fulfilled ready promise to reset to a rejected one assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() on a released writer rejects
FAIL Aborting a WritableStream immediately prevents future writes assert_throws: write(1) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream prevents further writes after any that are in progress assert_throws: write(2) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value
PASS WritableStream if sink's abort throws, the promise returned by writer.abort() rejects
FAIL WritableStream if sink's abort throws, the promise returned by multiple writer.abort()s is the same and rejects assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
PASS WritableStream if sink's abort throws, the promise returned by ws.abort() rejects
PASS WritableStream if sink's abort throws, for an abort performed during a write, the promise returned by ws.abort() rejects
PASS Aborting a WritableStream passes through the given reason
FAIL Aborting a WritableStream puts it in an errored state with the error passed to abort() assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the reason supplied assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Closing but then immediately aborting a WritableStream causes the stream to error assert_throws: close() should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Closing a WritableStream and aborting it while it closes causes the stream to ignore the abort attempt
PASS Aborting a WritableStream after it is closed is a no-op
FAIL WritableStream should NOT call underlying sink's close if no abort is supplied (historical) assert_throws: closed should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS returning a thenable from abort() should work
FAIL .closed should not resolve before fulfilled write() assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL .closed should not resolve before rejected write(); write() error should not overwrite abort() error assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL writes should be satisfied in order when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writes should be satisfied in order after rejected write when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL close() should reject with abort reason why abort() is first error assert_throws: writer.close() should reject with error from underlying write() function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS underlying abort() should not be called until underlying write() completes
PASS underlying abort() should not be called if underlying close() has started
PASS if underlying close() has started and then rejects, the abort() and close() promises should reject with the underlying close rejection reason
FAIL an abort() that happens during a write() should trigger the underlying abort() even with a close() queued assert_throws: promise returned by close() should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL if a writer is created for a stream with a pending abort, its ready should be rejected with the abort error assert_throws: ready of the second writer should be rejected with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS writer close() promise should resolve before abort() promise
PASS writer.ready should reject on controller error without waiting for underlying write
FAIL writer.abort() while there is an in-flight write, and then finish the write with rejection assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight write, and then finish the write assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight close, and then finish the close assert_throws: writer.ready must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS controller.error(), writer.abort() while there is an in-flight write, and then finish the write
PASS controller.error(), writer.abort() while there is an in-flight close, and then finish the close
PASS releaseLock() while aborting should reject the original closed promise
PASS releaseLock() during delayed async abort() should reject the writer.closed promise
PASS sink abort() should not be called until sink start() is done
PASS if start attempts to error the controller after abort() has been called, then it should lose
PASS stream abort() promise should still resolve if sink start() rejects
FAIL writer abort() during sink start() should replace the writer.ready promise synchronously assert_throws: writerReady2 should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL promises returned from other writer methods should be rejected when writer abort() happens during sink start() assert_throws: second write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() should succeed despite rejection from write
PASS abort() should be rejected with the rejection returned from close()
FAIL a rejecting sink.write() should not prevent sink.abort() from being called assert_throws: closed should reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS when start errors after stream abort(), underlying sink abort() should be called anyway
FAIL when calling abort() twice on the same stream, both should give the same promise that fulfills with undefined assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
FAIL when calling abort() twice on the same stream, but sequentially so so there's no pending abort the second time, both should fulfill with undefined promise_test: Unhandled rejection with value: object "TypeError: The stream is in the process of being aborted"
FAIL calling abort() on an errored stream should fulfill with undefined promise_test: Unhandled rejection with value: object "error1: error1"
PASS sink abort() should not be called if stream was erroring due to controller.error() before abort() was called
PASS sink abort() should not be called if stream was erroring due to bad strategy before abort() was called
FAIL abort with no arguments should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with an undefined argument should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with a string argument should set the stored error to that argument assert_equals: e should be 'string argument' expected (string) "string argument" but got (object) object "TypeError: The stream is in the process of being aborted"
Harness: the test ran to completion.
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = error1
Found 54 tests; 26 PASS, 28 FAIL, 0 TIMEOUT, 0 NOTRUN.
FAIL Aborting a WritableStream before it starts should cause the writer's unsettled ready promise to reject assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream should cause the writer's fulfilled ready promise to reset to a rejected one assert_throws: the ready promise should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() on a released writer rejects
FAIL Aborting a WritableStream immediately prevents future writes assert_throws: write(1) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream prevents further writes after any that are in progress assert_throws: write(2) must reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Fulfillment value of ws.abort() call must be undefined even if the underlying sink returns a non-undefined value
PASS WritableStream if sink's abort throws, the promise returned by writer.abort() rejects
FAIL WritableStream if sink's abort throws, the promise returned by multiple writer.abort()s is the same and rejects assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
PASS WritableStream if sink's abort throws, the promise returned by ws.abort() rejects
PASS WritableStream if sink's abort throws, for an abort performed during a write, the promise returned by ws.abort() rejects
PASS Aborting a WritableStream passes through the given reason
FAIL Aborting a WritableStream puts it in an errored state with the error passed to abort() assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Aborting a WritableStream causes any outstanding write() promises to be rejected with the reason supplied assert_throws: writing should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL Closing but then immediately aborting a WritableStream causes the stream to error assert_throws: close() should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS Closing a WritableStream and aborting it while it closes causes the stream to ignore the abort attempt
PASS Aborting a WritableStream after it is closed is a no-op
FAIL WritableStream should NOT call underlying sink's close if no abort is supplied (historical) assert_throws: closed should reject with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS returning a thenable from abort() should work
FAIL .closed should not resolve before fulfilled write() assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL .closed should not resolve before rejected write(); write() error should not overwrite abort() error assert_throws: .closed should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL writes should be satisfied in order when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writes should be satisfied in order after rejected write when aborting assert_throws: first queued write should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
FAIL close() should reject with abort reason why abort() is first error assert_throws: writer.close() should reject with error from underlying write() function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS underlying abort() should not be called until underlying write() completes
PASS underlying abort() should not be called if underlying close() has started
PASS if underlying close() has started and then rejects, the abort() and close() promises should reject with the underlying close rejection reason
FAIL an abort() that happens during a write() should trigger the underlying abort() even with a close() queued assert_throws: promise returned by close() should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL if a writer is created for a stream with a pending abort, its ready should be rejected with the abort error assert_throws: ready of the second writer should be rejected with error1 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS writer close() promise should resolve before abort() promise
PASS writer.ready should reject on controller error without waiting for underlying write
FAIL writer.abort() while there is an in-flight write, and then finish the write with rejection assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight write, and then finish the write assert_throws: writePromise2 must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL writer.abort(), controller.error() while there is an in-flight close, and then finish the close assert_throws: writer.ready must reject with the error from abort function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS controller.error(), writer.abort() while there is an in-flight write, and then finish the write
PASS controller.error(), writer.abort() while there is an in-flight close, and then finish the close
PASS releaseLock() while aborting should reject the original closed promise
PASS releaseLock() during delayed async abort() should reject the writer.closed promise
PASS sink abort() should not be called until sink start() is done
PASS if start attempts to error the controller after abort() has been called, then it should lose
PASS stream abort() promise should still resolve if sink start() rejects
FAIL writer abort() during sink start() should replace the writer.ready promise synchronously assert_throws: writerReady2 should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
FAIL promises returned from other writer methods should be rejected when writer abort() happens during sink start() assert_throws: second write() should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error1: error1" ("error1")
PASS abort() should succeed despite rejection from write
PASS abort() should be rejected with the rejection returned from close()
FAIL a rejecting sink.write() should not prevent sink.abort() from being called assert_throws: closed should reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS when start errors after stream abort(), underlying sink abort() should be called anyway
FAIL when calling abort() twice on the same stream, both should give the same promise that fulfills with undefined assert_equals: the promises must be the same expected object "[object Promise]" but got object "[object Promise]"
FAIL when calling abort() twice on the same stream, but sequentially so so there's no pending abort the second time, both should fulfill with undefined promise_test: Unhandled rejection with value: object "TypeError: The stream is in the process of being aborted"
FAIL calling abort() on an errored stream should fulfill with undefined promise_test: Unhandled rejection with value: object "error1: error1"
PASS sink abort() should not be called if stream was erroring due to controller.error() before abort() was called
PASS sink abort() should not be called if stream was erroring due to bad strategy before abort() was called
FAIL abort with no arguments should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with an undefined argument should set the stored error to undefined assert_equals: e should be undefined expected (undefined) undefined but got (object) object "TypeError: The stream is in the process of being aborted"
FAIL abort with a string argument should set the stored error to that argument assert_equals: e should be 'string argument' expected (string) "string argument" but got (object) object "TypeError: The stream is in the process of being aborted"
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS start: errors in start cause WritableStream constructor to throw
PASS close: throwing method should cause writer close() and ready to reject
PASS close: returning a rejected promise should cause writer close() and ready to reject
FAIL close: throwing getter should cause constructor to throw assert_throws: constructor should throw function "() => new WritableStream({
get close() {
throw error1;
}
})" did not throw
FAIL write: throwing getter should cause write() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get write() {
throw error1;
}
})" did not throw
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
FAIL abort: non-function abort method with .apply assert_throws: constructor should throw function "() => new WritableStream({
abort: { apply() {} }
})" did not throw
FAIL abort: throwing getter should cause abort() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get abort() {
throw error1;
}
})" did not throw
FAIL abort: throwing method should cause abort() and closed to reject assert_throws: closed should reject with abortReason function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "Error: different string" ("Error")
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS start: errors in start cause WritableStream constructor to throw
PASS close: throwing method should cause writer close() and ready to reject
PASS close: returning a rejected promise should cause writer close() and ready to reject
FAIL close: throwing getter should cause constructor to throw assert_throws: constructor should throw function "() => new WritableStream({
get close() {
throw error1;
}
})" did not throw
FAIL write: throwing getter should cause write() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get write() {
throw error1;
}
})" did not throw
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
FAIL abort: non-function abort method with .apply assert_throws: constructor should throw function "() => new WritableStream({
abort: { apply() {} }
})" did not throw
FAIL abort: throwing getter should cause abort() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get abort() {
throw error1;
}
})" did not throw
FAIL abort: throwing method should cause abort() and closed to reject assert_throws: closed should reject with abortReason function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "Error: different string" ("Error")
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS start: errors in start cause WritableStream constructor to throw
PASS close: throwing method should cause writer close() and ready to reject
PASS close: returning a rejected promise should cause writer close() and ready to reject
FAIL close: throwing getter should cause constructor to throw assert_throws: constructor should throw function "() => new WritableStream({
get close() {
throw error1;
}
})" did not throw
FAIL write: throwing getter should cause write() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get write() {
throw error1;
}
})" did not throw
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
FAIL abort: non-function abort method with .apply assert_throws: constructor should throw function "() => new WritableStream({
abort: { apply() {} }
})" did not throw
FAIL abort: throwing getter should cause abort() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get abort() {
throw error1;
}
})" did not throw
FAIL abort: throwing method should cause abort() and closed to reject assert_throws: closed should reject with abortReason function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "Error: different string" ("Error")
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS start: errors in start cause WritableStream constructor to throw
PASS close: throwing method should cause writer close() and ready to reject
PASS close: returning a rejected promise should cause writer close() and ready to reject
FAIL close: throwing getter should cause constructor to throw assert_throws: constructor should throw function "() => new WritableStream({
get close() {
throw error1;
}
})" did not throw
FAIL write: throwing getter should cause write() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get write() {
throw error1;
}
})" did not throw
PASS write: throwing method should cause write() and closed to reject
PASS write: returning a promise that becomes rejected after the writer write() should cause writer write() and ready to reject
PASS write: returning a rejected promise (second write) should cause writer write() and ready to reject
FAIL abort: non-function abort method with .apply assert_throws: constructor should throw function "() => new WritableStream({
abort: { apply() {} }
})" did not throw
FAIL abort: throwing getter should cause abort() and closed to reject assert_throws: constructor should throw function "() => new WritableStream({
get abort() {
throw error1;
}
})" did not throw
FAIL abort: throwing method should cause abort() and closed to reject assert_throws: closed should reject with abortReason function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "Error: different string" ("Error")
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value
PASS when sink calls error asynchronously while sink close is in-flight, the stream should not become errored
PASS when sink calls error synchronously while closing, the stream should not become errored
PASS when the sink throws during close, and the close is requested while a write is still in-flight, the stream should become errored during the close
PASS releaseLock on a stream with a pending write in which the stream has been errored
PASS releaseLock on a stream with a pending close in which controller.error() was called
PASS when close is called on a WritableStream in writable state, ready should return a fulfilled promise
PASS when close is called on a WritableStream in waiting state, ready promise should be fulfilled
PASS when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time
PASS returning a thenable from close() should work
PASS releaseLock() should not change the result of sync close()
PASS releaseLock() should not change the result of async close()
PASS close() should set state to CLOSED even if writer has detached
PASS the promise returned by async abort during close should resolve
PASS promises must fulfill/reject in the expected order on closure
PASS promises must fulfill/reject in the expected order on aborted closure
FAIL promises must fulfill/reject in the expected order on aborted and errored closure assert_throws: writer.closed must reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS close() should not reject until no sink methods are in flight
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value
PASS when sink calls error asynchronously while sink close is in-flight, the stream should not become errored
PASS when sink calls error synchronously while closing, the stream should not become errored
PASS when the sink throws during close, and the close is requested while a write is still in-flight, the stream should become errored during the close
PASS releaseLock on a stream with a pending write in which the stream has been errored
PASS releaseLock on a stream with a pending close in which controller.error() was called
PASS when close is called on a WritableStream in writable state, ready should return a fulfilled promise
PASS when close is called on a WritableStream in waiting state, ready promise should be fulfilled
PASS when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time
PASS returning a thenable from close() should work
PASS releaseLock() should not change the result of sync close()
PASS releaseLock() should not change the result of async close()
PASS close() should set state to CLOSED even if writer has detached
PASS the promise returned by async abort during close should resolve
PASS promises must fulfill/reject in the expected order on closure
PASS promises must fulfill/reject in the expected order on aborted closure
FAIL promises must fulfill/reject in the expected order on aborted and errored closure assert_throws: writer.closed must reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS close() should not reject until no sink methods are in flight
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value
PASS when sink calls error asynchronously while sink close is in-flight, the stream should not become errored
PASS when sink calls error synchronously while closing, the stream should not become errored
PASS when the sink throws during close, and the close is requested while a write is still in-flight, the stream should become errored during the close
PASS releaseLock on a stream with a pending write in which the stream has been errored
PASS releaseLock on a stream with a pending close in which controller.error() was called
PASS when close is called on a WritableStream in writable state, ready should return a fulfilled promise
PASS when close is called on a WritableStream in waiting state, ready promise should be fulfilled
PASS when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time
PASS returning a thenable from close() should work
PASS releaseLock() should not change the result of sync close()
PASS releaseLock() should not change the result of async close()
PASS close() should set state to CLOSED even if writer has detached
PASS the promise returned by async abort during close should resolve
PASS promises must fulfill/reject in the expected order on closure
PASS promises must fulfill/reject in the expected order on aborted closure
FAIL promises must fulfill/reject in the expected order on aborted and errored closure assert_throws: writer.closed must reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS close() should not reject until no sink methods are in flight
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS fulfillment value of ws.close() call must be undefined even if the underlying sink returns a non-undefined value
PASS when sink calls error asynchronously while sink close is in-flight, the stream should not become errored
PASS when sink calls error synchronously while closing, the stream should not become errored
PASS when the sink throws during close, and the close is requested while a write is still in-flight, the stream should become errored during the close
PASS releaseLock on a stream with a pending write in which the stream has been errored
PASS releaseLock on a stream with a pending close in which controller.error() was called
PASS when close is called on a WritableStream in writable state, ready should return a fulfilled promise
PASS when close is called on a WritableStream in waiting state, ready promise should be fulfilled
PASS when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time
PASS returning a thenable from close() should work
PASS releaseLock() should not change the result of sync close()
PASS releaseLock() should not change the result of async close()
PASS close() should set state to CLOSED even if writer has detached
PASS the promise returned by async abort during close should resolve
PASS promises must fulfill/reject in the expected order on closure
PASS promises must fulfill/reject in the expected order on aborted closure
FAIL promises must fulfill/reject in the expected order on aborted and errored closure assert_throws: writer.closed must reject with error2 function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "error2: error2" ("error2")
PASS close() should not reject until no sink methods are in flight
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS desiredSize on a released writer
PASS desiredSize initial value
PASS desiredSize on a writer for a closed stream
PASS desiredSize on a writer for an errored stream
PASS ws.getWriter() on a closing WritableStream
PASS ws.getWriter() on a closed WritableStream
PASS ws.getWriter() on an aborted WritableStream
PASS ws.getWriter() on an errored WritableStream
PASS closed and ready on a released writer
PASS WritableStream should call underlying sink methods as methods
FAIL methods should not not have .apply() or .call() called assert_throws: writer2.closed should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "abort error" ("abort error")
PASS WritableStream's strategy.size should not be called as a method
PASS redundant releaseLock() is no-op
PASS ready promise should fire before closed on releaseLock
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS desiredSize on a released writer
PASS desiredSize initial value
PASS desiredSize on a writer for a closed stream
PASS desiredSize on a writer for an errored stream
PASS ws.getWriter() on a closing WritableStream
PASS ws.getWriter() on a closed WritableStream
PASS ws.getWriter() on an aborted WritableStream
PASS ws.getWriter() on an errored WritableStream
PASS closed and ready on a released writer
PASS WritableStream should call underlying sink methods as methods
FAIL methods should not not have .apply() or .call() called assert_throws: writer2.closed should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "abort error" ("abort error")
PASS WritableStream's strategy.size should not be called as a method
PASS redundant releaseLock() is no-op
PASS ready promise should fire before closed on releaseLock
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS desiredSize on a released writer
PASS desiredSize initial value
PASS desiredSize on a writer for a closed stream
PASS desiredSize on a writer for an errored stream
PASS ws.getWriter() on a closing WritableStream
PASS ws.getWriter() on a closed WritableStream
PASS ws.getWriter() on an aborted WritableStream
PASS ws.getWriter() on an errored WritableStream
PASS closed and ready on a released writer
PASS WritableStream should call underlying sink methods as methods
FAIL methods should not not have .apply() or .call() called assert_throws: writer2.closed should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "abort error" ("abort error")
PASS WritableStream's strategy.size should not be called as a method
PASS redundant releaseLock() is no-op
PASS ready promise should fire before closed on releaseLock
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS desiredSize on a released writer
PASS desiredSize initial value
PASS desiredSize on a writer for a closed stream
PASS desiredSize on a writer for an errored stream
PASS ws.getWriter() on a closing WritableStream
PASS ws.getWriter() on a closed WritableStream
PASS ws.getWriter() on an aborted WritableStream
PASS ws.getWriter() on an errored WritableStream
PASS closed and ready on a released writer
PASS WritableStream should call underlying sink methods as methods
FAIL methods should not not have .apply() or .call() called assert_throws: writer2.closed should be rejected function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "abort error" ("abort error")
PASS WritableStream's strategy.size should not be called as a method
PASS redundant releaseLock() is no-op
PASS ready promise should fire before closed on releaseLock
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS WritableStreamDefaultController should not be exported on the global object
PASS WritableStreamDefaultWriter should not be exported on the global object
PASS WritableStream.prototype.constructor should have standard properties
PASS WritableStream.prototype.constructor should be a constructor
PASS WritableStream.prototype.locked should have standard properties
PASS WritableStream.prototype.locked should be a getter
PASS WritableStream.prototype.abort should have standard properties
PASS WritableStream.prototype.abort should be a method
PASS WritableStream.prototype.getWriter should have standard properties
PASS WritableStream.prototype.getWriter should be a method
PASS WritableStream.prototype should have exactly the expected properties
PASS WritableStreamDefaultController.prototype.constructor should have standard properties
FAIL WritableStreamDefaultController.prototype.constructor should be a constructor assert_equals: constructor should take 0 arguments expected 0 but got 4
PASS WritableStreamDefaultController.prototype.error should have standard properties
PASS WritableStreamDefaultController.prototype.error should be a method
PASS WritableStreamDefaultController.prototype should have exactly the expected properties
PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties
PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor
PASS WritableStreamDefaultWriter.prototype.closed should have standard properties
PASS WritableStreamDefaultWriter.prototype.closed should be a getter
PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties
PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter
PASS WritableStreamDefaultWriter.prototype.ready should have standard properties
PASS WritableStreamDefaultWriter.prototype.ready should be a getter
PASS WritableStreamDefaultWriter.prototype.abort should have standard properties
PASS WritableStreamDefaultWriter.prototype.abort should be a method
PASS WritableStreamDefaultWriter.prototype.close should have standard properties
PASS WritableStreamDefaultWriter.prototype.close should be a method
PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties
PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method
PASS WritableStreamDefaultWriter.prototype.write should have standard properties
PASS WritableStreamDefaultWriter.prototype.write should be a method
PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties
PASS sink method start should be called with the right number of arguments
PASS sink method start should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method start assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method write should be called with the right number of arguments
PASS sink method write should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method write assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method close should be called with the right number of arguments
PASS sink method close should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method close assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method abort should be called with the right number of arguments
PASS sink method abort should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method abort assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS WritableStreamDefaultController should not be exported on the global object
PASS WritableStreamDefaultWriter should not be exported on the global object
PASS WritableStream.prototype.constructor should have standard properties
PASS WritableStream.prototype.constructor should be a constructor
PASS WritableStream.prototype.locked should have standard properties
PASS WritableStream.prototype.locked should be a getter
PASS WritableStream.prototype.abort should have standard properties
PASS WritableStream.prototype.abort should be a method
PASS WritableStream.prototype.getWriter should have standard properties
PASS WritableStream.prototype.getWriter should be a method
PASS WritableStream.prototype should have exactly the expected properties
PASS WritableStreamDefaultController.prototype.constructor should have standard properties
FAIL WritableStreamDefaultController.prototype.constructor should be a constructor assert_equals: constructor should take 0 arguments expected 0 but got 4
PASS WritableStreamDefaultController.prototype.error should have standard properties
PASS WritableStreamDefaultController.prototype.error should be a method
PASS WritableStreamDefaultController.prototype should have exactly the expected properties
PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties
PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor
PASS WritableStreamDefaultWriter.prototype.closed should have standard properties
PASS WritableStreamDefaultWriter.prototype.closed should be a getter
PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties
PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter
PASS WritableStreamDefaultWriter.prototype.ready should have standard properties
PASS WritableStreamDefaultWriter.prototype.ready should be a getter
PASS WritableStreamDefaultWriter.prototype.abort should have standard properties
PASS WritableStreamDefaultWriter.prototype.abort should be a method
PASS WritableStreamDefaultWriter.prototype.close should have standard properties
PASS WritableStreamDefaultWriter.prototype.close should be a method
PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties
PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method
PASS WritableStreamDefaultWriter.prototype.write should have standard properties
PASS WritableStreamDefaultWriter.prototype.write should be a method
PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties
PASS sink method start should be called with the right number of arguments
PASS sink method start should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method start assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method write should be called with the right number of arguments
PASS sink method write should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method write assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method close should be called with the right number of arguments
PASS sink method close should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method close assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method abort should be called with the right number of arguments
PASS sink method abort should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method abort assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS WritableStreamDefaultController should not be exported on the global object
PASS WritableStreamDefaultWriter should not be exported on the global object
PASS WritableStream.prototype.constructor should have standard properties
PASS WritableStream.prototype.constructor should be a constructor
PASS WritableStream.prototype.locked should have standard properties
PASS WritableStream.prototype.locked should be a getter
PASS WritableStream.prototype.abort should have standard properties
PASS WritableStream.prototype.abort should be a method
PASS WritableStream.prototype.getWriter should have standard properties
PASS WritableStream.prototype.getWriter should be a method
PASS WritableStream.prototype should have exactly the expected properties
PASS WritableStreamDefaultController.prototype.constructor should have standard properties
FAIL WritableStreamDefaultController.prototype.constructor should be a constructor assert_equals: constructor should take 0 arguments expected 0 but got 4
PASS WritableStreamDefaultController.prototype.error should have standard properties
PASS WritableStreamDefaultController.prototype.error should be a method
PASS WritableStreamDefaultController.prototype should have exactly the expected properties
PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties
PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor
PASS WritableStreamDefaultWriter.prototype.closed should have standard properties
PASS WritableStreamDefaultWriter.prototype.closed should be a getter
PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties
PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter
PASS WritableStreamDefaultWriter.prototype.ready should have standard properties
PASS WritableStreamDefaultWriter.prototype.ready should be a getter
PASS WritableStreamDefaultWriter.prototype.abort should have standard properties
PASS WritableStreamDefaultWriter.prototype.abort should be a method
PASS WritableStreamDefaultWriter.prototype.close should have standard properties
PASS WritableStreamDefaultWriter.prototype.close should be a method
PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties
PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method
PASS WritableStreamDefaultWriter.prototype.write should have standard properties
PASS WritableStreamDefaultWriter.prototype.write should be a method
PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties
PASS sink method start should be called with the right number of arguments
PASS sink method start should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method start assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method write should be called with the right number of arguments
PASS sink method write should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method write assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method close should be called with the right number of arguments
PASS sink method close should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method close assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method abort should be called with the right number of arguments
PASS sink method abort should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method abort assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS WritableStreamDefaultController should not be exported on the global object
PASS WritableStreamDefaultWriter should not be exported on the global object
PASS WritableStream.prototype.constructor should have standard properties
PASS WritableStream.prototype.constructor should be a constructor
PASS WritableStream.prototype.locked should have standard properties
PASS WritableStream.prototype.locked should be a getter
PASS WritableStream.prototype.abort should have standard properties
PASS WritableStream.prototype.abort should be a method
PASS WritableStream.prototype.getWriter should have standard properties
PASS WritableStream.prototype.getWriter should be a method
PASS WritableStream.prototype should have exactly the expected properties
PASS WritableStreamDefaultController.prototype.constructor should have standard properties
FAIL WritableStreamDefaultController.prototype.constructor should be a constructor assert_equals: constructor should take 0 arguments expected 0 but got 4
PASS WritableStreamDefaultController.prototype.error should have standard properties
PASS WritableStreamDefaultController.prototype.error should be a method
PASS WritableStreamDefaultController.prototype should have exactly the expected properties
PASS WritableStreamDefaultWriter.prototype.constructor should have standard properties
PASS WritableStreamDefaultWriter.prototype.constructor should be a constructor
PASS WritableStreamDefaultWriter.prototype.closed should have standard properties
PASS WritableStreamDefaultWriter.prototype.closed should be a getter
PASS WritableStreamDefaultWriter.prototype.desiredSize should have standard properties
PASS WritableStreamDefaultWriter.prototype.desiredSize should be a getter
PASS WritableStreamDefaultWriter.prototype.ready should have standard properties
PASS WritableStreamDefaultWriter.prototype.ready should be a getter
PASS WritableStreamDefaultWriter.prototype.abort should have standard properties
PASS WritableStreamDefaultWriter.prototype.abort should be a method
PASS WritableStreamDefaultWriter.prototype.close should have standard properties
PASS WritableStreamDefaultWriter.prototype.close should be a method
PASS WritableStreamDefaultWriter.prototype.releaseLock should have standard properties
PASS WritableStreamDefaultWriter.prototype.releaseLock should be a method
PASS WritableStreamDefaultWriter.prototype.write should have standard properties
PASS WritableStreamDefaultWriter.prototype.write should be a method
PASS WritableStreamDefaultWriter.prototype should have exactly the expected properties
PASS sink method start should be called with the right number of arguments
PASS sink method start should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method start assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method write should be called with the right number of arguments
PASS sink method write should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method write assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method close should be called with the right number of arguments
PASS sink method close should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method close assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
PASS sink method abort should be called with the right number of arguments
PASS sink method abort should be called even when it's located on the prototype chain
FAIL unexpected properties should not be accessed when calling sink method abort assert_array_equals: expected properties should be got lengths differ, expected 5 got 2
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS writes should be written in the standard order
PASS writer.write() promises should resolve in the standard order
PASS controller.error() should work when called from within strategy.size()
PASS close() should work when called from within strategy.size()
FAIL abort() should work when called from within strategy.size() assert_throws: write() promise should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "[object Object]" ("error1")
PASS releaseLock() should abort the write() when called within strategy.size()
PASS original reader should error when new reader is created within strategy.size()
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS writes should be written in the standard order
PASS writer.write() promises should resolve in the standard order
PASS controller.error() should work when called from within strategy.size()
PASS close() should work when called from within strategy.size()
FAIL abort() should work when called from within strategy.size() assert_throws: write() promise should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "[object Object]" ("error1")
PASS releaseLock() should abort the write() when called within strategy.size()
PASS original reader should error when new reader is created within strategy.size()
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Service worker test setup
PASS writes should be written in the standard order
PASS writer.write() promises should resolve in the standard order
PASS controller.error() should work when called from within strategy.size()
PASS close() should work when called from within strategy.size()
FAIL abort() should work when called from within strategy.size() assert_throws: write() promise should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "[object Object]" ("error1")
PASS releaseLock() should abort the write() when called within strategy.size()
PASS original reader should error when new reader is created within strategy.size()
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS writes should be written in the standard order
PASS writer.write() promises should resolve in the standard order
PASS controller.error() should work when called from within strategy.size()
PASS close() should work when called from within strategy.size()
FAIL abort() should work when called from within strategy.size() assert_throws: write() promise should reject function "function() { throw e }" threw object "TypeError: The stream is in the process of being aborted" ("TypeError") expected object "[object Object]" ("error1")
PASS releaseLock() should abort the write() when called within strategy.size()
PASS original reader should error when new reader is created within strategy.size()
Harness: the test ran to completion.
......@@ -10,9 +10,9 @@ promise_test(t => {
const rejections = [];
for (let i = 0; i < QUEUE_MAX_ARRAY_SIZE; ++i) {
rejections.push(
promise_rejects(t, new TypeError(), writer.write(i),
promise_rejects(t, new Error(), writer.write(i),
'write() promise should reject'));
}
return writer.abort().then(() => Promise.all(rejections));
return writer.abort(new Error()).then(() => Promise.all(rejections));
}, 'rejecting exactly 16K writes should work');
</script>
......@@ -12,9 +12,9 @@ promise_test(t => {
const rejections = [];
for (let i = 0; i < NUMBER_OF_WRITES; ++i) {
rejections.push(
promise_rejects(t, new TypeError(), writer.write(i),
promise_rejects(t, new Error(), writer.write(i),
'write() promise should reject'));
}
return writer.abort().then(() => Promise.all(rejections));
return writer.abort(new Error()).then(() => Promise.all(rejections));
}, 'rejecting more than 16K writes should work');
</script>
......@@ -144,11 +144,7 @@
return Number_isFinite(v) && v >= 0;
}
function ValidateAndNormalizeQueuingStrategy(size, highWaterMark) {
if (size !== undefined && typeof size !== 'function') {
throw new TypeError(binding.streamErrors.sizeNotAFunction);
}
function ValidateAndNormalizeHighWaterMark(highWaterMark) {
highWaterMark = Number(highWaterMark);
if (Number_isNaN(highWaterMark)) {
throw new RangeError(binding.streamErrors.invalidHWM);
......@@ -156,10 +152,37 @@
if (highWaterMark < 0) {
throw new RangeError(binding.streamErrors.invalidHWM);
}
return highWaterMark;
}
// TODO(ricea): Remove this once all its callers have been updated to use
// ValidateAndNormalizeHighWaterMark instead.
function ValidateAndNormalizeQueuingStrategy(size, highWaterMark) {
if (size !== undefined && typeof size !== 'function') {
throw new TypeError(binding.streamErrors.sizeNotAFunction);
}
highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
return {size, highWaterMark};
}
// Unlike the version in the standard, this implementation returns the
// original function as-is if it is set. This means users of the return value
// need to be careful to explicitly set |this| when calling it.
function MakeSizeAlgorithmFromSizeFunction(size) {
if (size === undefined) {
return () => 1;
}
if (typeof size !== 'function') {
throw new TypeError(binding.streamErrors.sizeNotAFunction);
}
return size;
}
//
// Invoking functions.
// These differ from the Invoke versions in the spec in that they take a fixed
......@@ -173,6 +196,7 @@
`${name} must be a function or undefined`;
const Promise_resolve = Promise.resolve.bind(Promise);
const Promise_reject = Promise.reject.bind(Promise);
const Function_bind = v8.uncurryThis(global.Function.prototype.bind);
function resolveMethod(O, P, nameForError) {
const method = O[P];
......@@ -184,6 +208,58 @@
return method;
}
function CreateAlgorithmFromUnderlyingMethod(
underlyingObject, methodName, algoArgCount, methodNameForError) {
// assert(underlyingObject !== undefined,
// 'underlyingObject is not undefined.');
// assert(IsPropertyKey(methodName),
// '! IsPropertyKey(methodName) is true.');
// assert(algoArgCount === 0 || algoArgCount === 1,
// 'algoArgCount is 0 or 1.');
// assert(typeof methodNameForError === 'string',
// 'methodNameForError is a string');
const method = resolveMethod(underlyingObject, methodName,
methodNameForError);
// The implementation uses bound functions rather than lambdas where
// possible to give the compiler the maximum opportunity to optimise.
if (method === undefined) {
return () => Promise_resolve();
}
if (algoArgCount === 0) {
return Function_bind(PromiseCall0, undefined, method, underlyingObject);
}
return Function_bind(PromiseCall1, undefined, method, underlyingObject);
}
function CreateAlgorithmFromUnderlyingMethodPassingController(
underlyingObject, methodName, algoArgCount, controller,
methodNameForError) {
// assert(underlyingObject !== undefined,
// 'underlyingObject is not undefined.');
// assert(IsPropertyKey(methodName),
// '! IsPropertyKey(methodName) is true.');
// assert(algoArgCount === 0 || algoArgCount === 1,
// 'algoArgCount is 0 or 1.');
// assert(typeof controller === 'object'
// 'controller is an object');
// assert(typeof methodNameForError === 'string',
// 'methodNameForError is a string');
const method = resolveMethod(underlyingObject, methodName,
methodNameForError);
if (method === undefined) {
return () => Promise_resolve();
}
if (algoArgCount === 0) {
return Function_bind(PromiseCall1, undefined, method, underlyingObject,
controller);
}
return arg => PromiseCall2(method, underlyingObject, arg, controller);
}
// Modified from InvokeOrNoop in spec. Takes 1 argument.
function CallOrNoop1(O, P, arg0, nameForError) {
const method = resolveMethod(O, P, nameForError);
......@@ -194,38 +270,46 @@
return callFunction(method, O, arg0);
}
// Modified from PromiseInvokeOrNoop in spec. Version with no arguments.
function PromiseCallOrNoop0(O, P, nameForError) {
// Modified from PromiseInvokeOrNoop in spec. Takes 1 argument.
function PromiseCallOrNoop1(O, P, arg0, nameForError) {
try {
const method = resolveMethod(O, P, nameForError);
if (method === undefined) {
return Promise_resolve();
}
return Promise_resolve(callFunction(method, O));
return Promise_resolve(CallOrNoop1(O, P, arg0, nameForError));
} catch (e) {
return Promise_reject(e);
}
}
// Modified from PromiseInvokeOrNoop in spec. Version with 1 argument.
function PromiseCallOrNoop1(O, P, arg0, nameForError) {
function PromiseCall0(F, V) {
// assert(typeof F === 'function',
// 'IsCallable(F) is true.');
// assert(V !== undefined,
// 'V is not undefined.');
try {
return Promise_resolve(CallOrNoop1(O, P, arg0, nameForError));
return Promise_resolve(callFunction(F, V));
} catch (e) {
return Promise_reject(e);
}
}
// Modified from PromiseInvokeOrNoop in spec. Version with 2 arguments.
function PromiseCallOrNoop2(O, P, arg0, arg1, nameForError) {
function PromiseCall1(F, V, arg0) {
// assert(typeof F === 'function',
// 'IsCallable(F) is true.');
// assert(V !== undefined,
// 'V is not undefined.');
try {
const method = resolveMethod(O, P, nameForError);
if (method === undefined) {
return Promise_resolve();
}
return Promise_resolve(callFunction(F, V, arg0));
} catch (e) {
return Promise_reject(e);
}
}
return Promise_resolve(callFunction(method, O, arg0, arg1));
function PromiseCall2(F, V, arg0, arg1) {
// assert(typeof F === 'function',
// 'IsCallable(F) is true.');
// assert(V !== undefined,
// 'V is not undefined.');
try {
return Promise_resolve(callFunction(F, V, arg0, arg1));
} catch (e) {
return Promise_reject(e);
}
......@@ -239,14 +323,16 @@
resolvePromise,
markPromiseAsHandled,
promiseState,
CreateAlgorithmFromUnderlyingMethod,
CreateAlgorithmFromUnderlyingMethodPassingController,
DequeueValue,
EnqueueValueWithSize,
PeekQueueValue,
ResetQueue,
ValidateAndNormalizeHighWaterMark,
ValidateAndNormalizeQueuingStrategy,
MakeSizeAlgorithmFromSizeFunction,
CallOrNoop1,
PromiseCallOrNoop0,
PromiseCallOrNoop1,
PromiseCallOrNoop2
};
});
......@@ -16,6 +16,8 @@
// TODO(ricea): Optimise [[closeRequest]] and [[inFlightCloseRequest]] into a
// single slot + a flag to say which one is set at the moment.
const _abortAlgorithm = v8.createPrivateSymbol('[[abortAlgorithm]]');
const _closeAlgorithm = v8.createPrivateSymbol('[[closeAlgorithm]]');
const _closeRequest = v8.createPrivateSymbol('[[closeRequest]]');
const _inFlightWriteRequest =
v8.createPrivateSymbol('[[inFlightWriteRequest]]');
......@@ -38,8 +40,9 @@
v8.createPrivateSymbol('[[controlledWritableStream]]');
const _started = v8.createPrivateSymbol('[[started]]');
const _strategyHWM = v8.createPrivateSymbol('[[strategyHWM]]');
const _strategySize = v8.createPrivateSymbol('[[strategySize]]');
const _underlyingSink = v8.createPrivateSymbol('[[underlyingSink]]');
const _strategySizeAlgorithm =
v8.createPrivateSymbol('[[strategySizeAlgorithm]]');
const _writeAlgorithm = v8.createPrivateSymbol('[[writeAlgorithm]]');
// Numeric encodings of stream states. Stored in the _stateAndFlags slot.
const WRITABLE = 0;
......@@ -58,6 +61,7 @@
// section "Security Considerations".
// https://docs.google.com/document/d/1AT5-T0aHGp7Lt29vPWFr2-qG8r3l9CByyvKwEuA8Ec0/edit#heading=h.9yixony1a18r
const defineProperty = global.Object.defineProperty;
const ObjectCreate = global.Object.create;
const Function_call = v8.uncurryThis(global.Function.prototype.call);
......@@ -80,22 +84,21 @@
resolvePromise,
markPromiseAsHandled,
promiseState,
CreateAlgorithmFromUnderlyingMethod,
CreateAlgorithmFromUnderlyingMethodPassingController,
DequeueValue,
EnqueueValueWithSize,
MakeSizeAlgorithmFromSizeFunction,
PeekQueueValue,
ResetQueue,
ValidateAndNormalizeQueuingStrategy,
ValidateAndNormalizeHighWaterMark,
CallOrNoop1,
PromiseCallOrNoop0,
PromiseCallOrNoop1,
PromiseCallOrNoop2
} = binding.streamOperations;
// User-visible strings.
const streamErrors = binding.streamErrors;
const errAbortLockedStream =
'Cannot abort a writable stream that is locked to a writer';
const errStreamAborting = 'The stream is in the process of being aborted';
const errWriterLockReleasedPrefix =
'This writable stream writer has been released and cannot be ';
const errCloseCloseRequestedStream = 'Cannot close a writable stream that ' +
......@@ -132,24 +135,21 @@
}
class WritableStream {
constructor(underlyingSink = {}, {size, highWaterMark = 1} = {}) {
this[_stateAndFlags] = WRITABLE;
this[_storedError] = undefined;
this[_writer] = undefined;
this[_writableStreamController] = undefined;
this[_inFlightWriteRequest] = undefined;
this[_closeRequest] = undefined;
this[_inFlightCloseRequest] = undefined;
this[_pendingAbortRequest] = undefined;
this[_writeRequests] = new binding.SimpleQueue();
constructor(underlyingSink = {}, strategy = {}) {
InitializeWritableStream(this);
const type = underlyingSink.type;
const size = strategy.size;
let highWaterMark = strategy.highWaterMark;
if (type !== undefined) {
throw new RangeError(streamErrors.invalidType);
}
this[_writableStreamController] = new WritableStreamDefaultController(
this, underlyingSink, size, highWaterMark);
WritableStreamDefaultControllerStartSteps(
this[_writableStreamController]);
const sizeAlgorithm = MakeSizeAlgorithmFromSizeFunction(size);
if (highWaterMark === undefined) {
highWaterMark = 1;
}
highWaterMark = ValidateAndNormalizeHighWaterMark(highWaterMark);
SetUpWritableStreamDefaultControllerFromUnderlyingSink(
this, underlyingSink, highWaterMark, sizeAlgorithm);
}
get locked() {
......@@ -177,12 +177,46 @@
}
}
const WritableStream_prototype = WritableStream.prototype;
// General Writable Stream Abstract Operations
function AcquireWritableStreamDefaultWriter(stream) {
return new WritableStreamDefaultWriter(stream);
}
function CreateWritableStream(
startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm,
highWaterMark, sizeAlgorithm) {
if (highWaterMark === undefined) {
highWaterMark = 1;
}
if (sizeAlgorithm === undefined) {
sizeAlgorithm = () => 1;
}
// assert(IsNonNegativeNumber(highWaterMark),
// '! IsNonNegativeNumber(_highWaterMark_) is *true*.')
const stream = ObjectCreate(WritableStream_prototype);
InitializeWritableStream(stream);
const controller = ObjectCreate(WritableStreamDefaultController_prototype);
SetUpWritableStreamDefaultController(
stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,
abortAlgorithm, highWaterMark, sizeAlgorithm);
return stream;
}
function InitializeWritableStream(stream) {
stream[_stateAndFlags] = WRITABLE;
stream[_storedError] = undefined;
stream[_writer] = undefined;
stream[_writableStreamController] = undefined;
stream[_inFlightWriteRequest] = undefined;
stream[_closeRequest] = undefined;
stream[_inFlightCloseRequest] = undefined;
stream[_pendingAbortRequest] = undefined;
stream[_writeRequests] = new binding.SimpleQueue();
}
function IsWritableStream(x) {
return hasOwnPropertyNoThrow(x, _writableStreamController);
}
......@@ -195,15 +229,11 @@
function WritableStreamAbort(stream, reason) {
const state = stream[_stateAndFlags] & STATE_MASK;
if (state === CLOSED) {
if (state === CLOSED || state === ERRORED) {
return Promise_resolve(undefined);
}
if (state === ERRORED) {
return Promise_reject(stream[_storedError]);
}
const error = new TypeError(errStreamAborting);
if (stream[_pendingAbortRequest] !== undefined) {
return Promise_reject(error);
return stream[_pendingAbortRequest].promise;
}
// assert(state === WRITABLE || state === ERRORING,
......@@ -218,7 +248,7 @@
stream[_pendingAbortRequest] = {promise, reason, wasAlreadyErroring};
if (!wasAlreadyErroring) {
WritableStreamStartErroring(stream, error);
WritableStreamStartErroring(stream, reason);
}
return promise;
}
......@@ -759,27 +789,8 @@
}
class WritableStreamDefaultController {
constructor(stream, underlyingSink, size, highWaterMark) {
if (!IsWritableStream(stream)) {
throw new TypeError(streamErrors.illegalConstructor);
}
if (stream[_writableStreamController] !== undefined) {
throw new TypeError(streamErrors.illegalConstructor);
}
this[_controlledWritableStream] = stream;
this[_underlyingSink] = underlyingSink;
// These are just initialised to avoid triggering the assert() in
// ResetQueue. They are overwritten by ResetQueue().
this[_queue] = undefined;
this[_queueTotalSize] = undefined;
ResetQueue(this);
this[_started] = false;
const normalizedStrategy =
ValidateAndNormalizeQueuingStrategy(size, highWaterMark);
this[_strategySize] = normalizedStrategy.size;
this[_strategyHWM] = normalizedStrategy.highWaterMark;
const backpressure = WritableStreamDefaultControllerGetBackpressure(this);
WritableStreamUpdateBackpressure(stream, backpressure);
constructor() {
throw new TypeError(streamErrors.illegalConstructor);
}
error(e) {
......@@ -795,24 +806,52 @@
}
}
const WritableStreamDefaultController_prototype =
WritableStreamDefaultController.prototype;
// Writable Stream Default Controller Internal Methods
// TODO(ricea): Virtual dispatch via V8 Private Symbols seems to be difficult
// or impossible, so use static dispatch for now. This will have to be fixed
// when adding a byte controller.
function WritableStreamDefaultControllerAbortSteps(controller, reason) {
return PromiseCallOrNoop1(controller[_underlyingSink], 'abort', reason,
'underlyingSink.abort');
return controller[_abortAlgorithm](reason);
}
function WritableStreamDefaultControllerErrorSteps(controller) {
ResetQueue(controller);
}
function WritableStreamDefaultControllerStartSteps(controller) {
const startResult = CallOrNoop1(controller[_underlyingSink], 'start',
controller, 'underlyingSink.start');
const stream = controller[_controlledWritableStream];
// Writable Stream Default Controller Abstract Operations
function IsWritableStreamDefaultController(x) {
return hasOwnPropertyNoThrow(x, _controlledWritableStream);
}
function SetUpWritableStreamDefaultController(
stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm,
abortAlgorithm, highWaterMark, sizeAlgorithm) {
// assert(IsWritableStream(stream), '! IsWritableStream(_stream_) is
// *true*.');
// assert(stream[_writableStreamController] === undefined,
// '_stream_.[[writableStreamController]] is *undefined*.');
controller[_controlledWritableStream] = stream;
stream[_writableStreamController] = controller;
// These are just initialised to avoid triggering the assert() in
// ResetQueue. They are overwritten by ResetQueue().
controller[_queue] = undefined;
controller[_queueTotalSize] = undefined;
ResetQueue(controller);
controller[_started] = false;
controller[_strategySizeAlgorithm] = sizeAlgorithm;
controller[_strategyHWM] = highWaterMark;
controller[_writeAlgorithm] = writeAlgorithm;
controller[_closeAlgorithm] = closeAlgorithm;
controller[_abortAlgorithm] = abortAlgorithm;
const backpressure =
WritableStreamDefaultControllerGetBackpressure(controller);
WritableStreamUpdateBackpressure(stream, backpressure);
const startResult = startAlgorithm();
const startPromise = Promise_resolve(startResult);
thenPromise(
startPromise,
......@@ -832,10 +871,23 @@
});
}
// Writable Stream Default Controller Abstract Operations
function IsWritableStreamDefaultController(x) {
return hasOwnPropertyNoThrow(x, _underlyingSink);
function SetUpWritableStreamDefaultControllerFromUnderlyingSink(
stream, underlyingSink, highWaterMark, sizeAlgorithm) {
// assert(underlyingSink !== undefined, '_underlyingSink_ is not ' +
// '*undefined*.');
const controller = ObjectCreate(WritableStreamDefaultController_prototype);
const startAlgorithm =
() => CallOrNoop1(underlyingSink, 'start', controller,
'underlyingSink.start');
const writeAlgorithm = CreateAlgorithmFromUnderlyingMethodPassingController(
underlyingSink, 'write', 1, controller, 'underlyingSink.write');
const closeAlgorithm = CreateAlgorithmFromUnderlyingMethod(
underlyingSink, 'close', 0, 'underlyingSink.close');
const abortAlgorithm = CreateAlgorithmFromUnderlyingMethod(
underlyingSink, 'abort', 1, 'underlyingSink.abort');
SetUpWritableStreamDefaultController(stream, controller, startAlgorithm,
writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark,
sizeAlgorithm);
}
function WritableStreamDefaultControllerClose(controller) {
......@@ -844,18 +896,15 @@
}
function WritableStreamDefaultControllerGetChunkSize(controller, chunk) {
const strategySize = controller[_strategySize];
if (strategySize === undefined) {
return 1;
}
let value;
try {
value = Function_call(strategySize, undefined, chunk);
// Unlike other algorithms, strategySizeAlgorithm isn't indirected, so we
// need to be careful with the |this| value.
return Function_call(controller[_strategySizeAlgorithm], undefined,
chunk);
} catch (e) {
WritableStreamDefaultControllerErrorIfNeeded(controller, e);
return 1;
}
return value;
}
function WritableStreamDefaultControllerGetDesiredSize(controller) {
......@@ -922,9 +971,7 @@
DequeueValue(controller);
// assert(controller[_queue].length === 0,
// 'controller.[[queue]] is empty.');
const sinkClosePromise =
PromiseCallOrNoop0(controller[_underlyingSink], 'close',
'underlyingSink.close');
const sinkClosePromise = controller[_closeAlgorithm]();
thenPromise(
sinkClosePromise, () => WritableStreamFinishInFlightClose(stream),
reason => WritableStreamFinishInFlightCloseWithError(stream, reason));
......@@ -933,9 +980,7 @@
function WritableStreamDefaultControllerProcessWrite(controller, chunk) {
const stream = controller[_controlledWritableStream];
WritableStreamMarkFirstWriteRequestInFlight(stream);
const sinkWritePromise = PromiseCallOrNoop2(
controller[_underlyingSink], 'write', chunk, controller,
'underlyingSink.write');
const sinkWritePromise = controller[_writeAlgorithm](chunk);
thenPromise(
sinkWritePromise,
() => {
......@@ -1005,6 +1050,7 @@
binding.getWritableStreamStoredError = getWritableStreamStoredError;
// Exports for TransformStream
binding.CreateWritableStream = CreateWritableStream;
binding.WritableStream = WritableStream;
binding.WritableStreamDefaultControllerErrorIfNeeded =
WritableStreamDefaultControllerErrorIfNeeded;
......
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