@@ -1024,8 +1024,8 @@ user-agent-defined <a for=header>value</a> for the
1024
1024
<a for=/>body</a> <var> body</var> , run these steps:
1025
1025
1026
1026
<ol>
1027
- <li><p> Let «<var> out1</var> , <var> out2</var> » be the result of
1028
- <a lt=tee for=ReadableStream>teeing</a> < var> body</var> 's <a for=body>stream</a> .
1027
+ <li><p> Let «<var> out1</var> , <var> out2</var> » be the result of <a for=ReadableStream>teeing</a>
1028
+ <var> body</var> 's <a for=body>stream</a> .
1029
1029
1030
1030
<li><p> Set <var> body</var> 's <a for=body>stream</a> to <var> out1</var> .
1031
1031
@@ -1662,8 +1662,8 @@ is to return the result of <a>serializing a request origin</a> with <var>request
1662
1662
<a>process request end-of-body</a> for <var> request</var> and abort these steps.
1663
1663
1664
1664
<li>
1665
- <p> Let <var> reader</var> be the result of <a lt="get a reader" for=ReadableStream>getting
1666
- a reader</a> from <var> body</var> 's <a for=body>stream</a> .
1665
+ <p> Let <var> reader</var> be the result of <a for=ReadableStream>getting a reader</a> for
1666
+ <var> body</var> 's <a for=body>stream</a> .
1667
1667
1668
1668
<p class="note no-backref"> This operation cannot throw an exception.
1669
1669
@@ -1727,8 +1727,7 @@ is to return the result of <a>serializing a request origin</a> with <var>request
1727
1727
</ol>
1728
1728
</dl>
1729
1729
1730
- <li><p> <a lt="read a chunk" for=ReadableStream>Read a chunk</a> from <var> body</var> 's
1731
- <a for=body>stream</a> with <var> reader</var> given <var> readRequest</var> .
1730
+ <li><p> <a for=ReadableStream>Read a chunk</a> from <var> reader</var> given <var> readRequest</var> .
1732
1731
</ol>
1733
1732
1734
1733
<hr>
@@ -2316,196 +2315,6 @@ run these steps:
2316
2315
</ol>
2317
2316
2318
2317
2319
- <h3 id=streams oldids="readablestream,concept-readablestream">Streams</h3>
2320
-
2321
- <p class="note no-backref"> This section might be integrated into other standards, such as
2322
- <cite> Streams</cite> itself. See
2323
- <a href="https://github.com/whatwg/streams/issues/372">whatwg/streams#372</a> .
2324
-
2325
- <p> In this section, we define common operations for {{ReadableStream}} objects. [[!STREAMS]]
2326
-
2327
- <p> To <dfn export for=ReadableStream id=concept-enqueue-readablestream>enqueue bytes</dfn> , given a
2328
- <a for=/>byte sequence</a> <var> bytes</var> and a {{ReadableStream}} object <var> stream</var> :
2329
-
2330
- <ol>
2331
- <li><p> Let <var> chunk</var> be a {{Uint8Array}} object wrapping an {{ArrayBuffer}} object
2332
- containing <var> bytes</var> . If that threw an exception, <a abstract-op>error</a> <var> stream</var>
2333
- with that exception and return.</p></li>
2334
-
2335
- <li><p> Call
2336
- <a abstract-op>ReadableStreamDefaultControllerEnqueue</a> (<var> stream</var> .\[[readableStreamController]] ,
2337
- <var> chunk</var> ).
2338
- </ol>
2339
-
2340
- <p> To <dfn abstract-op export for=ReadableStream id=concept-close-readablestream>close</dfn> a
2341
- {{ReadableStream}} object <var> stream</var> , run these steps:
2342
-
2343
- <ol>
2344
- <li><p> Call
2345
- <a abstract-op>ReadableStreamDefaultControllerClose</a> (<var> stream</var> .\[[readableStreamController]] ).
2346
- </ol>
2347
-
2348
- <p> To <dfn abstract-op export for=ReadableStream id=concept-error-readablestream>error</dfn> a
2349
- {{ReadableStream}} object <var> stream</var> with given <var> reason</var> , run these steps:
2350
-
2351
- <ol>
2352
- <li><p> Call
2353
- <a abstract-op>ReadableStreamDefaultControllerError</a> (<var> stream</var> .\[[readableStreamController]] ),
2354
- <var> reason</var> ).
2355
- </ol>
2356
-
2357
- <p> To
2358
- <dfn export id=concept-construct-readablestream lt="construct a ReadableStream object|constructing a ReadableStream object">construct a <code>ReadableStream</code> object</dfn>
2359
- optionally with a <var> highWaterMark</var> , <var> sizeAlgorithm</var> algorithm, <var> pull</var>
2360
- action, and <var> cancel</var> action, run these steps:
2361
-
2362
- <ol>
2363
- <li><p> Let <var> startAlgorithm</var> be an algorithm that returns undefined.
2364
-
2365
- <li><p> If <var> pull</var> is not given, then set it to an action that does nothing.
2366
-
2367
- <li>
2368
- <p> Let <var> pullAlgorithm</var> be an algorithm that runs these steps:
2369
-
2370
- <ol>
2371
- <li><p> Run <var> pull</var> .
2372
-
2373
- <li><p> Return <a>a promise resolved with</a> undefined.
2374
- </ol>
2375
-
2376
- <li><p> If <var> cancel</var> is not given, then set it to an action that does nothing.
2377
-
2378
- <li>
2379
- <p> Let <var> cancelAlgorithm</var> be an algorithm that runs these steps:
2380
-
2381
- <ol>
2382
- <li><p> Run <var> cancel</var> .
2383
-
2384
- <li><p> Return <a>a promise resolved with</a> undefined.
2385
- </ol>
2386
-
2387
- <li><p> If <var> highWaterMark</var> is not given, then set it to 1.
2388
-
2389
- <li><p> If <var> sizeAlgorithm</var> is not given, then set it to an algorithm that returns 1.
2390
-
2391
- <li><p> Return [$CreateReadableStream$] (<var> startAlgorithm</var> , <var> pullAlgorithm</var> ,
2392
- <var> cancelAlgorithm</var> , <var> highWaterMark</var> , <var> sizeAlgorithm</var> ).
2393
- </ol>
2394
-
2395
- <p> To <dfn export for=ReadableStream id=concept-get-reader>get a reader</dfn> from a
2396
- {{ReadableStream}} object <var> stream</var> , run these steps:
2397
-
2398
- <ol>
2399
- <li><p> Let <var> reader</var> be the result of calling
2400
- <a abstract-op>AcquireReadableStreamDefaultReader</a> (<var> stream</var> ).
2401
-
2402
- <li><p> Return <var> reader</var> .
2403
- </ol>
2404
-
2405
- <p> To
2406
- <dfn export for=ReadableStream id=concept-read-chunk-from-readablestream>read a chunk</dfn> from a
2407
- {{ReadableStream}} object with <var> reader</var> , given a <a>read request</a>
2408
- <var> readRequest</var> , perform
2409
- <a abstract-op>ReadableStreamDefaultReaderRead</a> (<var> reader</var> , <var> readRequest</var> ).
2410
-
2411
- <p> To
2412
- <dfn export for=ReadableStream id=concept-read-all-bytes-from-readablestream>read all bytes</dfn>
2413
- from a {{ReadableStream}} object with <var> reader</var> , run these steps:
2414
-
2415
- <ol>
2416
- <li><p> Let <var> promise</var> be a new promise.
2417
-
2418
- <li><p> Let <var> bytes</var> be an empty byte sequence.
2419
-
2420
- <li><p> <a>Read-loop</a> given <var> reader</var> , <var> bytes</var> , and <var> promise</var> .
2421
-
2422
- <li><p> Return <var> promise</var> .
2423
- </ol>
2424
-
2425
- <p> To <dfn>read-loop</dfn> given <var> reader</var> , <var> bytes</var> , and <var> promise</var> :
2426
-
2427
- <ol>
2428
- <li>
2429
- <p> Let <var> readRequest</var> be a new <a>read request</a> with the following
2430
- <a for=struct>items</a> :
2431
-
2432
- <dl>
2433
- <dt> <a for="read request">chunk steps</a> , given <var> chunk</var>
2434
- <dd>
2435
- <ol>
2436
- <li><p> Assert: <var> chunk</var> is a {{Uint8Array}} object.
2437
-
2438
- <li><p> Append <var> chunk</var> to <var> bytes</var> .
2439
-
2440
- <li><p> <a>Read-loop</a> given <var> reader</var> , <var> bytes</var> , and <var> promise</var> .
2441
- </ol>
2442
-
2443
- <dt> <a for="read request">close steps</a>
2444
- <dd>
2445
- <ol>
2446
- <li><p> <a for=/>Resolve</a> <var> promise</var> with <var> bytes</var> .</p></li>
2447
- </ol>
2448
-
2449
- <dt> <a for="read request">error steps</a> , given <var> e</var>
2450
- <dd>
2451
- <ol>
2452
- <li><p> <a for=/>Reject</a> <var> promise</var> with <var> e</var> .
2453
- </ol>
2454
- </dl>
2455
-
2456
- <li><p> Perform <a abstract-op>ReadableStreamDefaultReaderRead</a> (<var> reader</var> ,
2457
- <var> readRequest</var> ).
2458
- </ol>
2459
-
2460
- <p class="note no-backref"> Because the reader grants exclusive access, the actual mechanism of how
2461
- to read cannot be observed. Implementations could use more direct mechanism if convenient.
2462
-
2463
- <p> To <dfn export for=ReadableStream id=concept-cancel-readablestream>cancel</dfn> a
2464
- {{ReadableStream}} object <var> stream</var> with <var> reason</var> , return the result of calling
2465
- <a abstract-op>ReadableStreamCancel</a> (<var> stream</var> , <var> reason</var> ).
2466
-
2467
- <p> To <dfn export for=ReadableStream id=concept-tee-readablestream>tee</dfn> a {{ReadableStream}}
2468
- object <var> stream</var> , run these steps:
2469
-
2470
- <ol>
2471
- <li><p> Return the result of calling <a abstract-op>ReadableStreamTee</a> (<var> stream</var> , true).
2472
- </ol>
2473
-
2474
- <p> A {{ReadableStream}} object <var> stream</var> is said to be
2475
- <dfn export for=ReadableStream id=concept-readablestream-readable>readable</dfn> if
2476
- <var> stream</var> .\[[state]] is "readable".
2477
-
2478
- <p> A {{ReadableStream}} object <var> stream</var> is said to be
2479
- <dfn export for=ReadableStream id=concept-readablestream-closed>closed</dfn> if
2480
- <var> stream</var> .\[[state]] is "closed".
2481
-
2482
- <p> A {{ReadableStream}} object <var> stream</var> is said to be
2483
- <dfn export for=ReadableStream id=concept-readablestream-errored>errored</dfn> if
2484
- <var> stream</var> .\[[state]] is "errored".
2485
-
2486
- <p> A {{ReadableStream}} object <var> stream</var> is said to be
2487
- <dfn export for=ReadableStream id=concept-readablestream-locked>locked</dfn> if the
2488
- result of calling <a abstract-op>IsReadableStreamLocked</a> (<var> stream</var> ) is
2489
- true.
2490
-
2491
- <p> A {{ReadableStream}} object <var> stream</var> is said to
2492
- <dfn export for=ReadableStream id=concept-readablestream-need-more-data>need more data</dfn>
2493
- if the following conditions hold:
2494
-
2495
- <ul>
2496
- <li><p><var> stream</var> is <a for=ReadableStream>readable</a> .
2497
-
2498
- <li><p> The result of calling
2499
- <a abstract-op>ReadableStreamDefaultControllerGetDesiredSize</a> (<var> stream</var> .\[[readableStreamController]] )
2500
- is positive.
2501
- </ul>
2502
-
2503
- <p> A {{ReadableStream}} object <var> stream</var> is said to be
2504
- <dfn export for=ReadableStream id=concept-readablestream-disturbed>disturbed</dfn>
2505
- if the result of calling
2506
- <a abstract-op>IsReadableStreamDisturbed</a> (<var> stream</var> ) is true.
2507
-
2508
-
2509
2318
2510
2319
<h2 id=http-extensions>HTTP extensions</h2>
2511
2320
@@ -4898,22 +4707,23 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b
4898
4707
<li><p> Return a <a>network error</a> .
4899
4708
</ol>
4900
4709
4710
+ <li><p> Let <var> pullAlgorithm</var> be an action that <a lt=resumed for=fetch>resumes</a> the
4711
+ ongoing fetch if it is <a lt=suspend for=fetch>suspended</a> .
4712
+
4713
+ <li><p> Let <var> cancelAlgorithm</var> be an action that <a lt=terminated for=fetch>terminates</a>
4714
+ the ongoing fetch with the aborted flag set.
4715
+
4901
4716
<li><p> Let <var> highWaterMark</var> be a non-negative, non-NaN number, chosen by the user agent.
4902
4717
4903
4718
<li><p> Let <var> sizeAlgorithm</var> be an algorithm that accepts a <a>chunk</a> object and returns
4904
4719
a non-negative, non-NaN, non-infinite number, chosen by the user agent.
4905
4720
4906
- <li><p> Let <var> pull</var> be an action that <a lt=resumed for=fetch>resumes</a> the ongoing fetch
4907
- if it is <a lt=suspend for=fetch>suspended</a> .
4908
-
4909
- <li><p> Let <var> cancel</var> be an action that <a lt=terminated for=fetch>terminates</a> the
4910
- ongoing fetch with the aborted flag set.
4911
-
4912
- <li>
4913
- <p> Let <var> stream</var> be the result of <a>constructing a <code>ReadableStream</code> object</a>
4914
- with <var> highWaterMark</var> , <var> sizeAlgorithm</var> , <var> pull</var> , and <var> cancel</var> .
4915
-
4916
- <p class="note no-backref"> This construction operation will not throw an exception.
4721
+ <li><p> Let <var> stream</var> be the result of <a for=ReadableStream>creating</a> a
4722
+ {{ReadableStream}} with <a for=ReadableStream/create><var>pullAlgorithm</var></a> set to
4723
+ <var> pullAlgorithm</var> , <a for=ReadableStream/create><var>cancelAlgorithm</var></a> set to
4724
+ <var> cancelAlgorithm</var> , <a for=ReadableStream/create><var>highWaterMark</var></a> set to
4725
+ <var> highWaterMark</var> , and <a for=ReadableStream/create><var>sizeAlgorithm</var></a> set to
4726
+ <var> sizeAlgorithm</var> .
4917
4727
4918
4728
<li>
4919
4729
<p> Run these steps, but <a>abort when</a> the ongoing fetch is <a for=fetch>terminated</a> :
@@ -4990,20 +4800,20 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b
4990
4800
<li><p> If <var> bytes</var> is failure, then <a lt=terminated for=fetch>terminate</a> the
4991
4801
ongoing fetch.
4992
4802
4993
- <li><p> <a for=ReadableStream>Enqueue bytes </a> given <var> bytes </var> and
4994
- <var> stream</var> .
4803
+ <li><p> <a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
4804
+ containing <var> bytes </var> into <var> stream</var> .
4995
4805
4996
4806
<li><p> If <var> stream</var> is <a for=ReadableStream>errored</a> , then
4997
4807
<a lt=terminated for=fetch>terminate</a> the ongoing fetch.
4998
4808
4999
- <li><p> If <var> stream</var> doesn't <a lt=" need more data" for=ReadableStream>need more
5000
- data</a> and <var> request</var> 's <a>synchronous flag</a> is unset, ask the user agent to
4809
+ <li><p> If <var> stream</var> doesn't <a for=ReadableStream> need more data</a> and
4810
+ <var> request</var> 's <a>synchronous flag</a> is unset, ask the user agent to
5001
4811
<a for=fetch>suspend</a> the ongoing fetch.
5002
4812
</ol>
5003
4813
5004
4814
<li><p> Otherwise, if the bytes transmission for <var> response</var> 's message body is done
5005
4815
normally and <var> stream</var> is <a for=ReadableStream>readable</a> , then
5006
- <a abstract-op >close</a> <var> stream</var> and abort these in-parallel steps.
4816
+ <a for=ReadableStream >close</a> <var> stream</var> and abort these in-parallel steps.
5007
4817
</ol>
5008
4818
</ol>
5009
4819
@@ -5019,12 +4829,13 @@ Range Requests</cite>. [[HTTP-RANGE]] However, this is not widely supported by b
5019
4829
<ol>
5020
4830
<li><p> Set <var> response</var> 's <a for=response>aborted flag</a> .
5021
4831
5022
- <li><p> If <var> stream</var> is <a for=ReadableStream>readable</a> , <a abstract-op>error</a>
5023
- <var> stream</var> with an "<code> <a exception>AbortError</a> </code> " {{DOMException}} .
4832
+ <li><p> If <var> stream</var> is <a for=ReadableStream>readable</a> ,
4833
+ <a for=ReadableStream>error</a> <var> stream</var> with an
4834
+ "<code> <a exception>AbortError</a> </code> " {{DOMException}} .
5024
4835
</ol>
5025
4836
5026
4837
<li><p> Otherwise, if <var> stream</var> is <a for=ReadableStream>readable</a> ,
5027
- <a abstract-op >error</a> <var> stream</var> with a {{TypeError}} .
4838
+ <a for=ReadableStream >error</a> <var> stream</var> with a {{TypeError}} .
5028
4839
5029
4840
<li><p> If <var> connection</var> uses HTTP/2, then transmit an <code> RST_STREAM</code> frame.
5030
4841
@@ -5673,7 +5484,7 @@ these steps:
5673
5484
5674
5485
<ol>
5675
5486
<li><p> Let <var> stream</var> be <var> object</var> if <var> object</var> is a {{ReadableStream}}
5676
- object; otherwise the result of <a>constructing a <code> ReadableStream</code> object </a> .
5487
+ object; otherwise the result of <a for= ReadableStream>creating </a> a {{ReadableStream}} .
5677
5488
5678
5489
<li><p> Let <var> Content-Type</var> be null.
5679
5490
@@ -5742,10 +5553,10 @@ these steps:
5742
5553
5743
5554
<ol>
5744
5555
<li><p> Whenever one or more bytes are available and <var> stream</var> is not
5745
- <a for=ReadableStream>errored</a> , <a for=ReadableStream>enqueue bytes </a> given the available
5746
- bytes and <var> stream</var> .
5556
+ <a for=ReadableStream>errored</a> , <a for=ReadableStream>enqueue</a> a {{Uint8Array}} wrapping an
5557
+ {{ArrayBuffer}} containing the available bytes into <var> stream</var> .
5747
5558
5748
- <li><p> When running <var> action</var> is done, <a abstract-op >close</a> <var> stream</var> .
5559
+ <li><p> When running <var> action</var> is done, <a for=ReadableStream >close</a> <var> stream</var> .
5749
5560
</ol>
5750
5561
5751
5562
<li><p> Let <var> body</var> be a <a for=/>body</a> whose <a for=body>stream</a> is
@@ -5889,12 +5700,11 @@ the associated steps:
5889
5700
<li><p> Let <var> stream</var> be <var> object</var> 's <a for=Body>body</a>' s
5890
5701
<a for=body>stream</a> .
5891
5702
5892
- <li><p> Let <var> reader</var> be the result of
5893
- <a lt="get a reader" for=ReadableStream>getting a reader</a> from <var> stream </var> . If that
5894
- threw an exception, then return <a>a promise rejected with</a> that exception.
5703
+ <li><p> Let <var> reader</var> be the result of <a for=ReadableStream>getting a reader</a> from
5704
+ <var> stream </var> . If that threw an exception, then return <a>a promise rejected with</a> that
5705
+ exception.
5895
5706
5896
- <li><p> Set <var> promise</var> to the result of
5897
- <a lt="read all bytes" for=ReadableStream>reading all bytes</a> from <var> stream</var> with
5707
+ <li><p> Set <var> promise</var> to the result of <a for=ReadableStream>reading all bytes</a> from
5898
5708
<var> reader</var> .
5899
5709
</ol>
5900
5710
@@ -6460,28 +6270,9 @@ constructor steps are:
6460
6270
6461
6271
<!-- Any steps after this must not throw. -->
6462
6272
6463
- <li>
6464
- <p> If <var> inputBody</var> is <var> body</var> and <var> inputBody</var> is non-null, then:
6465
-
6466
- <ol>
6467
- <li><p> Let <var> ws</var> and <var> rs</var> be the <a>writable side</a> and <a>readable side</a>
6468
- of an <a>identity transform stream</a> , respectively.</li>
6469
-
6470
- <li>
6471
- <p> Let <var> promise</var> be the result of calling
6472
- <a abstract-op>ReadableStreamPipeTo</a> (<var> inputBody</var> , <var> ws</var></var> , false,
6473
- false, false, undefined).
6474
-
6475
- <p class="note no-backref"> This makes <var> inputBody</var> 's <a for=body>stream</a>
6476
- <a for=ReadableStream>locked</a> and <a for=ReadableStream>disturbed</a> immediately.
6477
- </li>
6478
-
6479
- <li><p> Set <var> promise</var> .\[[PromiseIsHandled]] </var> to true.
6480
-
6481
- <li><p> Set <var> body</var> to a new <a for=/>body</a> whose <a for=body>stream</a> is
6482
- <var> rs</var> , whose <a for=body>source</a> is <var> inputBody</var> 's <a for=body>source</a> , and
6483
- whose <a for=body>total bytes</a> is <var> inputBody</var> 's <a for=body>total bytes</a> .
6484
- </ol>
6273
+ <li><p> If <var> inputBody</var> is <var> body</var> and <var> inputBody</var> is non-null, then set
6274
+ <var> body</var> to the result of <a for=ReadableStream>creating a proxy</a> for
6275
+ <var> inputBody</var> .
6485
6276
6486
6277
<li><p> Set <a>this</a> 's <a for=Request>request</a>' s <a for=request>body</a> to <var> body</var> .
6487
6278
@@ -6881,8 +6672,8 @@ method steps are:
6881
6672
<li><p> Let <var> response</var> be <var> responseObject</var> 's <a for=Response>response</a> .
6882
6673
6883
6674
<li><p> If <var> response</var> 's <a for=response>body</a> is not null and is
6884
- <a for=ReadableStream>readable</a> , then <a for=ReadableStream abstract-op >error</a>
6885
- <var> response </var> 's < a for=response>body</a> with <var> error</var> .
6675
+ <a for=ReadableStream>readable</a> , then <a for=ReadableStream>error</a> <var> response </var> 's
6676
+ <a for=response>body</a> with <var> error</var> .
6886
6677
</ol>
6887
6678
6888
6679
0 commit comments