[whatwg/fetch] Streams and fetches that outlive the environment settings object (#411)

Spinning off from the discussion in https://github.com/whatwg/fetch/pull/388#issuecomment-248290780. /cc @yutakahirano 

I am not actually sure this is a problem. Note that JS objects can outlive their realm, e.g.

```html
<!DOCTYPE html>
<iframe srcdoc="<script>window.hello = {};</script>"></iframe>
<script>
const hello = frames[0].hello;
frames[0].location.href = "http://example.com/":
// `hello` is still a valid object
</script>
```

So is there any issue with this also being the case for streams that act as bodies?

One might think there is a problem with the object creation done by various stream operations. But no, that works fine too. Extend the above:

```js
const ObjectFromDeadFrame = hello.constructor;
const anotherObjectCreatedInDeadRealm = new ObjectFromDeadFrame();
```

I guess it might be accurate to say the realm isn't destroyed as long as someone holds a reference to it. You could still collect various things, e.g. the `Document` object and so on. But all the stuff streams needs to function is still there.

-- 
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/issues/411

Received on Friday, 4 November 2016 20:52:44 UTC