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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Daeyeon Jeong authored and RafaelGSS committed 2022-09-26 16:13:12 -03:00
1 parent d8d34ae6bc
commit 667e8bf3fb
2 files changed
+4 -6

No files matched your search

+4 -1
View File
@@ -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;
-5
View File
@@ -80,10 +80,5 @@
},
"transferable/transfer-with-messageport.window.js": {
"skip": "Browser-specific test"
},
"writable-streams/aborting.any.js": {
"fail": {
"expected": ["WritableStreamDefaultController.signal"]
}
}
}