Re: [whatwg/streams] Support teeing readable byte streams (#1114)

@MattiasBuelens commented on this pull request.



> +       1. Perform ! [$ReadableStreamDefaultControllerError$](|branch1|.[=ReadableStream/[[controller]]=], |cloneResult|.\[[Value]]).
+       1. Perform ! [$ReadableStreamDefaultControllerError$](|branch2|.[=ReadableStream/[[controller]]=], |cloneResult|.\[[Value]]).
+       1. [=Resolve=] |cancelPromise| with ! [$ReadableStreamCancel$](|stream|, |cloneResult|.\[[Value]]).

Hmmm... actually, this part is wrong:
> `ReadableStreamDefaultControllerError` will call `readRequest.errorSteps(e)`, which could call both `branch1.cancel()` and `branch2.cancel()`.

After a branch is errored, you can no longer cancel it. Once we call `ReadableStreamDefaultControllerError` for `branch2`, we know that `cancel2Algorithm` can never be called and thus `canceled2` can never become true. So there's no re-entrancy risk and we don't need any extra checks. 😁

-- 
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/1114#discussion_r650588629

Received on Sunday, 13 June 2021 22:58:50 UTC