[ServiceWorker] What should happen when we call response.text() and response.clone()? (#568)

In the current spec, we don't check the `used flag` of the response when `response.clone()` is called.
So we can call `response.text()` and `response.clone()` synchronously.

But `response.text()` starts reading the all stream of the response in parallel, and `clone()` creates a tee of the response.
I think these two operations conflict with each other.

To handle this conflict, we have two options.
1. Rejects the promise of ‘text()‘ when ‘clone()‘ is called. -> "error 1"
2. Throws exceptions when ‘clone()‘ is called if the `used flag` is set. -> "error2"

```JavaScript
fetch("/").then(function(response){
    response.text()
      .then(function(t){
          console.log(t);
        })
      .catch(function(){
          console.log("error 1");
        });
    try {
      response.clone();
    } catch (e) {
      console.log("error 2");
    }
  })
```

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

Received on Tuesday, 25 November 2014 11:06:10 UTC