Re: [whatwg/fetch] Be clearer about how Fetch creates ReadableStreams. (#781)

ricea commented on this pull request.



>  
- <li><p>Set <var>init</var>["cancel"] to a function that runs <var>cancel</var> if
- <var>cancel</var> is given.
+ <dl class=switch>
+ <dt>If <var>pull</var> is given
+ <dd>the result of [=promise-calling=] <var>pull</var>().

@domfarolino Possibly https://github.com/w3ctag/promises-guide/issues/52.

I know of one trap in there: because [aggregating promises](https://www.w3.org/2001/tag/doc/promises-guide#aggregating-promises) uses `Promise.all()` it calls the current (_not_ original) value of `Promise.reject()` which may have been replaced. This makes it unsafe to use in algorithms that are not re-entrant or are otherwise vulnerable to unexpected JS execution.There may be other traps I don't know about.

Having said that, we use it in the streams standard and I think it is fine if you use it with care.

-- 
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/fetch/pull/781#discussion_r208787036

Received on Thursday, 9 August 2018 01:55:30 UTC