Title: [92920] branches/safari-534.51-branch

Diff

Modified: branches/safari-534.51-branch/LayoutTests/ChangeLog (92919 => 92920)


--- branches/safari-534.51-branch/LayoutTests/ChangeLog	2011-08-12 05:10:23 UTC (rev 92919)
+++ branches/safari-534.51-branch/LayoutTests/ChangeLog	2011-08-12 05:12:28 UTC (rev 92920)
@@ -1,5 +1,25 @@
 2011-08-11  Lucas Forschler  <[email protected]>
 
+    Merged 91044
+
+    2011-07-14  Adam Barth  <[email protected]>
+
+            The beforeload event allows tracking URI changes in a frame
+            https://bugs.webkit.org/show_bug.cgi?id=64482
+
+            Reviewed by Nate Chapin.
+
+            Test whether the beforeload event is fired for various kinds of redirects.
+
+            * http/tests/security/beforeload-iframe-client-redirect-expected.txt: Added.
+            * http/tests/security/beforeload-iframe-client-redirect.html: Added.
+            * http/tests/security/beforeload-iframe-server-redirect-expected.txt: Added.
+            * http/tests/security/beforeload-iframe-server-redirect.html: Added.
+            * http/tests/security/resources/post-done.html: Added.
+            * http/tests/security/resources/client-redir.html: Added.
+
+2011-08-11  Lucas Forschler  <[email protected]>
+
     Merged 90595
 
     2011-07-07  Gavin Peters  <[email protected]>

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 15: http://127.0.0.1:8000/security/resources/client-redir.html?url=""
+This test produces output in the console. Only the initial URL should be logged. 

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,16 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+window.addEventListener('message', function(evt) {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}, false);
+</script>
+This test produces output in the console.  Only the initial URL should be logged.
+<iframe
+  src=""
+  _onbeforeload_="console.log(event.url)">
+</iframe>

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 15: http://127.0.0.1:8000/security/resources/redir.php?url=""
+This test produces output in the console. Only the initial URL should be logged. 

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,16 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+window.addEventListener('message', function(evt) {
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}, false);
+</script>
+This test produces output in the console.  Only the initial URL should be logged.
+<iframe
+  src=""
+  _onbeforeload_="console.log(event.url)">
+</iframe>

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/client-redir.html (from rev 91044, trunk/LayoutTests/http/tests/security/resources/client-redir.html) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/client-redir.html	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/client-redir.html	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,3 @@
+<script>
+location.href = ""
+</script>

Copied: branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/post-done.html (from rev 91044, trunk/LayoutTests/http/tests/security/resources/post-done.html) (0 => 92920)


--- branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/post-done.html	                        (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/http/tests/security/resources/post-done.html	2011-08-12 05:12:28 UTC (rev 92920)
@@ -0,0 +1,4 @@
+<script>
+top.postMessage('done', '*');
+</script>
+This frame sends a 'done' message to the top window.

Modified: branches/safari-534.51-branch/Source/WebCore/ChangeLog (92919 => 92920)


--- branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-12 05:10:23 UTC (rev 92919)
+++ branches/safari-534.51-branch/Source/WebCore/ChangeLog	2011-08-12 05:12:28 UTC (rev 92920)
@@ -1,5 +1,26 @@
 2011-08-11  Lucas Forschler  <[email protected]>
 
+    Merged 91044
+
+    2011-07-14  Adam Barth  <[email protected]>
+
+            The beforeload event allows tracking URI changes in a frame
+            https://bugs.webkit.org/show_bug.cgi?id=64482
+
+            Reviewed by Nate Chapin.
+
+            Tests: http/tests/security/beforeload-iframe-client-redirect.html
+                   http/tests/security/beforeload-iframe-server-redirect.html
+
+            Only dispatch the beforeload event for a frame if we haven't yet
+            committed our first real load.  The URL that we send to our parent will
+            be the same URL the parent seens in the src attribute.
+
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::loadWithDocumentLoader):
+
+2011-08-11  Lucas Forschler  <[email protected]>
+
     Merged 91040
 
     2011-07-14  Darin Adler  <[email protected]>

Modified: branches/safari-534.51-branch/Source/WebCore/loader/FrameLoader.cpp (92919 => 92920)


--- branches/safari-534.51-branch/Source/WebCore/loader/FrameLoader.cpp	2011-08-12 05:10:23 UTC (rev 92919)
+++ branches/safari-534.51-branch/Source/WebCore/loader/FrameLoader.cpp	2011-08-12 05:12:28 UTC (rev 92920)
@@ -1578,7 +1578,13 @@
             loader->setTriggeringAction(NavigationAction(newURL, policyChecker()->loadType(), isFormSubmission));
 
         if (Element* ownerElement = m_frame->ownerElement()) {
-            if (!ownerElement->dispatchBeforeLoadEvent(loader->request().url().string())) {
+            // We skip dispatching the beforeload event if we've already
+            // committed a real document load because the event would leak
+            // subsequent activity by the frame which the parent frame isn't
+            // supposed to learn. For example, if the child frame navigated to
+            // a new URL, the parent frame shouldn't learn the URL.
+            if (!m_stateMachine.committedFirstRealDocumentLoad()
+                && !ownerElement->dispatchBeforeLoadEvent(loader->request().url().string())) {
                 continueLoadAfterNavigationPolicy(loader->request(), formState, false);
                 return;
             }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to