Skip to content

Commit

Permalink
stream: fix writableStream.abort()
Browse files Browse the repository at this point in the history
This includes:

- Fixing `writableStream.abort(reason)`. Passing the reason was missing.

- Leaving a TODO to remove the internal abortReason property of
  WritableStreamDefaultController.

Signed-off-by: Daeyeon Jeong daeyeon.dev@gmail.com
PR-URL: #44327
Refs: https://streams.spec.whatwg.org/#writable-stream-abort
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
  • Loading branch information
daeyeon authored and RafaelGSS committed Sep 26, 2022
1 parent d8d34ae commit 667e8bf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,11 @@ function writableStreamAbort(stream, reason) {
if (state === 'closed' || state === 'errored')
return PromiseResolve();

// TODO(daeyeon): Remove `controller[kState].abortReason` and use
// `controller[kState].abortController.signal.reason` for the
// `WritableStreamDefaultController.prototype.abortReason` getter.
controller[kState].abortReason = reason;
controller[kState].abortController.abort();
controller[kState].abortController.abort(reason);

if (stream[kState].pendingAbortRequest.abort.promise !== undefined)
return stream[kState].pendingAbortRequest.abort.promise;
Expand Down
5 changes: 0 additions & 5 deletions test/wpt/status/streams.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,5 @@
},
"transferable/transfer-with-messageport.window.js": {
"skip": "Browser-specific test"
},
"writable-streams/aborting.any.js": {
"fail": {
"expected": ["WritableStreamDefaultController.signal"]
}
}
}

0 comments on commit 667e8bf

Please sign in to comment.