Skip to content

Commit

Permalink
Ensure pipeTo() releases its reader correctly
Browse files Browse the repository at this point in the history
The user agent is allowed to use a default reader or a BYOB reader for the pipe, but we were always calling ReadableStreamDefaultReaderRelease in the finalize steps. This commit fixes the algorithm to we should use the appropriate release abstract operation corresponding to the chosen reader.

This was broken in d5f92d9.
  • Loading branch information
MattiasBuelens authored Jan 18, 2022
1 parent 3c6b8b3 commit 908cedd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,9 @@ The following abstract operations operate on {{ReadableStream}} instances at a h
* <dfn id="rs-pipeTo-finalize"><i>Finalize</i></dfn>: both forms of shutdown will eventually ask
to finalize, optionally with an error |error|, which means to perform the following steps:
1. Perform ! [$WritableStreamDefaultWriterRelease$](|writer|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. If |reader| [=implements=] {{ReadableStreamBYOBReader}}, perform
! [$ReadableStreamBYOBReaderRelease$](|reader|).
1. Otherwise, perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. If |signal| is not undefined, [=AbortSignal/remove=] |abortAlgorithm| from |signal|.
1. If |error| was given, [=reject=] |promise| with |error|.
1. Otherwise, [=resolve=] |promise| with undefined.
Expand Down

0 comments on commit 908cedd

Please sign in to comment.