Bug 134726 - window.opener shouldn't change even when the frame is navigated
Summary: window.opener shouldn't change even when the frame is navigated
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: https://lists.w3.org/Archives/Public/...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-08 09:17 PDT by Ryosuke Niwa
Modified: 2022-08-10 14:30 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2014-07-08 09:17:16 PDT
http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-July/297135.html
starting from http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/253865.html

When a window is opened by a frame A and then it's navigated to another page by frame B,
then the new window's opener should still point to A per the specification.
Comment 1 Bob Owen 2014-07-09 12:21:11 PDT
I think this might just be a matter of adding an |if (created) { }| around https://trac.webkit.org/browser/trunk/Source/WebCore/page/DOMWindow.cpp?rev=142755&order=name#L1887

Although, it could well be more complicated and involve more places in the code.
Comment 2 Sam Weinig 2014-07-09 12:32:07 PDT
(In reply to comment #0)
> http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-July/297135.html
> starting from http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/253865.html
> 
> When a window is opened by a frame A and then it's navigated to another page by frame B,
> then the new window's opener should still point to A per the specification.

I'm having a bit of rough time figuring out who is navigating who in this.  Can someone attach a test case?
Comment 3 Ryosuke Niwa 2014-07-09 12:35:06 PDT
(In reply to comment #2)
> (In reply to comment #0)
> > http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-July/297135.html
> > starting from http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-March/253865.html
> > 
> > When a window is opened by a frame A and then it's navigated to another page by frame B,
> > then the new window's opener should still point to A per the specification.
> 
> I'm having a bit of rough time figuring out who is navigating who in this.  Can someone attach a test case?

The test case is in http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2014-July/297135.html:

http://fiddle.jshell.net/t4sgd/show/

Chrome and Firefox alert "true"; IE alerts "false".  The spec says 
"false" should be alerted.

-Boris
Comment 4 Ryosuke Niwa 2016-04-11 00:32:18 PDT
Chris, did we fix this issue?
Comment 5 Chris Dumez 2016-04-11 08:37:31 PDT
(In reply to comment #4)
> Chris, did we fix this issue?

No we did not. The behavior is still the same in Safari Technology Preview. That said, no other browser (besides Edge) seems to have implemented this either.
Comment 6 Ryosuke Niwa 2016-04-11 13:27:02 PDT
Here's the test case:
https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Jul/0005.html
Comment 7 Ahmad Saleem 2022-08-08 16:47:38 PDT
Here are updated test results:

Test Case Link (Updated) - https://jsfiddle.net/t4sgd/show/

** Safari 15.6 on macOS 12.5 **

Clicking on "Click me first" leads to opening in about:blank in background and then clicking on "Click me second" leads to opening another about:blank in background but show "true" dialog

** Chrome Canary 106 **

Clicking on "Click me first" leads to opening in about:blank in foreground (have to focus back to test case) and then clicking on "Click me second" leads to opening another about:blank in foreground but show "true" dialog upon checking back on test case similar to Safari

** Firefox Nightly 105 **

Clicking on "Click me first" leads to opening in about:blank in foreground (have to focus back to test case) and then clicking on "Click me second" leads to opening another about:blank in foreground but show "true" dialog upon checking back on test case similar to Safari

___________

NOTE - All browsers show "true" for the test case but Safari open the iframe or tabs in background while other in foreground. It might be browser preference or settings but just wanted to share updated results. Thanks!
Comment 8 Ryosuke Niwa 2022-08-10 14:30:32 PDT
The spec has since changed to match Gecko / WebKit at this point.