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

Domenic, Yutaka,

So, finally, I'd like to confirm conclusion about `text()`, `respondWith()`, `fetch()`, etc. call on a `"closed"` Request/Response which was not empty initially.

----

IMO, it's strange if the result of `text()` call on a `"closed"` Response differs depending on the initial state of the Response. We should do either of the following:

1. Regardless of the initial state (empty or non-empty), we allow `text()` on a Response with a `"closed"` stream.
1. Have a flag in the Response indicating that the Response is "consumed", and disallow `text()` on a Response once the Response is "consumed".
1. Define "consumed" concept in the Streams API, and using it, disallow `text()` on a Response with a "consumed" stream. Rather than remembering and using the knowledge of the initial state, we define a virtual termination character `$`, put it in the queue and have some operation to consume it to explicitly mark the stream "consumed". I.e. an originally empty stream can also be "consumed".

(3) looks overkilling to me. I don't have strong opinion between (1) and (2).

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

Received on Wednesday, 28 January 2015 06:06:41 UTC