Skip to content

Commit 4b6b93c

Browse files
authored
WritableStream: remove the abortReason property
Part of #1165, which discusses moving it instead to the AbortSignal's reason property per whatwg/dom#1027.
1 parent 641df4b commit 4b6b93c

6 files changed

+5
-25
lines changed

index.bs

-15
Original file line numberDiff line numberDiff line change
@@ -4288,7 +4288,6 @@ The Web IDL definition for the {{WritableStreamDefaultController}} class is give
42884288
<xmp class="idl">
42894289
[Exposed=(Window,Worker,Worklet)]
42904290
interface WritableStreamDefaultController {
4291-
readonly attribute any abortReason;
42924291
readonly attribute AbortSignal signal;
42934292
undefined error(optional any e);
42944293
};
@@ -4309,9 +4308,6 @@ the following table:
43094308
<td><dfn>\[[abortAlgorithm]]</dfn>
43104309
<td class="non-normative">A promise-returning algorithm, taking one argument (the abort reason),
43114310
which communicates a requested abort to the [=underlying sink=]
4312-
<tr>
4313-
<td><dfn>\[[abortReason]]</dfn>
4314-
<td class="non-normative">The argument given to [$WritableStreamAbort$], or undefined.
43154311
<tr>
43164312
<td><dfn>\[[closeAlgorithm]]</dfn>
43174313
<td class="non-normative">A promise-returning algorithm which communicates a requested close to
@@ -4371,13 +4367,6 @@ closed. It is only used internally, and is never exposed to web developers.
43714367
sink=].
43724368
</dl>
43734369

4374-
<div algorithm>
4375-
The <dfn id="ws-default-controller-abort-reason" attribute
4376-
for="WritableStreamDefaultController">abortReason</dfn> getter steps are:
4377-
4378-
1. Return [=this=].[=WritableStreamDefaultController/[[abortReason]]=].
4379-
</div>
4380-
43814370
<div algorithm>
43824371
The <dfn id="ws-default-controller-signal" attribute
43834372
for="WritableStreamDefaultController">signal</dfn> getter steps are:
@@ -4528,9 +4517,6 @@ The following abstract operations operate on {{WritableStream}} instances at a h
45284517

45294518
1. If |stream|.[=WritableStream/[[state]]=] is "`closed`" or "`errored`", return
45304519
[=a promise resolved with=] undefined.
4531-
1. Set
4532-
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[abortReason]]=]
4533-
to |reason|.
45344520
1. [=Signal abort=] on
45354521
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=].
45364522
1. Let |state| be |stream|.[=WritableStream/[[state]]=].
@@ -4960,7 +4946,6 @@ The following abstract operations support the implementation of the
49604946
1. Set |controller|.[=WritableStreamDefaultController/[[stream]]=] to |stream|.
49614947
1. Set |stream|.[=WritableStream/[[controller]]=] to |controller|.
49624948
1. Perform ! [$ResetQueue$](|controller|).
4963-
1. Set |controller|.[=WritableStreamDefaultController/[[abortReason]]=] to undefined.
49644949
1. Set |controller|.[=WritableStreamDefaultController/[[signal]]=] to a new {{AbortSignal}}.
49654950
1. Set |controller|.[=WritableStreamDefaultController/[[started]]=] to false.
49664951
1. Set |controller|.[=WritableStreamDefaultController/[[strategySizeAlgorithm]]=] to

reference-implementation/lib/WritableStreamDefaultController-impl.js

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ const { AbortSteps, ErrorSteps } = require('./abstract-ops/internal-methods.js')
55
const { ResetQueue } = require('./abstract-ops/queue-with-sizes.js');
66

77
exports.implementation = class WritableStreamDefaultControllerImpl {
8-
get abortReason() {
9-
return this._abortReason;
10-
}
118
get signal() {
129
return this._abortController.signal;
1310
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[Exposed=(Window,Worker,Worklet)]
22
interface WritableStreamDefaultController {
3-
readonly attribute any abortReason;
43
readonly attribute AbortSignal signal;
54
void error(optional any e);
65
};

reference-implementation/lib/abstract-ops/writable-streams.js

-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ function WritableStreamAbort(stream, reason) {
107107
if (stream._state === 'closed' || stream._state === 'errored') {
108108
return promiseResolvedWith(undefined);
109109
}
110-
stream._controller._abortReason = reason;
111110
stream._controller._abortController.abort();
112111
const state = stream._state;
113112
if (state === 'closed' || state === 'errored') {
@@ -542,7 +541,6 @@ function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm
542541
controller._queueTotalSize = undefined;
543542
ResetQueue(controller);
544543

545-
controller._abortReason = undefined;
546544
controller._abortController = new AbortController();
547545
controller._started = false;
548546

writable-stream-abort-signal-explainer.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ streams such as [WebTransport](https://w3c.github.io/webtransport/).
2121
On [WritableStreamDefaultController](https://streams.spec.whatwg.org/#writablestreamdefaultcontroller)
2222
(the controller argument that is passed to underlying sinks):
2323

24-
* [`abortReason`](https://streams.spec.whatwg.org/#writablestreamdefaultcontroller-abortreason): The argument passed
25-
to `writable.abort()` or `writer.abort()`. Undefined if no argument was passed or `abort()` hasn't been called.
2624
* [`signal`](https://streams.spec.whatwg.org/#writablestreamdefaultcontroller-signal): An AbortSignal. By using
2725
`signal.addEventListener('abort', …)` an underlying sink can abort the pending write or close operation when the
2826
stream is aborted.
@@ -44,7 +42,7 @@ const ws = new WritableStream({
4442
return new Promise((resolve, reject) => {
4543
setTimeout(resolve, 1000);
4644
controller.signal.addEventListener('abort',
47-
() => reject(controller.abortReason));
45+
() => reject(controller.signal.reason));
4846
});
4947
}
5048
});
@@ -117,3 +115,6 @@ would be unclear and confusing.
117115
* It was initially proposed that an `AbortSignal` could be passed to each sink `write()` call. However, since the
118116
abort signal does not need to change between two `write()` calls, it was thought better to just add a `signal` property
119117
on `WritableStreamDefaultController`.
118+
* Previously, [WritableStreamDefaultController](https://streams.spec.whatwg.org/#writablestreamdefaultcontroller) had
119+
an `abortReason` property that was an argument given to
120+
[WritableStreamAbort](https://streams.spec.whatwg.org/#writable-stream-abort). However, after some discussion, it was thought better to just add the `reason` property to the `AbortSignal`.

0 commit comments

Comments
 (0)