Title: [99301] trunk
Revision
99301
Author
[email protected]
Date
2011-11-04 11:14:58 -0700 (Fri, 04 Nov 2011)

Log Message

Implement allow-popups for iframe@sandbox
https://bugs.webkit.org/show_bug.cgi?id=66505

Reviewed by Darin Adler.

Source/WebCore:

Enable allow-popups sandbox bit.  My previous patch attempted to
forward the sandbox bits during setOpener, but that interacted poorly
with out (internal) sandboxing of the initial document.  This patch
forwards the bits during createWindow, which is more targeted to the
case when a sandbox frame actually creates a new window.

* loader/FrameLoader.cpp:
(WebCore::createWindow):
* loader/PolicyChecker.cpp:
(WebCore::PolicyChecker::checkNewWindowPolicy):

LayoutTests:

Update test results to show that we now pass.

* http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control-expected.txt:
* http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html:
* http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html:
* http/tests/security/popup-allowed-by-sandbox-when-allowed-expected.txt:
* http/tests/security/popup-allowed-by-sandbox-when-allowed.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99300 => 99301)


--- trunk/LayoutTests/ChangeLog	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/ChangeLog	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,3 +1,18 @@
+2011-11-04  Adam Barth  <[email protected]>
+
+        Implement allow-popups for iframe@sandbox
+        https://bugs.webkit.org/show_bug.cgi?id=66505
+
+        Reviewed by Darin Adler.
+
+        Update test results to show that we now pass.
+
+        * http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control-expected.txt:
+        * http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html:
+        * http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html:
+        * http/tests/security/popup-allowed-by-sandbox-when-allowed-expected.txt:
+        * http/tests/security/popup-allowed-by-sandbox-when-allowed.html:
+
 2011-11-04  Anders Carlsson  <[email protected]>
 
         NPN_ConvertPoint plug-in test should be called from NPP_SetWindow

Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control-expected.txt (99300 => 99301)


--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control-expected.txt	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control-expected.txt	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,3 +1,4 @@
+ALERT: /PASS/
 To run this test outside of DumpRenderTree, please disable your popup blocker!
 
 If you change this test, please be sure to change popup-allowed-by-sandbox-is-sandboxed.html as well!

Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html (99300 => 99301)


--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed-control.html	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,6 +1,7 @@
 <script>
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
     layoutTestController.setCanOpenWindows(true);
     layoutTestController.setCloseRemainingWindowsWhenComplete(true);
 }

Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html (99300 => 99301)


--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-is-sandboxed.html	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,6 +1,7 @@
 <script>
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
     layoutTestController.setCanOpenWindows(true);
     layoutTestController.setCloseRemainingWindowsWhenComplete(true);
 }

Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed-expected.txt (99300 => 99301)


--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed-expected.txt	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed-expected.txt	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,4 +1,4 @@
-ALERT: FAIL
+ALERT: PASS
 To run this test outside of DumpRenderTree, please disable your popup blocker!
 
 

Modified: trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed.html (99300 => 99301)


--- trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed.html	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/LayoutTests/http/tests/security/popup-allowed-by-sandbox-when-allowed.html	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,6 +1,7 @@
 <script>
 if (window.layoutTestController) {
     layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
     layoutTestController.setCanOpenWindows(true);
     layoutTestController.setCloseRemainingWindowsWhenComplete(true);
 }

Modified: trunk/Source/WebCore/ChangeLog (99300 => 99301)


--- trunk/Source/WebCore/ChangeLog	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/Source/WebCore/ChangeLog	2011-11-04 18:14:58 UTC (rev 99301)
@@ -1,3 +1,21 @@
+2011-11-04  Adam Barth  <[email protected]>
+
+        Implement allow-popups for iframe@sandbox
+        https://bugs.webkit.org/show_bug.cgi?id=66505
+
+        Reviewed by Darin Adler.
+
+        Enable allow-popups sandbox bit.  My previous patch attempted to
+        forward the sandbox bits during setOpener, but that interacted poorly
+        with out (internal) sandboxing of the initial document.  This patch
+        forwards the bits during createWindow, which is more targeted to the
+        case when a sandbox frame actually creates a new window.
+
+        * loader/FrameLoader.cpp:
+        (WebCore::createWindow):
+        * loader/PolicyChecker.cpp:
+        (WebCore::PolicyChecker::checkNewWindowPolicy):
+
 2011-11-04  Kaustubh Atrawalkar  <[email protected]>
 
         Remove initMediaStreamEvent method

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (99300 => 99301)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-11-04 18:14:58 UTC (rev 99301)
@@ -3268,7 +3268,7 @@
     }
 
     // Sandboxed frames cannot open new auxiliary browsing contexts.
-    if (isDocumentSandboxed(openerFrame, SandboxNavigation))
+    if (isDocumentSandboxed(openerFrame, SandboxPopups))
         return 0;
 
     // FIXME: Setting the referrer should be the caller's responsibility.
@@ -3286,6 +3286,9 @@
         return 0;
 
     Frame* frame = page->mainFrame();
+
+    frame->loader()->forceSandboxFlags(openerFrame->loader()->sandboxFlags());
+
     if (request.frameName() != "_blank")
         frame->tree()->setName(request.frameName());
 

Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (99300 => 99301)


--- trunk/Source/WebCore/loader/PolicyChecker.cpp	2011-11-04 18:12:58 UTC (rev 99300)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp	2011-11-04 18:14:58 UTC (rev 99301)
@@ -93,7 +93,7 @@
 void PolicyChecker::checkNewWindowPolicy(const NavigationAction& action, NewWindowPolicyDecisionFunction function,
     const ResourceRequest& request, PassRefPtr<FormState> formState, const String& frameName, void* argument)
 {
-    if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxNavigation))
+    if (m_frame->document() && m_frame->document()->securityOrigin()->isSandboxed(SandboxPopups))
         return continueAfterNavigationPolicy(PolicyIgnore);
 
     m_callback.set(request, formState, frameName, action, function, argument);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to