Diff
Copied: branches/chromium/782/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 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-client-redirect-expected.txt 2011-07-16 02:04:00 UTC (rev 91141)
@@ -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/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html) (0 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-client-redirect.html 2011-07-16 02:04:00 UTC (rev 91141)
@@ -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/chromium/782/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 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-server-redirect-expected.txt 2011-07-16 02:04:00 UTC (rev 91141)
@@ -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/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html (from rev 91044, trunk/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html) (0 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/beforeload-iframe-server-redirect.html 2011-07-16 02:04:00 UTC (rev 91141)
@@ -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/chromium/782/LayoutTests/http/tests/security/resources/client-redir.html (from rev 91044, trunk/LayoutTests/http/tests/security/resources/client-redir.html) (0 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/resources/client-redir.html (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/resources/client-redir.html 2011-07-16 02:04:00 UTC (rev 91141)
@@ -0,0 +1,3 @@
+<script>
+location.href = ""
+</script>
Copied: branches/chromium/782/LayoutTests/http/tests/security/resources/post-done.html (from rev 91044, trunk/LayoutTests/http/tests/security/resources/post-done.html) (0 => 91141)
--- branches/chromium/782/LayoutTests/http/tests/security/resources/post-done.html (rev 0)
+++ branches/chromium/782/LayoutTests/http/tests/security/resources/post-done.html 2011-07-16 02:04:00 UTC (rev 91141)
@@ -0,0 +1,4 @@
+<script>
+top.postMessage('done', '*');
+</script>
+This frame sends a 'done' message to the top window.
Modified: branches/chromium/782/Source/WebCore/loader/FrameLoader.cpp (91140 => 91141)
--- branches/chromium/782/Source/WebCore/loader/FrameLoader.cpp 2011-07-16 01:41:02 UTC (rev 91140)
+++ branches/chromium/782/Source/WebCore/loader/FrameLoader.cpp 2011-07-16 02:04:00 UTC (rev 91141)
@@ -1573,7 +1573,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;
}