@@ -6191,16 +6191,21 @@ to grow organically as needed.
6191
6191
up"><var> pullAlgorithm</var></dfn> , an optional algorithm <dfn export for="ReadableStream/set
6192
6192
up"><var> cancelAlgorithm</var></dfn> , an optional number <dfn export for="ReadableStream/set
6193
6193
up"><var> highWaterMark</var></dfn> (default 1), an optional algorithm <dfn export
6194
- for="ReadableStream/set up"><var> sizeAlgorithm</var></dfn> , perform the following steps. If given,
6195
- |sizeAlgorithm| must be an algorithm accepting [=chunk=] objects and returning a number; and if
6196
- given, |highWaterMark| must be a non-negative, non-NaN number.
6194
+ for="ReadableStream/set up"><var> sizeAlgorithm</var></dfn> , perform the following steps. If
6195
+ given, |pullAlgorithm| and |cancelAlgorithm| may return a promise. If given, |sizeAlgorithm| must
6196
+ be an algorithm accepting [=chunk=] objects and returning a number; and if given, |highWaterMark|
6197
+ must be a non-negative, non-NaN number.
6197
6198
6198
6199
1. Let |startAlgorithm| be an algorithm that returns undefined.
6199
6200
1. Let |pullAlgorithmWrapper| be an algorithm that runs these steps:
6200
- 1. If |pullAlgorithm| was given, run it.
6201
+ 1. Let |result| be the result of running |pullAlgorithm|, if |pullAlgorithm| was given, or null
6202
+ otherwise. If this throws an exception |e|, return [=a promise rejected with=] |e|.
6203
+ 1. If |result| is a {{Promise}} , then return |result|.
6201
6204
1. Return [=a promise resolved with=] undefined.
6202
6205
1. Let |cancelAlgorithmWrapper| be an algorithm that runs these steps:
6203
- 1. If |cancelAlgorithm| was given, run it.
6206
+ 1. Let |result| be the result of running |cancelAlgorithm|, if |cancelAlgorithm| was given, or
6207
+ null otherwise. If this throws an exception |e|, return [=a promise rejected with=] |e|.
6208
+ 1. If |result| is a {{Promise}} , then return |result|.
6204
6209
1. Return [=a promise resolved with=] undefined.
6205
6210
1. If |sizeAlgorithm| was not given, then set it to an algorithm that returns 1.
6206
6211
1. Perform [$InitializeReadableStream$] (|stream|).
@@ -6365,16 +6370,20 @@ for="ReadableStream">locked</dfn> if ! [$IsReadableStreamLocked$](|stream|) retu
6365
6370
up"><var> highWaterMark</var></dfn> (default 1), an optional algorithm <dfn export
6366
6371
for="WritableStream/set up"><var> sizeAlgorithm</var></dfn> , perform the following steps.
6367
6372
|writeAlgorithm| must be an algorithm that accepts a [=chunk=] object and returns a promise. If
6368
- given, |closeAlgorithm| and |abortAlgorithm| must return a promise. If given, |sizeAlgorithm| must
6373
+ given, |closeAlgorithm| and |abortAlgorithm| may return a promise. If given, |sizeAlgorithm| must
6369
6374
be an algorithm accepting [=chunk=] objects and returning a number; and if given, |highWaterMark|
6370
6375
must be a non-negative, non-NaN number.
6371
6376
6372
6377
1. Let |startAlgorithm| be an algorithm that returns undefined.
6373
6378
1. Let |closeAlgorithmWrapper| be an algorithm that runs these steps:
6374
- 1. If |closeAlgorithm| was given, return the result of running it.
6379
+ 1. Let |result| be the result of running |closeAlgorithm|, if |closeAlgorithm| was given, or
6380
+ null otherwise. If this throws an exception |e|, return [=a promise rejected with=] |e|.
6381
+ 1. If |result| is a {{Promise}} , then return |result|.
6375
6382
1. Return [=a promise resolved with=] undefined.
6376
6383
1. Let |abortAlgorithmWrapper| be an algorithm that runs these steps:
6377
- 1. If |abortAlgorithm| was given, return the result of running it.
6384
+ 1. Let |result| be the result of running |abortAlgorithm|, if |abortAlgorithm| was given, or
6385
+ null otherwise. If this throws an exception |e|, return [=a promise rejected with=] |e|.
6386
+ 1. If |result| is a {{Promise}} , then return |result|.
6378
6387
1. Return [=a promise resolved with=] undefined.
6379
6388
1. If |sizeAlgorithm| was not given, then set it to an algorithm that returns 1.
6380
6389
1. Perform [$InitializeWritableStream$] (|stream|).
@@ -6440,18 +6449,22 @@ reason.
6440
6449
To <dfn export for="TransformStream" lt="set up|setting up">set up</dfn> a
6441
6450
newly-[=new|created-via-Web IDL=] {{TransformStream}} |stream| given an algorithm <dfn export
6442
6451
for="TransformStream/set up"><var> transformAlgorithm</var></dfn> and an optional algorithm <dfn
6443
- export for="TransformStream/set up"><var> flushAlgorithm</var></dfn> :
6452
+ export for="TransformStream/set up"><var> flushAlgorithm</var></dfn> , perform the following steps.
6453
+ |transformAlgorithm| and, if given, |flushAlgorithm|, may return a promise.
6444
6454
6445
6455
1. Let |writableHighWaterMark| be 1.
6446
6456
1. Let |writableSizeAlgorithm| be an algorithm that returns 1.
6447
6457
1. Let |readableHighWaterMark| be 0.
6448
6458
1. Let |readableSizeAlgorithm| be an algorithm that returns 1.
6449
6459
1. Let |transformAlgorithmWrapper| be an algorithm that runs these steps given a value |chunk|:
6450
- 1. Run |transformAlgorithm| given |chunk|. If this throws an exception |e|, return [=a promise
6451
- rejected with=] |e|.
6460
+ 1. Let |result| be the result of running |transformAlgorithm| given |chunk|. If this throws an
6461
+ exception |e|, return [=a promise rejected with=] |e|.
6462
+ 1. If |result| is a {{Promise}} , then return |result|.
6452
6463
1. Return [=a promise resolved with=] undefined.
6453
6464
1. Let |flushAlgorithmWrapper| be an algorithm that runs these steps:
6454
- 1. If |flushAlgorithm| was given, run it.
6465
+ 1. Let |result| be the result of running |flushAlgorithm|, if |flushAlgorithm| was given, or
6466
+ null otherwise. If this throws an exception |e|, return [=a promise rejected with=] |e|.
6467
+ 1. If |result| is a {{Promise}} , then return |result|.
6455
6468
1. Return [=a promise resolved with=] undefined.
6456
6469
1. Let |startPromise| be [=a promise resolved with=] undefined.
6457
6470
1. Perform ! [$InitializeTransformStream$] (|stream|, |startPromise|, |writableHighWaterMark|,
0 commit comments