-
Notifications
You must be signed in to change notification settings - Fork 312
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
should document.open() inherit the controller? #1313
Comments
Aside: is the controller associated with a document or a Window object? I'd argue for preserving it. The less we reset during |
No. The service worker controller is part of the environment: https://html.spec.whatwg.org/#concept-environment-active-service-worker Edit: The "no" is to the question about document. Its part of the window since its associated with the environment (I believe). |
Okay, note that the global never changes with initial |
Right. We have a related issue to the controller inheritance for about:blank when the final load is not controlled: I don't think it impact this, but wanted to mention it as a current issue with inheritance. |
From a developer's point of view, I believe most of developer want to keep current environment if they wrote At lease, all the global vars/functions are preserved, and the code may depend on the inherit behavior if they depend on some features in the global env. For me, the global env should include both window & service worker, but I don't read the specs deeply, maybe mismatched with that. |
What should happen if the current window is controlled by a service worker and script then calls
document.open()
? Should the service worker controller by inherited or not?Per the html spec a new window should be created for
document.open()
. AFAIK, though, only firefox implements this and there is some discussion around aligning with the behavior where the window is preserved. @annevk has been looking at this recently.Even with that in mind, though, should the controller be preserved or cleared?
I wrote a demo here:
https://sw-document-open.glitch.me/
The iframe shows its controller after the
document.open()
. You can also open the console to see if the "dynamic.js" script load inserted by thedocument.write()
is intercepted.Results are:
What is the desired behavior? My gut feeling is that it should probably be inherited similar to what we do for about:blank iframes, etc.
The text was updated successfully, but these errors were encountered: