- From: Domenic Denicola <notifications@github.com>
- Date: Mon, 14 Sep 2020 12:27:08 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 14 September 2020 19:27:21 UTC
@domenic commented on this pull request. > + 1. Let |promise| be [=a new promise=]. + 1. Let |bytes| be an empty [=byte sequence=]. + 1. [=Read-loop=] given |reader|, |bytes|, and |promise|. + 1. Return |promise|. + + <div algorithm="read-loop"> + For the purposes of the above algorithm, to <dfn>read-loop</dfn> given |reader|, |bytes|, and + |promise|: + + 1. Let |readRequest| be a new [=read request=] with the following [=struct/items=]: + : [=read request/chunk steps=], given |chunk| + :: + 1. If |chunk| is not a {{Uint8Array}} object, [=reject=] |promise| with a {{TypeError}} and + abort these steps. + 1. Append the bytes represented by |chunk| to |bytes|. + 1. [=Read-loop=] given |reader|, |bytes|, and |promise|. Hmm. Given that there's already a note explaining that this might be implemented rather differently, I think it'd be best to make a note of the danger, and encourage implementations to mitigate it in a way that doesn't require "read all bytes" to delay for (number of chunks) microtasks. -- 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/streams/pull/1073#discussion_r488169080
Received on Monday, 14 September 2020 19:27:21 UTC