@@ -4041,6 +4041,8 @@ The Web IDL definition for the {{WritableStreamDefaultController}} class is give
4041
4041
<xmp class="idl">
4042
4042
[Exposed=(Window,Worker,Worklet)]
4043
4043
interface WritableStreamDefaultController {
4044
+ readonly attribute any abortReason;
4045
+ readonly attribute AbortSignal signal;
4044
4046
undefined error(optional any e);
4045
4047
};
4046
4048
</xmp>
@@ -4060,6 +4062,9 @@ the following table:
4060
4062
<td> <dfn>\[[abortAlgorithm]]</dfn>
4061
4063
<td class="non-normative"> A promise-returning algorithm, taking one argument (the abort reason),
4062
4064
which communicates a requested abort to the [=underlying sink=]
4065
+ <tr>
4066
+ <td> <dfn>\[[abortReason]]</dfn>
4067
+ <td class="non-normative"> The argument given to [$WritableStreamAbort$] , or undefined.
4063
4068
<tr>
4064
4069
<td> <dfn>\[[closeAlgorithm]]</dfn>
4065
4070
<td class="non-normative"> A promise-returning algorithm which communicates a requested close to
@@ -4071,6 +4076,10 @@ the following table:
4071
4076
<td> <dfn>\[[queueTotalSize]]</dfn>
4072
4077
<td class="non-normative"> The total size of all the chunks stored in
4073
4078
[=WritableStreamDefaultController/[[queue]]=] (see [[#queue-with-sizes]] )
4079
+ <tr>
4080
+ <td> <dfn>\[[signal]]</dfn>
4081
+ <td class="non-normative"> An {{AbortSignal}} that can be used to abort the pending write or
4082
+ close operation when the stream is [=abort a writable stream|aborted=] .
4074
4083
<tr>
4075
4084
<td> <dfn>\[[started]]</dfn>
4076
4085
<td class="non-normative"> A boolean flag indicating whether the [=underlying sink=] has finished
@@ -4097,9 +4106,13 @@ The <dfn>close sentinel</dfn> is a unique value enqueued into
4097
4106
[=WritableStreamDefaultController/[[queue]]=] , in lieu of a [=chunk=] , to signal that the stream is
4098
4107
closed. It is only used internally, and is never exposed to web developers.
4099
4108
4100
- <h4 id="ws-default-controller-prototype">Methods</h4>
4109
+ <h4 id="ws-default-controller-prototype">Methods and properties </h4>
4101
4110
4102
4111
<dl class="domintro non-normative">
4112
+ <dt><code><var ignore> controller</var> .{{WritableStreamDefaultController/signal}} </code>
4113
+ <dd>
4114
+ <p> An AbortSignal that can be used to abort the pending write or close operation when the stream is
4115
+ [=abort a writable stream|aborted=] .
4103
4116
<dt><code><var ignore> controller</var> .{{WritableStreamDefaultController/error()|error}} (<var ignore> e</var> )</code>
4104
4117
<dd>
4105
4118
<p> Closes the controlled writable stream, making all future interactions with it fail with the
@@ -4111,6 +4124,20 @@ closed. It is only used internally, and is never exposed to web developers.
4111
4124
sink=] .
4112
4125
</dl>
4113
4126
4127
+ <div algorithm>
4128
+ The <dfn id="ws-default-controller-abort-reason" attribute
4129
+ for="WritableStreamDefaultController"> abortReason</dfn> getter steps are:
4130
+
4131
+ 1. Return [=this=] .[=WritableStreamDefaultController/[[abortReason]]=] .
4132
+ </div>
4133
+
4134
+ <div algorithm>
4135
+ The <dfn id="ws-default-controller-signal" attribute
4136
+ for="WritableStreamDefaultController"> signal</dfn> getter steps are:
4137
+
4138
+ 1. Return [=this=] .[=WritableStreamDefaultController/[[signal]]=] .
4139
+ </div>
4140
+
4114
4141
<div algorithm>
4115
4142
The <dfn id="ws-default-controller-error" method
4116
4143
for="WritableStreamDefaultController"> error(|e|)</dfn> method steps are:
@@ -4252,8 +4279,19 @@ The following abstract operations operate on {{WritableStream}} instances at a h
4252
4279
id="writable-stream-abort"> WritableStreamAbort(|stream|, |reason|)</dfn> performs the following
4253
4280
steps:
4254
4281
4282
+ 1. If |stream|.[=WritableStream/[[state]]=] is "`closed`" or "`errored`", return
4283
+ [=a promise resolved with=] undefined.
4284
+ 1. Set
4285
+ |stream|.[=WritableStream/[[controller]]=] .[=WritableStreamDefaultController/[[abortReason]]=]
4286
+ to |reason|.
4287
+ 1. [=Signal abort=] on
4288
+ |stream|.[=WritableStream/[[controller]]=] .[=WritableStreamDefaultController/[[signal]]=] .
4255
4289
1. Let |state| be |stream|.[=WritableStream/[[state]]=] .
4256
4290
1. If |state| is "`closed`" or "`errored`", return [=a promise resolved with=] undefined.
4291
+
4292
+ <p class="note"> We re-check the state because [=signaling abort=] runs author code and that might
4293
+ have changed the state.
4294
+
4257
4295
1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined, return
4258
4296
|stream|.[=WritableStream/[[pendingAbortRequest]]=] 's [=pending abort request/promise=] .
4259
4297
1. Assert: |state| is "`writable`" or "`erroring`".
@@ -4677,6 +4715,8 @@ The following abstract operations support the implementation of the
4677
4715
1. Set |controller|.[=WritableStreamDefaultController/[[stream]]=] to |stream|.
4678
4716
1. Set |stream|.[=WritableStream/[[controller]]=] to |controller|.
4679
4717
1. Perform ! [$ResetQueue$] (|controller|).
4718
+ 1. Set |controller|.[=WritableStreamDefaultController/[[abortReason]]=] to undefined.
4719
+ 1. Set |controller|.[=WritableStreamDefaultController/[[signal]]=] to a new {{AbortSignal}} .
4680
4720
1. Set |controller|.[=WritableStreamDefaultController/[[started]]=] to false.
4681
4721
1. Set |controller|.[=WritableStreamDefaultController/[[strategySizeAlgorithm]]=] to
4682
4722
|sizeAlgorithm|.
0 commit comments