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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@91583 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 032e682..47bb220 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -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());