Title: [91583] trunk
Revision
91583
Author
[email protected]
Date
2011-07-22 12:01:56 -0700 (Fri, 22 Jul 2011)

Log Message

Source/WebCore: Don't treat child frame loads as back-forward navigations
after the load event fires. This can lead to loading
the wrong url in the child frame.
https://bugs.webkit.org/show_bug.cgi?id=64895

Reviewed by Mihai Parparita.

Test: fast/loader/child-frame-add-after-back-forward.html

* dom/Document.h: Drive-by FIXME.
* loader/DocumentLoader.h: Drive-by FIXME.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadURLIntoChildFrame):

LayoutTests: Test for https://bugs.webkit.org/show_bug.cgi?id=64895.

Reviewed by Mihai Parparita.

* fast/loader/child-frame-add-after-back-forward-expected.txt: Added.
* fast/loader/child-frame-add-after-back-forward.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91582 => 91583)


--- trunk/LayoutTests/ChangeLog	2011-07-22 18:42:42 UTC (rev 91582)
+++ trunk/LayoutTests/ChangeLog	2011-07-22 19:01:56 UTC (rev 91583)
@@ -1,3 +1,12 @@
+2011-07-22  Nate Chapin  <[email protected]>
+
+        Test for https://bugs.webkit.org/show_bug.cgi?id=64895.
+
+        Reviewed by Mihai Parparita.
+
+        * fast/loader/child-frame-add-after-back-forward-expected.txt: Added.
+        * fast/loader/child-frame-add-after-back-forward.html: Added.
+
 2011-07-22  Mark Hahnenberg  <[email protected]>
 
         Date.prototype.toISOString doesn't handle negative years or years > 9999 correctly.

Added: trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward-expected.txt (0 => 91583)


--- trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward-expected.txt	2011-07-22 19:01:56 UTC (rev 91583)
@@ -0,0 +1,8 @@
+main frame - has 1 onunload handler(s)
+main frame - has 1 onunload handler(s)
+Go forward then back.  
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+PASS

Added: trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward.html (0 => 91583)


--- trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/child-frame-add-after-back-forward.html	2011-07-22 19:01:56 UTC (rev 91583)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<script>
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpChildFramesAsText();
+}
+
+function navigate() {
+    if (window.eventSender) {
+        var a = document.getElementById("a");
+        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
+}
+function addChildFrame()
+{
+    if (!window.sessionStorage.getItem("childFrame")) {
+        window.sessionStorage.childFrame = "true";
+        document.body.innerHTML += '<iframe _onload_=\'setTimeout(navigate, 0);\' src=""
+        return;
+    }
+
+    window.sessionStorage.removeItem("childFrame");
+    document.body.innerHTML += '<iframe src=""
+}
+
+</script>
+</head>
+<body _onload_="setTimeout(addChildFrame, 0)" _onunload_="return false;">
+<a id="a" href="" forward then back.</a>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91582 => 91583)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 18:42:42 UTC (rev 91582)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 19:01:56 UTC (rev 91583)
@@ -1,3 +1,19 @@
+2011-07-22  Nate Chapin  <[email protected]>
+
+        Don't treat child frame loads as back-forward navigations
+        after the load event fires. This can lead to loading
+        the wrong url in the child frame.
+        https://bugs.webkit.org/show_bug.cgi?id=64895
+
+        Reviewed by Mihai Parparita.
+
+        Test: fast/loader/child-frame-add-after-back-forward.html
+
+        * dom/Document.h: Drive-by FIXME.
+        * loader/DocumentLoader.h: Drive-by FIXME.
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadURLIntoChildFrame):
+
 2011-07-22  Kent Tamura  <[email protected]>
 
         REGRESSION(r88757): The thumb of a vertical range slider is offset to the right on non-Mac.

Modified: trunk/Source/WebCore/dom/Document.h (91582 => 91583)


--- trunk/Source/WebCore/dom/Document.h	2011-07-22 18:42:42 UTC (rev 91582)
+++ trunk/Source/WebCore/dom/Document.h	2011-07-22 19:01:56 UTC (rev 91583)
@@ -1287,6 +1287,8 @@
 
     // FIXME: Merge these 2 variables into an enum. Also, FrameLoader::m_didCallImplicitClose
     // is almost a duplication of this data, so that should probably get merged in too.
+    // FIXME: Document::m_processingLoadEvent and DocumentLoader::m_wasOnloadHandled are roughly the same
+    // and should be merged.
     bool m_processingLoadEvent;
     bool m_loadEventFinished;
 

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (91582 => 91583)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2011-07-22 18:42:42 UTC (rev 91582)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2011-07-22 19:01:56 UTC (rev 91583)
@@ -302,6 +302,9 @@
         bool m_gotFirstByte;
         bool m_primaryLoadComplete;
         bool m_isClientRedirect;
+
+        // FIXME: Document::m_processingLoadEvent and DocumentLoader::m_wasOnloadHandled are roughly the same
+        // and should be merged.
         bool m_wasOnloadHandled;
 
         StringWithDirection m_pageTitle;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (91582 => 91583)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-07-22 18:42:42 UTC (rev 91582)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-07-22 19:01:56 UTC (rev 91583)
@@ -802,7 +802,8 @@
     HistoryItem* parentItem = history()->currentItem();
     // If we're moving in the back/forward list, we might want to replace the content
     // of this child frame with whatever was there at that point.
-    if (parentItem && parentItem->children().size() && isBackForwardLoadType(loadType())) {
+    if (parentItem && parentItem->children().size() && isBackForwardLoadType(loadType()) 
+        && !m_frame->document()->loadEventFinished()) {
         HistoryItem* childItem = parentItem->childItemWithTarget(childFrame->tree()->uniqueName());
         if (childItem) {
             childFrame->loader()->loadDifferentDocumentItem(childItem, loadType());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to