Skip to content
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
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 daeyeon.dev@gmail.com
  • Loading branch information
daeyeon committed Sep 6, 2022
commit e39a3bcb8c967461b096b3397c9b2e7d93cdef63
4 changes: 0 additions & 4 deletions doc/api/webstreams.md
Original file line number Diff line number Diff line change
Expand Up @@ -974,10 +974,6 @@ changes:
The `WritableStreamDefaultController` manage's the {WritableStream}'s
internal state.

#### `writableStreamDefaultController.abortReason`

* Type: {any} The `reason` value passed to `writableStream.abort()`.

#### `writableStreamDefaultController.error(error)`

<!-- YAML
Expand Down
15 changes: 0 additions & 15 deletions lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,6 @@ class WritableStreamDefaultController {
resetQueue(this);
}

/**
* @type {any}
*/
get abortReason() {
if (!isWritableStreamDefaultController(this))
throw new ERR_INVALID_THIS('WritableStreamDefaultController');
return this[kState].abortReason;
}

/**
* @type {AbortSignal}
*/
Expand Down Expand Up @@ -545,7 +536,6 @@ class WritableStreamDefaultController {
}

ObjectDefineProperties(WritableStreamDefaultController.prototype, {
abortReason: kEnumerableProperty,
signal: kEnumerableProperty,
error: kEnumerableProperty,
});
Expand Down Expand Up @@ -637,10 +627,6 @@ 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(reason);

if (stream[kState].pendingAbortRequest.abort.promise !== undefined)
Expand Down Expand Up @@ -1253,7 +1239,6 @@ function setupWritableStreamDefaultController(
assert(stream[kState].controller === undefined);
controller[kState] = {
abortAlgorithm,
abortReason: undefined,
closeAlgorithm,
highWaterMark,
queue: [],
Expand Down
6 changes: 0 additions & 6 deletions test/parallel/test-whatwg-writablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,6 @@ class Sink {
code: 'ERR_INVALID_THIS',
});

assert.throws(() => {
Reflect.get(WritableStreamDefaultController.prototype, 'abortReason', {});
}, {
code: 'ERR_INVALID_THIS',
});

assert.throws(() => {
Reflect.get(WritableStreamDefaultController.prototype, 'signal', {});
}, {
Expand Down