Re: [whatwg/streams] ReadableStreamClose with async iterator and pending read requests errors (#1100)

@domenic I did have a look. I see one possible improvement, but it's debatable.

We could move the "resolve/reject `reader.[[closedPromise]]`" steps in [ReadableStreamClose](https://streams.spec.whatwg.org/commit-snapshots/039780837354e94c461749d3be82a2ccb16c99c1/#readable-stream-close) and [ReadableStreamError](https://streams.spec.whatwg.org/commit-snapshots/039780837354e94c461749d3be82a2ccb16c99c1/#readable-stream-error) **before** the loops that call the close/error steps of each read request. This makes the behavior a bit more predictable: the closed promise *always* becomes resolved or rejected first, regardless of what the closed/error steps do.

Although we would still reject **both** the `read()` and `closed` promises in ReadableStreamClose, the relative order of these rejections would change. This would affect at least [one WPT test](https://github.com/web-platform-tests/wpt/blob/887350c2f46def5b01c4dd1f8d2eee35dfb9c5bb/streams/readable-streams/general.any.js#L194-L225), since it asserts that the rejection handler for `read()` is called before the rejection handler for `closed`. I'm not sure how important this really is...? 🤷

-- 
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/issues/1100#issuecomment-759102388

Received on Tuesday, 12 January 2021 23:29:58 UTC