@@ -5985,25 +5985,73 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
5985
5985
<li><p> Return the <a for=/>appropriate network error</a> for <var> fetchParams</var> .
5986
5986
</ol>
5987
5987
5988
- <li><p> Let <var> pullAlgorithm</var> be an algorithm that <a lt=resumed for=fetch>resumes</a> the
5989
- ongoing fetch if it is <a lt=suspend for=fetch>suspended</a> .
5988
+ <li>
5989
+ <p> Let |buffer| be an empty buffer that can have bytes appended to it.
5990
+
5991
+ <p class="note"> This represents an internal buffer inside the network layer of the user agent.
5992
+
5993
+ <li>
5994
+ <p> Let |pullAlgorithm| be the followings steps:
5995
+
5996
+ <ol>
5997
+ <li><p> Let |promise| be [=a new promise=] .
5998
+
5999
+ <li>
6000
+ <p> Run the following steps [=in parallel=] :
6001
+
6002
+ <ol>
6003
+ <li><p> If the size of |buffer| is smaller than a lower limit chosen by the user agent and the
6004
+ ongoing fetch is [=fetch/suspend|suspended=] , [=fetch/resumed|resume=] the fetch.
6005
+
6006
+ <li><p> Wait until |buffer| is not empty.
6007
+
6008
+ <li>
6009
+ <p> [=Queue a fetch task=] to run the following steps, with |fetchParams|'s
6010
+ [=task destination=] .
6011
+
6012
+ <ol>
6013
+ <li><p> Let |available| be the size of |buffer|.
6014
+
6015
+ <li><p> Let |desiredSize| be |available|.
6016
+
6017
+ <li><p> If |stream|'s [=ReadableStream/current BYOB request view=] is non-null, then set
6018
+ |desiredSize| to |stream|'s [=ReadableStream/current BYOB request view=]' s
6019
+ [=BufferSource/byte length=] .
6020
+
6021
+ <li><p> Let |extractSize| be the smaller value of |available| and |desiredSize|.
6022
+
6023
+ <li><p> Let <var> bytes</var> be the result of extracting |extractSize| of bytes from
6024
+ <var> buffer</var> .
6025
+
6026
+ <li><p> If |stream|s [=ReadableStream/current BYOB request view=] is non-null, then
6027
+ [=ArrayBufferView/write=] |bytes| into |stream|'s
6028
+ [=ReadableStream/current BYOB request view=] , and set |view| to |stream|'s
6029
+ [=ReadableStream/current BYOB request view=] .
6030
+
6031
+ <li> Otherwise, set |view| to the result of [=ArrayBufferView/create|creating=] a
6032
+ {{Uint8Array}} from |bytes| in |stream|'s [=relevant Realm=] .
6033
+
6034
+ <li><p> [=ReadableStream/Enqueue=] |view| into |stream|.
6035
+
6036
+ <li><p> If |stream| is [=ReadableStream/errored=] , then [=fetch controller/terminate=]
6037
+ |fetchParams|'s [=fetch params/controller=] .
6038
+
6039
+ <li><p> [=/Resolve=] |promise| with undefined.
6040
+ </ol>
6041
+ </ol>
6042
+
6043
+ <li><p> Return |promise|.
6044
+ </ol>
5990
6045
5991
6046
<li><p> Let <var> cancelAlgorithm</var> be an algorithm that <a for="fetch controller">aborts</a>
5992
6047
<var> fetchParams</var> 's <a for="fetch params">controller</a> with <var> reason</var> , given
5993
6048
<var> reason</var> .
5994
6049
5995
- <li><p> Let <var> highWaterMark</var> be a non-negative, non-NaN number, chosen by the user agent.
5996
-
5997
- <li><p> Let <var> sizeAlgorithm</var> be an algorithm that accepts a <a>chunk</a> object and returns
5998
- a non-negative, non-NaN, non-infinite number, chosen by the user agent.
5999
-
6000
6050
<li><p> Let <var> stream</var> be a <a>new</a> {{ReadableStream}} .
6001
6051
6002
- <li><p> <a for=ReadableStream>Set up</a> <var> stream</var> with
6003
- <a for="ReadableStream/set up"><var>pullAlgorithm</var></a> set to <var> pullAlgorithm</var> ,
6004
- <a for="ReadableStream/set up"><var>cancelAlgorithm</var></a> set to <var> cancelAlgorithm</var> ,
6005
- <a for="ReadableStream/set up"><var>highWaterMark</var></a> set to <var> highWaterMark</var> , and
6006
- <a for="ReadableStream/set up"><var>sizeAlgorithm</var></a> set to <var> sizeAlgorithm</var> .
6052
+ <li><p> [=ReadableStream/set up with byte reading support|Set up=] |stream| with byte reading
6053
+ support with <var> [=ReadableStream/set up/pullAlgorithm=] </var> set to |pullAlgorithm|,
6054
+ <var> [=ReadableStream/set up/cancelAlgorithm=] </var> set to |cancelAlgorithm|.
6007
6055
6008
6056
<li><p> Set <var> response</var> 's <a for=response>body</a> to a new <a for=/>body</a> whose
6009
6057
<a for=body>stream</a> is <var> stream</var> .
@@ -6057,15 +6105,10 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
6057
6105
<li><p> If <var> bytes</var> is failure, then <a for="fetch controller">terminate</a>
6058
6106
<var> fetchParams</var> 's <a for="fetch params">controller</a> .
6059
6107
6060
- <li><p> <a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
6061
- containing <var> bytes</var> into <var> stream</var> .
6062
-
6063
- <li><p> If <var> stream</var> is <a for=ReadableStream>errored</a> , then
6064
- <a for="fetch controller">terminate</a> <var> fetchParams</var> .'s
6065
- <a for="fetch params">controller</a> .
6108
+ <li><p> Append |bytes| to |buffer|.
6066
6109
6067
- <li><p> If <var> stream </var> doesn't <a for=ReadableStream>need more data</a> ask the user
6068
- agent to <a for =fetch>suspend</a> the ongoing fetch.
6110
+ <li><p> If the size of |buffer| is larger than an upper limit chosen by the user agent, ask
6111
+ the user agent to [ =fetch/suspend=] the ongoing fetch.
6069
6112
</ol>
6070
6113
6071
6114
<li><p> Otherwise, if the bytes transmission for <var> response</var> 's message body is done
@@ -6832,7 +6875,8 @@ steps:
6832
6875
running <var> object</var> 's <a for=Blob>get stream</a> .
6833
6876
6834
6877
<li><p> Otherwise, set <var> stream</var> to a <a>new</a> {{ReadableStream}} object, and
6835
- <a for=ReadableStream>set up</a> <var> stream</var> .
6878
+ [=ReadableStream/set up with byte reading support|set up=] <var> stream</var> with byte reading
6879
+ support.
6836
6880
6837
6881
<li><p> <a for=/>Assert</a> : <var> stream</var> is a {{ReadableStream}} object.
6838
6882
0 commit comments