Re: [whatwg/fetch] Editorial: Amend body reading to use no-promise version (PR #1569)

@MattiasBuelens approved this pull request.

LGTM.

> Two thoughts:
> 
> 1. I don't understand how "read all bytes" works as it doesn't seem to yield to the event loop.

If the stream has unread chunks, the read loop of "read all bytes" will immediately process all of those without yielding. Afterwards, the read request from the read loop will sit in the reader's queue until *something else* calls ["enqueue"](https://streams.spec.whatwg.org/#readablestream-enqueue). This will synchronously call the "chunk steps" of that read request (through [step 3 in ReadableStreamDefaultControllerEnqueue](https://streams.spec.whatwg.org/commit-snapshots/f894acdd417926a2121710803cef593e15127964/#readable-stream-default-controller-enqueue)) and advance the read loop.

So indeed, we don't yield to any particular event loop, instead we assume that there's some other event loop out there that's calling "enqueue", and we run the "chunk steps" as part of that same call.



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

Message ID: <whatwg/fetch/pull/1569/review/1226075049@github.com>

Received on Wednesday, 21 December 2022 13:24:56 UTC