Re: [streams] Change the model for ReadableStream to have async read() (#288)

> -        } else if (ds === 'waiting') {
> -          if (source.state === 'readable') {
> -            Promise.race([source.closed, dest.ready]).then(doPipe, doPipe);
> -          } else if (source.state === 'waiting') {
> -            Promise.race([source.ready, dest.ready]).then(doPipe);
> -          } else if (source.state === 'errored') {
> -            source.closed.catch(abortDest);
> -          } else if (source.state === 'closed') {
> -            closeDest();
> -          }
> -        } else if (ds === 'errored' && (source.state === 'readable' || source.state === 'waiting')) {
> -          dest.closed.catch(cancelSource);
> -        } else if ((ds === 'closing' || ds === 'closed') &&
> -            (source.state === 'readable' || source.state === 'waiting')) {
> -          cancelSource(new TypeError('destination is closing or closed and cannot be piped to anymore'));
> +      Promise.all([source.read(), dest.ready]).then(([chunk]) => {

dest.ready resolves even when dest is errored. Need to handle it? The fulfillment callback set at L97 will be run first, but this is also run, right?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/288/files#r25864784

Received on Thursday, 5 March 2015 14:02:21 UTC