Re: [whatwg/fetch] Make response body streams readable byte streams (#1246)

@annevk commented on this pull request.

I personally prefer not using commas before and if there are only two "simple" things.

What I don't understand here is that you still get a fresh view if the BYOB view cannot be written into due to its size. Wouldn't an error or request for a new view be more appropriate? If the idea is to avoid allocations presumably you would not want such allocations to nevertheless happen silently sometimes?

> @@ -5423,8 +5426,19 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
          <li><p>If <var>bytes</var> is failure, then <a lt=terminated for=fetch>terminate</a> the
          ongoing fetch.
 
-         <li><p><a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
-         containing <var>bytes</var> into <var>stream</var>.
+         <li><p>Let <var>view</var> be null.
+
+         <li><p>If <var>stream</var>'s <a for=ReadableStream>current BYOB request view</a> is
+         non-null, and <var>bytes</var>'s <a for="byte sequence">length</a> is less than

```suggestion
         non-null and <var>bytes</var>'s <a for="byte sequence">length</a> is less than
```

> @@ -5423,8 +5426,19 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
          <li><p>If <var>bytes</var> is failure, then <a lt=terminated for=fetch>terminate</a> the
          ongoing fetch.
 
-         <li><p><a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}}
-         containing <var>bytes</var> into <var>stream</var>.
+         <li><p>Let <var>view</var> be null.
+
+         <li><p>If <var>stream</var>'s <a for=ReadableStream>current BYOB request view</a> is
+         non-null, and <var>bytes</var>'s <a for="byte sequence">length</a> is less than
+         <var>stream</var>'s <a for=ReadableStream>current BYOB request view</a>'s
+         <a for=BufferSource>byte length</a>, then set <var>view</var> to <var>stream</var>'s
+         <a for=ReadableStream>current BYOB request view</a>, and <a for=ArrayBufferView>write</a>

```suggestion
         <a for=ReadableStream>current BYOB request view</a> and <a for=ArrayBufferView>write</a>
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1246#pullrequestreview-709635050

Received on Monday, 19 July 2021 14:49:24 UTC