Setting Window.opener to null should disown its opener
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 04:47:31 +0000 (04:47 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 04:47:31 +0000 (04:47 +0000)
commitd115e7b4414e26d91b31abf24a7f01ee6ec8311b
treea156f6038d4801188f7c219d587706059506e12b
parent107a9908d8c334a10073939c019cf85ffa323663
Setting Window.opener to null should disown its opener
https://bugs.webkit.org/show_bug.cgi?id=181505
<rdar://problem/36443151>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Setting Window.opener to null should disown its opener as per:
- https://html.spec.whatwg.org/#dom-opener

With this change, tabs opened by clicking link inside Gmail no
longer have the Gmail window as opener.

Tests: fast/dom/Window/window-opener-set-to-null.html
       fast/dom/Window/window-opener-shadowing.html

* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::setOpener):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::disownOpener):
* page/DOMWindow.h:
* page/DOMWindow.idl:

LayoutTests:

Add layout test coverage.

* fast/dom/Window/window-opener-set-to-null-expected.txt: Added.
* fast/dom/Window/window-opener-set-to-null.html: Added.
* fast/dom/Window/window-opener-shadowing-expected.txt: Added.
* fast/dom/Window/window-opener-shadowing.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-opener-set-to-null-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-opener-set-to-null.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-opener-shadowing-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-opener-shadowing.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DOMWindow.h
Source/WebCore/page/DOMWindow.idl