Skip to content

Commit 667e8bf

Browse files
daeyeonRafaelGSS
authored andcommitted
stream: fix writableStream.abort()
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>
1 parent d8d34ae commit 667e8bf

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/internal/webstreams/writablestream.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,11 @@ function writableStreamAbort(stream, reason) {
637637
if (state === 'closed' || state === 'errored')
638638
return PromiseResolve();
639639

640+
// TODO(daeyeon): Remove `controller[kState].abortReason` and use
641+
// `controller[kState].abortController.signal.reason` for the
642+
// `WritableStreamDefaultController.prototype.abortReason` getter.
640643
controller[kState].abortReason = reason;
641-
controller[kState].abortController.abort();
644+
controller[kState].abortController.abort(reason);
642645

643646
if (stream[kState].pendingAbortRequest.abort.promise !== undefined)
644647
return stream[kState].pendingAbortRequest.abort.promise;

test/wpt/status/streams.json

-5
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,5 @@
8080
},
8181
"transferable/transfer-with-messageport.window.js": {
8282
"skip": "Browser-specific test"
83-
},
84-
"writable-streams/aborting.any.js": {
85-
"fail": {
86-
"expected": ["WritableStreamDefaultController.signal"]
87-
}
8883
}
8984
}

0 commit comments

Comments
 (0)