Re: [whatwg/streams] Reject pending reads when releasing reader (#1168)

@MattiasBuelens commented on this pull request.



> @@ -745,10 +751,11 @@ function ReadableStreamCancel(stream, reason) {
 
   const reader = stream._reader;
   if (reader !== undefined && ReadableStreamBYOBReader.isImpl(reader)) {
-    for (const readIntoRequest of reader._readIntoRequests) {
+    const readIntoRequests = reader._readIntoRequests;

This is needed for the default reader such that the async iterator's close steps: https://github.com/whatwg/streams/blob/be00afc855d403d91cc8a6335b80713100ca940e/reference-implementation/lib/ReadableStream-impl.js#L131-L132

do not call the error steps on the remaining read requests:
https://github.com/whatwg/streams/blob/be00afc855d403d91cc8a6335b80713100ca940e/reference-implementation/lib/abstract-ops/readable-streams.js#L970-L975

For consistency, I made the same change for BYOB readers. I'm not aware of any concrete bugs related to BYOB readers that this might solve. You'd need to find a case where the `closeSteps` of a read-into request can *synchronously* release the BYOB reader, and I don't think that ever happens.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1168#discussion_r778476614
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1168/review/844125447@github.com>

Received on Wednesday, 5 January 2022 00:41:20 UTC