- From: Mattias Buelens <notifications@github.com>
- Date: Fri, 12 Jul 2019 14:23:13 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/1004/511037767@github.com>
Very interesting. Since both _preventAbort_ and _preventCancel_ are `true`, the list of actions in `ReadableStreamPipeTo`'s _abortAlgorithm_ is empty. The action passed to "shutdown with an action" consists of "waiting for all of the actions in _actions_". This is defined [here](https://www.w3.org/2001/tag/doc/promises-guide/#waiting-for-all). However, the steps in that algorithm do not account for the case where _promises_ is an empty list! It attaches a _fulfillmentHandler_ to every promise in _promises_, and checks whether we're done **only inside that handler**. But if no promises were passed in, then no handlers are attached and we never check whether we're done. The fix is obvious: if the list of promises passed to the "wait for all" algorithm is empty, then it should immediately call _successSteps_ with an empty list. I'll make a PR for [the reference implementation](https://github.com/whatwg/streams/blob/6f94580f6731d1e017c516af097d47c45aad1f56/reference-implementation/lib/helpers.js#L166) and [the polyfill](https://github.com/MattiasBuelens/web-streams-polyfill/blob/6e8a378c807e155b6921f0f498a49de5cdf2ed5b/src/lib/helpers.ts#L173), and I'll try to write a spec change for [the promises guide](https://github.com/w3ctag/promises-guide). -- 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/1004#issuecomment-511037767
Received on Friday, 12 July 2019 21:23:36 UTC