Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streams and fetches that outlive the environment settings object #411

Closed
domenic opened this issue Nov 4, 2016 · 4 comments
Closed

Streams and fetches that outlive the environment settings object #411

domenic opened this issue Nov 4, 2016 · 4 comments

Comments

@domenic
Copy link
Member

domenic commented Nov 4, 2016

Spinning off from the discussion in #388 (comment). /cc @yutakahirano

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

<!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:

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.

@annevk
Copy link
Member

annevk commented Nov 7, 2016

Yeah, globals stay alive if someone holds a reference to them (though Edge might do something funky here); it's not necessarily ideal though.

@yutakahirano
Copy link
Member

When a request is made from a ReadableStream with an underlying source implemented by a developer, pull / cancel can be called after the realm destruction. @domenic, do you think it's OK as well?

@domenic
Copy link
Member Author

domenic commented Nov 8, 2016

It seems OK to me? Is there something problematic about it?

@yutakahirano
Copy link
Member

I see, sounds good. Thank you for clarifying.

@domenic domenic closed this as completed Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants