-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Sort out window.opener behavior when a window.open with target targets an existing window #2636
Comments
I'm pretty sure that Gecko just unconditionally sets .opener when window.open targets an existing window, but it looks like Blink and WebKit does something slightly different, given that http://w3c-test.org/html/browsers/windows/browsing-context-names/choose-_parent-003.html manages to pass there. @RByers do you know who would know what the actual Chrome behavior is here? |
Hmm, not sure offhand. @foolip @dominiccooney any ideas who might know or could dig into this? |
I did try poking through code myself a bit, but got slightly lost in all the virtual SetOpener overloads and such. ;) |
Probably not, though I have no idea what browsers actually do in practice. :( |
This seems to be special to
Only the window.open link will give the frame a non-null This probably needs to be solved together with #313 (comment) to see if "disowning" is limited to auxiliary browsing contexts or not. |
If I make |
I think some browsers have recently changed, or considered changing, whether targeted |
That's #4078 I hope, which affects |
That's part of it, but I thought there was some discussion about whether targeted |
Some initial work to make introducing browsing context groups (see whatwg#4198) easier. Fixes whatwg#2636 by making opener browsing context more generally applicable and making window.open() set it. Fixes whatwg#2645 by removing creator browsing context and explicitly passing in the creator document. Tests: web-platform-tests/wpt#15078.
Some initial work to make introducing browsing context groups (see whatwg#4198) easier. Fixes whatwg#2636 by making opener browsing context more generally applicable and making window.open() set it. Fixes whatwg#2645 by removing creator browsing context and explicitly passing in the creator document. Tests: web-platform-tests/wpt#15078.
Per spec, unless pages set window.opener it should only return non-null for auxiliary browsing contexts and should be immutable on auxiliary browsing contexts.
Here are some testcases for what browsers actually do. First:
Load it in a new window you open from the browser UI, click the "check opener" button, click the "do open" button, click the "check opener" button. Per spec it should alert "null false" both times. In Firefox, Chrome, and Safari the second alert does NOT alert "null false" and instead alerts "[object Window] true". In Edge both alerts alert "undefined false". Live testcase at http://web.mit.edu/bzbarsky/www/testcases/window-opener/open-targeting-self.html
Second:
where open-targeting-self.html is the document from the first testcase. Behavior is the same as for the first testcase. So it's not a matter of opener only getting dynamically updated for toplevel windows; we can get nested browsing contexts which claim to have an opener in Firefox, Chrome, and Safari. Live testcase at http://web.mit.edu/bzbarsky/www/testcases/window-opener/open-targeting-subframe.html
Third:
Click the "do open" link, then follow the steps from the first testcase in the resulting window. Per spec, second alert should be "[object Window] false" but it's "[object Window] true" in Firefox, Chrome, and Safari. Live testcase at http://web.mit.edu/bzbarsky/www/testcases/window-opener/open-targeting-new.html
I'm pretty worried about compat fallout from trying to do the spec behavior here.
The text was updated successfully, but these errors were encountered: