Re: [ServiceWorker] Backpressure on fetch integrated with Streams (#452)

>> @domenic's idea needs a custom ReadableByteStream for FetchAPI, and a custom ExclusiveStreamReader for Fetch API because the standard ExclusiveStreamReader doesn't care about the customized read().

> I don't understand why? It needs a custom underlying source, but every type of stream has a custom underlying source, so a fetch body stream should too.
> 
> One way to phrase it (that's a bit more explicit than my code that you link to) is that the underlying source sets bodyUsed to true anytime it calls enqueue().

Let me confirm:

```
var response;
var p = fetch(...).then((res) => {
  response = res;
  return res.body.ready;
}).then(() => 
  // This is not generally true, but please assume this holds in this example.
  assert(response.body.state === 'readable');

  return response.text();
});
```

Will `p` be resolved, or rejected? `text()` is called after `enqueue()` is called, so it should be rejected, right?

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/452#issuecomment-70613949

Received on Tuesday, 20 January 2015 07:24:32 UTC