Skip to content

Commit 4502481

Browse files
authored
Editorial: use "pull from bytes" algorithm
Introduced in whatwg/streams#1263. Fixes #1610.
1 parent ca10f49 commit 4502481

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

fetch.bs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6122,7 +6122,7 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
61226122
</ol>
61236123

61246124
<li>
6125-
<p>Let |buffer| be an empty buffer that can have bytes appended to it.
6125+
<p>Let |buffer| be an empty [=byte sequence=].
61266126

61276127
<p class="note">This represents an internal buffer inside the network layer of the user agent.
61286128

@@ -6146,28 +6146,7 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
61466146
[=task destination=].
61476147

61486148
<ol>
6149-
<li><p>Let |available| be the size of |buffer|.
6150-
6151-
<li><p>Let |desiredSize| be |available|.
6152-
6153-
<li><p>If |stream|'s [=ReadableStream/current BYOB request view=] is non-null, then set
6154-
|desiredSize| to |stream|'s [=ReadableStream/current BYOB request view=]'s
6155-
[=BufferSource/byte length=].
6156-
6157-
<li><p>Let |extractSize| be the smaller value of |available| and |desiredSize|.
6158-
6159-
<li><p>Let <var>bytes</var> be the result of extracting |extractSize| of bytes from
6160-
<var>buffer</var>.
6161-
6162-
<li><p>If |stream|s [=ReadableStream/current BYOB request view=] is non-null, then
6163-
[=ArrayBufferView/write=] |bytes| into |stream|'s
6164-
[=ReadableStream/current BYOB request view=], and set |view| to |stream|'s
6165-
[=ReadableStream/current BYOB request view=].
6166-
6167-
<li>Otherwise, set |view| to the result of [=ArrayBufferView/create|creating=] a
6168-
{{Uint8Array}} from |bytes| in |stream|'s [=relevant Realm=].
6169-
6170-
<li><p>[=ReadableStream/Enqueue=] |view| into |stream|.
6149+
<li><p>[=ReadableStream/Pull from bytes=] |buffer| into |stream|.
61716150

61726151
<li><p>If |stream| is [=ReadableStream/errored=], then [=fetch controller/terminate=]
61736152
|fetchParams|'s [=fetch params/controller=].

0 commit comments

Comments
 (0)