Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use abort reason in ReadableStreamPipeTo #1182

Merged
merged 19 commits into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,7 @@ The following abstract operations operate on {{ReadableStream}} instances at a h
1. Let |promise| be [=a new promise=].
1. If |signal| is not undefined,
1. Let |abortAlgorithm| be the following steps:
1. Let |error| be a new "{{AbortError}}" {{DOMException}}.
1. Let |error| be |signal|'s [=AbortSignal/abort reason=].
1. Let |actions| be an empty [=ordered set=].
1. If |preventAbort| is false, [=set/append=] the following action to |actions|:
1. If |dest|.[=WritableStream/[[state]]=] is "`writable`", return !
Expand All @@ -2113,8 +2113,7 @@ The following abstract operations operate on {{ReadableStream}} instances at a h
1. Otherwise, return [=a promise resolved with=] undefined.
1. [=Shutdown with an action=] consisting of [=getting a promise to wait for all=] of the actions
in |actions|, and with |error|.
1. If |signal|'s [=AbortSignal/aborted flag=] is set, perform |abortAlgorithm| and return
|promise|.
1. If |signal| is [=AbortSignal/aborted=], perform |abortAlgorithm| and return |promise|.
1. [=AbortSignal/Add=] |abortAlgorithm| to |signal|.
1. [=In parallel=] <span class="XXX">but not really; see <a
href="https://github.com/whatwg/streams/issues/905">#905</a></span>, using |reader| and
Expand Down Expand Up @@ -4518,7 +4517,8 @@ The following abstract operations operate on {{WritableStream}} instances at a h
1. If |stream|.[=WritableStream/[[state]]=] is "`closed`" or "`errored`", return
[=a promise resolved with=] undefined.
1. [=Signal abort=] on
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=].
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=] with
|reason|.
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved
1. Let |state| be |stream|.[=WritableStream/[[state]]=].
1. If |state| is "`closed`" or "`errored`", return [=a promise resolved with=] undefined.
<p class="note">We re-check the state because [=signaling abort=] runs author code and that might
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function ReadableStreamPipeTo(source, dest, preventClose, preventAbort, preventC
let abortAlgorithm;
if (signal !== undefined) {
abortAlgorithm = () => {
const error = new DOMException('Aborted', 'AbortError');
const error = signal.reason;
const actions = [];
if (preventAbort === false) {
actions.push(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function WritableStreamAbort(stream, reason) {
if (stream._state === 'closed' || stream._state === 'errored') {
return promiseResolvedWith(undefined);
}
stream._controller._abortController.abort();
stream._controller._abortController.abort(reason);
const state = stream._state;
if (state === 'closed' || state === 'errored') {
return promiseResolvedWith(undefined);
Expand Down
2 changes: 1 addition & 1 deletion reference-implementation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"minimatch": "^3.0.4",
"opener": "^1.5.1",
"webidl2js": "^16.2.0",
"wpt-runner": "^3.2.1"
"wpt-runner": "^4.0.0"
}
}
2 changes: 1 addition & 1 deletion reference-implementation/web-platform-tests