Title: [211933] releases/WebKitGTK/webkit-2.14
Revision
211933
Author
[email protected]
Date
2017-02-09 00:54:21 -0800 (Thu, 09 Feb 2017)

Log Message

Merge r210112 - Bypass pop-up blocker from cross-origin or sandboxed frame
https://bugs.webkit.org/show_bug.cgi?id=166290
<rdar://problem/29742039>

Reviewed by Darin Adler.

Source/WebCore:

Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html
       fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html
       fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html

* page/DOMWindow.cpp:
(WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the
target frame to navigate with respect to the active document just as we do in WebCore::createWindow().

LayoutTests:

* fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame-expected.txt: Added.
* fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html: Added.
* fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2-expected.txt: Added.
* fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html: Added.
* fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt: Added.
* fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (211932 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2017-02-09 08:15:17 UTC (rev 211932)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog	2017-02-09 08:54:21 UTC (rev 211933)
@@ -1,3 +1,18 @@
+2016-12-22  Daniel Bates  <[email protected]>
+
+        Bypass pop-up blocker from cross-origin or sandboxed frame
+        https://bugs.webkit.org/show_bug.cgi?id=166290
+        <rdar://problem/29742039>
+
+        Reviewed by Darin Adler.
+
+        * fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame-expected.txt: Added.
+        * fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html: Added.
+        * fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2-expected.txt: Added.
+        * fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html: Added.
+        * fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt: Added.
+        * fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html: Added.
+
 2017-02-06  Carlos Garcia Campos  <[email protected]>
 
         Overlay scrolling with iframe-s broken

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame-expected.txt (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame-expected.txt	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 1: Unsafe _javascript_ attempt to initiate navigation for frame with URL 'about:blank' from frame with URL 'about:blank'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.
+
+ALERT: PASS
+ 

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setPopupBlockingEnabled(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+</script>
+</head>
+<body>
+<iframe name="A"></iframe>
+<iframe id="B" sandbox="allow-scripts allow-same-origin allow-popups"></iframe>
+<script>
+document.getElementById("B").contentWindow.eval('alert(window.open("about:blank", "A") ? "FAIL" : "PASS");');
+</script>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2-expected.txt (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2-expected.txt	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 1: Unsafe _javascript_ attempt to initiate navigation for frame with URL 'about:blank' from frame with URL 'about:blank'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.
+
+ALERT: PASS
+ 

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setPopupBlockingEnabled(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+</script>
+</head>
+<body>
+<iframe name="A"></iframe>
+<iframe id="B" sandbox="allow-scripts allow-same-origin allow-popups"></iframe>
+<script>
+document.getElementById("B").contentWindow.eval('alert(window.open.call(window.top, "about:blank", "A") ? "FAIL" : "PASS");');
+</script>
+</body>
+</html>

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame-expected.txt	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,4 @@
+CONSOLE MESSAGE: line 1: Unsafe _javascript_ attempt to initiate navigation for frame with URL 'about:blank' from frame with URL 'data:text/html,<script>alert(window.open('about:blank', 'A') ?%20'FAIL'%20:%20'PASS');%3C/script%3E'. The frame attempting navigation is neither same-origin with the target, nor is it the target's parent or opener.
+
+ALERT: PASS
+ 

Added: releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html (0 => 211933)


--- releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html	2017-02-09 08:54:21 UTC (rev 211933)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.setCanOpenWindows();
+    testRunner.setPopupBlockingEnabled(true);
+    testRunner.setCloseRemainingWindowsWhenComplete(true);
+}
+</script>
+</head>
+<body>
+<iframe name="A"></iframe>
+<iframe name="B" src="" 'A') ? 'FAIL' : 'PASS');</script>"></iframe>
+</body>
+</html>

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (211932 => 211933)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-02-09 08:15:17 UTC (rev 211932)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2017-02-09 08:54:21 UTC (rev 211933)
@@ -1,3 +1,19 @@
+2016-12-22  Daniel Bates  <[email protected]>
+
+        Bypass pop-up blocker from cross-origin or sandboxed frame
+        https://bugs.webkit.org/show_bug.cgi?id=166290
+        <rdar://problem/29742039>
+
+        Reviewed by Darin Adler.
+
+        Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html
+               fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html
+               fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html
+
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the
+        target frame to navigate with respect to the active document just as we do in WebCore::createWindow().
+
 2017-01-23  Gustavo Noronha Silva  <[email protected]>
 
         [GTK] asserting on unknown locale for hyphenation is wrong

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMWindow.cpp (211932 => 211933)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMWindow.cpp	2017-02-09 08:15:17 UTC (rev 211932)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/page/DOMWindow.cpp	2017-02-09 08:54:21 UTC (rev 211933)
@@ -2192,9 +2192,9 @@
 #endif
 
     if (!firstWindow.allowPopUp()) {
-        // Because FrameTree::find() returns true for empty strings, we must check for empty frame names.
+        // Because FrameTree::findFrameForNavigation() returns true for empty strings, we must check for empty frame names.
         // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker.
-        if (frameName.isEmpty() || !m_frame->tree().find(frameName))
+        if (frameName.isEmpty() || !m_frame->loader().findFrameForNavigation(frameName, activeDocument))
             return nullptr;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to