Skip to content

Commit eba8c79

Browse files
authored
Use an AbortController instead of signaling abort on AbortSignal
- Replace WritableStreamDefaultController's [[signal]] with [[AbortController]], using the controller's signal where [[signal]] was used. Signal abort on [[abortController]] rather than the [[signal]]. - Remove the note about specs not signaling abort on the WritableStream's signal, since this won't be possible once AbortSignal's "signal abort" no longer exported.
1 parent cf7670a commit eba8c79

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

index.bs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,6 +4445,10 @@ the following table:
44454445
<td><dfn>\[[abortAlgorithm]]</dfn>
44464446
<td class="non-normative">A promise-returning algorithm, taking one argument (the abort reason),
44474447
which communicates a requested abort to the [=underlying sink=]
4448+
<tr>
4449+
<td><dfn>\[[abortController]]</dfn>
4450+
<td class="non-normative">An {{AbortController}} that can be used to abort the pending write or
4451+
close operation when the stream is [=abort a writable stream|aborted=].
44484452
<tr>
44494453
<td><dfn>\[[closeAlgorithm]]</dfn>
44504454
<td class="non-normative">A promise-returning algorithm which communicates a requested close to
@@ -4456,10 +4460,6 @@ the following table:
44564460
<td><dfn>\[[queueTotalSize]]</dfn>
44574461
<td class="non-normative">The total size of all the chunks stored in
44584462
[=WritableStreamDefaultController/[[queue]]=] (see [[#queue-with-sizes]])
4459-
<tr>
4460-
<td><dfn>\[[signal]]</dfn>
4461-
<td class="non-normative">An {{AbortSignal}} that can be used to abort the pending write or
4462-
close operation when the stream is [=abort a writable stream|aborted=].
44634463
<tr>
44644464
<td><dfn>\[[started]]</dfn>
44654465
<td class="non-normative">A boolean flag indicating whether the [=underlying sink=] has finished
@@ -4508,7 +4508,8 @@ closed. It is only used internally, and is never exposed to web developers.
45084508
The <dfn id="ws-default-controller-signal" attribute
45094509
for="WritableStreamDefaultController">signal</dfn> getter steps are:
45104510

4511-
1. Return [=this=].[=WritableStreamDefaultController/[[signal]]=].
4511+
1. Return [=this=].[=WritableStreamDefaultController/[[abortController]]=]'s
4512+
[=AbortController/signal=].
45124513
</div>
45134514

45144515
<div algorithm>
@@ -4654,13 +4655,13 @@ The following abstract operations operate on {{WritableStream}} instances at a h
46544655

46554656
1. If |stream|.[=WritableStream/[[state]]=] is "`closed`" or "`errored`", return
46564657
[=a promise resolved with=] undefined.
4657-
1. [=Signal abort=] on
4658-
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=] with
4659-
|reason|.
4658+
1. [=AbortController/Signal abort=] on
4659+
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[abortController]]=]
4660+
with |reason|.
46604661
1. Let |state| be |stream|.[=WritableStream/[[state]]=].
46614662
1. If |state| is "`closed`" or "`errored`", return [=a promise resolved with=] undefined.
4662-
<p class="note">We re-check the state because [=signaling abort=] runs author code and that might
4663-
have changed the state.
4663+
<p class="note">We re-check the state because [=AbortController/signaling abort=] runs author
4664+
code and that might have changed the state.
46644665
1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined, return
46654666
|stream|.[=WritableStream/[[pendingAbortRequest]]=]'s [=pending abort request/promise=].
46664667
1. Assert: |state| is "`writable`" or "`erroring`".
@@ -5084,7 +5085,8 @@ The following abstract operations support the implementation of the
50845085
1. Set |controller|.[=WritableStreamDefaultController/[[stream]]=] to |stream|.
50855086
1. Set |stream|.[=WritableStream/[[controller]]=] to |controller|.
50865087
1. Perform ! [$ResetQueue$](|controller|).
5087-
1. Set |controller|.[=WritableStreamDefaultController/[[signal]]=] to a new {{AbortSignal}}.
5088+
1. Set |controller|.[=WritableStreamDefaultController/[[abortController]]=] to a new
5089+
{{AbortController}}.
50885090
1. Set |controller|.[=WritableStreamDefaultController/[[started]]=] to false.
50895091
1. Set |controller|.[=WritableStreamDefaultController/[[strategySizeAlgorithm]]=] to
50905092
|sizeAlgorithm|.
@@ -6996,11 +6998,10 @@ above [=WritableStream/set up=] algorithm:
69966998
[$WritableStreamDefaultControllerErrorIfNeeded$](|stream|.[=WritableStream/[[controller]]=], |e|).
69976999

69987000
<p>The <dfn export for="WritableStream">signal</dfn> of a {{WritableStream}} |stream| is
6999-
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=].
7000-
Specifications can [=AbortSignal/add=] or [=AbortSignal/remove=] algorithms to this
7001-
{{AbortSignal}}, or consult whether it is [=AbortSignal/aborted=] and its [=AbortSignal/abort
7002-
reason=]. Specifications must not [=AbortSignal/signal abort=], as that would interfere with the
7003-
normal use of this signal to respond to the stream being [=abort a writable stream|aborted=].
7001+
|stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[abortController]]=]'s
7002+
[=AbortController/signal=]. Specifications can [=AbortSignal/add=] or [=AbortSignal/remove=]
7003+
algorithms to this {{AbortSignal}}, or consult whether it is [=AbortSignal/aborted=] and its
7004+
[=AbortSignal/abort reason=].
70047005

70057006
<p class="note">The usual usage is, after [=WritableStream/setting up=] the {{WritableStream}},
70067007
[=AbortSignal/add=] an algorithm to its [=WritableStream/signal=], which aborts any ongoing write

0 commit comments

Comments
 (0)