Title: [88086] branches/chromium/782
Revision
88086
Author
cev...@google.com
Date
2011-06-03 18:58:34 -0700 (Fri, 03 Jun 2011)

Log Message

Merge 88071
BUG=83743
Review URL: http://codereview.chromium.org/7058060

Modified Paths

Added Paths

Diff

Copied: branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval-expected.txt (from rev 88071, trunk/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval-expected.txt) (0 => 88086)


--- branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval-expected.txt	                        (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval-expected.txt	2011-06-04 01:58:34 UTC (rev 88086)
@@ -0,0 +1,3 @@
+CONSOLE MESSAGE: line 1: Unsafe _javascript_ attempt to access frame with URL about:blank from frame with URL about:blank. Domains, protocols and ports must match.
+
+This test passes if alert() is not called. 

Copied: branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval.html (from rev 88071, trunk/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval.html) (0 => 88086)


--- branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval.html	                        (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/xss-DENIED-contentWindow-eval.html	2011-06-04 01:58:34 UTC (rev 88086)
@@ -0,0 +1,17 @@
+<body>
+This test passes if alert() is not called.
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+i = document.body.appendChild(document.createElement("iframe"));
+f = frames[0].eval('(function(){location="_javascript_:alert(location)"})');
+i.src = ""
+i.addEventListener("load", f);
+i.addEventListener("load", function() {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+});
+</script>

Modified: branches/chromium/782/Source/WebCore/page/DOMWindow.cpp (88085 => 88086)


--- branches/chromium/782/Source/WebCore/page/DOMWindow.cpp	2011-06-04 01:55:51 UTC (rev 88085)
+++ branches/chromium/782/Source/WebCore/page/DOMWindow.cpp	2011-06-04 01:58:34 UTC (rev 88086)
@@ -1713,14 +1713,21 @@
     if (!protocolIsJavaScript(urlString))
         return false;
 
-    // FIXME: Is there some way to eliminate the need for a separate "activeWindow == this" check?
-    if (activeWindow == this)
-        return false;
+    // If m_frame->domWindow() != this, then |this| isn't the DOMWindow that's
+    // currently active in the frame and there's no way we should allow the
+    // access.
+    // FIXME: Remove this check if we're able to disconnect DOMWindow from
+    // Frame on navigation: https://bugs.webkit.org/show_bug.cgi?id=62054
+    if (m_frame->domWindow() == this) {
+        // FIXME: Is there some way to eliminate the need for a separate "activeWindow == this" check?
+        if (activeWindow == this)
+            return false;
 
-    // FIXME: The name canAccess seems to be a roundabout way to ask "can execute script".
-    // Can we name the SecurityOrigin function better to make this more clear?
-    if (activeWindow->securityOrigin()->canAccess(securityOrigin()))
-        return false;
+        // FIXME: The name canAccess seems to be a roundabout way to ask "can execute script".
+        // Can we name the SecurityOrigin function better to make this more clear?
+        if (activeWindow->securityOrigin()->canAccess(securityOrigin()))
+            return false;
+    }
 
     printErrorMessage(crossDomainAccessErrorMessage(activeWindow));
     return true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to