Re: [whatwg/streams] Fix tee() incorrectly closing before enqueuing to the second branch (#1172)

> Are there any other issues with the reentrancy here?

No, I don't think there are. Only `Enqueue()` and `RespondWithNewView()` can perform `CallPullIfNeeded()`, and those are only used inside the chunk steps. (Yes, there's a `RespondWithNewView()` inside the close steps of `ReadableByteStreamTee`, but that's *after* we've already called `close()` so it never does `CallPullIfNeeded()`.)

> Would it better to avoid the reentrancy by adding even more microtasks?

Nah, I prefer it this way. Adding more microtasks could make these sorts of bugs *less obvious* and even *more difficult* to debug. I also feel like the stream specification *should* try to do as much as possible within the same microtask, even if that means dealing with reentrancy.

-- 
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/1172#issuecomment-940211444

Received on Monday, 11 October 2021 17:19:27 UTC