Skip to content

Commit 00185f1

Browse files
daeyeonRafaelGSS
authored andcommitted
stream: remove abortReason from WritableStreamDefaultController
The `abortReason` has been removed from the spec since we can get the abort reason via `controller.signal.reason`. This reflects the change. Signed-off-by: Daeyeon Jeong [email protected] PR-URL: #44540 Refs: https://streams.spec.whatwg.org/#ws-default-controller-class-definition Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 4a77a11 commit 00185f1

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

doc/api/webstreams.md

-4
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,6 @@ changes:
978978
The `WritableStreamDefaultController` manage's the {WritableStream}'s
979979
internal state.
980980
981-
#### `writableStreamDefaultController.abortReason`
982-
983-
* Type: {any} The `reason` value passed to `writableStream.abort()`.
984-
985981
#### `writableStreamDefaultController.error(error)`
986982
987983
<!-- YAML

lib/internal/webstreams/writablestream.js

-15
Original file line numberDiff line numberDiff line change
@@ -508,15 +508,6 @@ class WritableStreamDefaultController {
508508
resetQueue(this);
509509
}
510510

511-
/**
512-
* @type {any}
513-
*/
514-
get abortReason() {
515-
if (!isWritableStreamDefaultController(this))
516-
throw new ERR_INVALID_THIS('WritableStreamDefaultController');
517-
return this[kState].abortReason;
518-
}
519-
520511
/**
521512
* @type {AbortSignal}
522513
*/
@@ -545,7 +536,6 @@ class WritableStreamDefaultController {
545536
}
546537

547538
ObjectDefineProperties(WritableStreamDefaultController.prototype, {
548-
abortReason: kEnumerableProperty,
549539
signal: kEnumerableProperty,
550540
error: kEnumerableProperty,
551541
});
@@ -637,10 +627,6 @@ function writableStreamAbort(stream, reason) {
637627
if (state === 'closed' || state === 'errored')
638628
return PromiseResolve();
639629

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

646632
if (stream[kState].pendingAbortRequest.abort.promise !== undefined)
@@ -1253,7 +1239,6 @@ function setupWritableStreamDefaultController(
12531239
assert(stream[kState].controller === undefined);
12541240
controller[kState] = {
12551241
abortAlgorithm,
1256-
abortReason: undefined,
12571242
closeAlgorithm,
12581243
highWaterMark,
12591244
queue: [],

test/parallel/test-whatwg-writablestream.js

-6
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ class Sink {
198198
code: 'ERR_INVALID_THIS',
199199
});
200200

201-
assert.throws(() => {
202-
Reflect.get(WritableStreamDefaultController.prototype, 'abortReason', {});
203-
}, {
204-
code: 'ERR_INVALID_THIS',
205-
});
206-
207201
assert.throws(() => {
208202
Reflect.get(WritableStreamDefaultController.prototype, 'signal', {});
209203
}, {

0 commit comments

Comments
 (0)