mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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 PR-URL: https://github.com/nodejs/node/pull/44540 Refs: https://streams.spec.whatwg.org/#ws-default-controller-class-definition Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
@@ -978,10 +978,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
|
||||
|
||||
@@ -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}
|
||||
*/
|
||||
@@ -545,7 +536,6 @@ class WritableStreamDefaultController {
|
||||
}
|
||||
|
||||
ObjectDefineProperties(WritableStreamDefaultController.prototype, {
|
||||
abortReason: kEnumerableProperty,
|
||||
signal: kEnumerableProperty,
|
||||
error: kEnumerableProperty,
|
||||
});
|
||||
@@ -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)
|
||||
@@ -1253,7 +1239,6 @@ function setupWritableStreamDefaultController(
|
||||
assert(stream[kState].controller === undefined);
|
||||
controller[kState] = {
|
||||
abortAlgorithm,
|
||||
abortReason: undefined,
|
||||
closeAlgorithm,
|
||||
highWaterMark,
|
||||
queue: [],
|
||||
|
||||
@@ -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', {});
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user