@@ -19,9 +19,6 @@ spec:infra; type:dfn; text:list
19
19
spec:html; type:dfn; text:entangle
20
20
spec:html; type:dfn; text:message port post message steps
21
21
spec:html; type:dfn; text:port message queue
22
- # TODO: remove these once whatwg/html#7414 is merged
23
- spec:websockets; type:interface; text:WebSocket
24
- spec:websockets; type:attribute; text:bufferedAmount; for:WebSocket
25
22
</pre>
26
23
27
24
<pre class="anchors">
@@ -34,6 +31,7 @@ urlPrefix: https://tc39.es/ecma262/; spec: ECMASCRIPT
34
31
text: ArrayBuffer; url: #sec-arraybuffer-objects
35
32
text: DataView; url: #sec-dataview-objects
36
33
text: Number; url: #sec-ecmascript-language-types-number-type
34
+ text: SharedArrayBuffer; url: #sec-sharedarraybuffer-objects
37
35
text: Uint8Array; url: #sec-typedarray-objects
38
36
text: %Object.prototype%; url: #sec-properties-of-the-object-prototype-object
39
37
type: dfn
@@ -4032,6 +4030,12 @@ callback UnderlyingSinkAbortCallback = Promise<undefined> (optional any reason);
4032
4030
its previous value, only increasing to signal the desire for more chunks once the write
4033
4031
succeeds.
4034
4032
4033
+ <p> Finally, the promise potentially returned by this function is used to ensure that <a
4034
+ href="#write-mutable-chunks"> well-behaved</a> [=producers=] do not attempt to mutate the
4035
+ [=chunk=] before it has been fully processed. (This is not guaranteed by any specification
4036
+ machinery, but instead is an informal contract between [=producers=] and the [=underlying
4037
+ sink=] .)
4038
+
4035
4039
<dt> <dfn dict-member for="UnderlyingSink" lt="close">close()</dfn> </dt>
4036
4040
<dd>
4037
4041
<p> A function that is called after the [=producer=] signals, via
@@ -4333,6 +4337,11 @@ following table:
4333
4337
<p> Note that what "success" means is up to the [=underlying sink=] ; it might indicate simply that
4334
4338
the [=chunk=] has been accepted, and not necessarily that it is safely saved to its ultimate
4335
4339
destination.
4340
+
4341
+ <p id="write-mutable-chunks"> If <var ignore> chunk</var> is mutable, [=producers=] are advised to
4342
+ avoid mutating it after passing it to {{WritableStreamDefaultWriter/write()}} , until after the
4343
+ promise returned by {{WritableStreamDefaultWriter/write()}} settles. This ensures that the
4344
+ [=underlying sink=] receives and processes the same value that was passed in.
4336
4345
</dl>
4337
4346
4338
4347
<div algorithm>
@@ -5463,6 +5472,11 @@ callback TransformerTransformCallback = Promise<undefined> (any chunk, Transform
5463
5472
success or failure of the transformation. A rejected promise will error both the readable and
5464
5473
writable sides of the transform stream.
5465
5474
5475
+ <p> The promise potentially returned by this function is used to ensure that <a
5476
+ href="#write-mutable-chunks"> well-behaved</a> [=producers=] do not attempt to mutate the [=chunk=]
5477
+ before it has been fully transformed. (This is not guaranteed by any specification machinery, but
5478
+ instead is an informal contract between [=producers=] and the [=transformer=] .)
5479
+
5466
5480
<p> If no {{Transformer/transform|transform()}} method is supplied, the identity transform is
5467
5481
used, which enqueues chunks unchanged from the writable side to the readable side.
5468
5482
@@ -6925,6 +6939,15 @@ for="ReadableStream">locked</dfn> if ! [$IsReadableStreamLocked$](|stream|) retu
6925
6939
|writeAlgorithm|, |closeAlgorithmWrapper|, |abortAlgorithmWrapper|, |highWaterMark|,
6926
6940
|sizeAlgorithm|).
6927
6941
6942
+ Other specifications should be careful when constructing their
6943
+ <i> [=WritableStream/set up/writeAlgorithm=] </i> to avoid [=in parallel=] reads from the given
6944
+ [=chunk=] , as such reads can violate the run-to-completion semantics of JavaScript. To avoid this,
6945
+ they can make a synchronous copy or transfer of the given value, using operations such as
6946
+ [$StructuredSerializeWithTransfer$] , [=get a copy of the bytes held by the buffer source=] , or
6947
+ <a for="ArrayBuffer" lt="transfer">transferring an `ArrayBuffer`</a> . An exception is when the
6948
+ [=chunk=] is a {{SharedArrayBuffer}} , for which it is understood that parallel mutations are a fact
6949
+ of life.
6950
+
6928
6951
<div class="example" id="example-set-up-ws">
6929
6952
Creating a {{WritableStream}} from other specifications is thus a two-step process, like so:
6930
6953
@@ -6936,6 +6959,8 @@ for="ReadableStream">locked</dfn> if ! [$IsReadableStreamLocked$](|stream|) retu
6936
6959
directly on the [=this=] value inside their constructor steps.</p>
6937
6960
</div>
6938
6961
6962
+ <hr>
6963
+
6939
6964
The following definitions must only be used on {{WritableStream}} instances initialized via the
6940
6965
above [=WritableStream/set up=] algorithm:
6941
6966
@@ -7021,6 +7046,15 @@ reason.
7021
7046
1. Perform ! [$SetUpTransformStreamDefaultController$] (|stream|, |controller|,
7022
7047
|transformAlgorithmWrapper|, |flushAlgorithmWrapper|).
7023
7048
7049
+ Other specifications should be careful when constructing their
7050
+ <i> [=TransformStream/set up/transformAlgorithm=] </i> to avoid [=in parallel=] reads from the given
7051
+ [=chunk=] , as such reads can violate the run-to-completion semantics of JavaScript. To avoid this,
7052
+ they can make a synchronous copy or transfer of the given value, using operations such as
7053
+ [$StructuredSerializeWithTransfer$] , [=get a copy of the bytes held by the buffer source=] , or
7054
+ <a for="ArrayBuffer" lt="transfer">transferring an `ArrayBuffer`</a> . An exception is when the
7055
+ [=chunk=] is a {{SharedArrayBuffer}} , for which it is understood that parallel mutations are a fact
7056
+ of life.
7057
+
7024
7058
<div class="example" id="example-set-up-ts">
7025
7059
Creating a {{TransformStream}} from other specifications is thus a two-step process, like so:
7026
7060
0 commit comments