Title: [114456] branches/safari-534.57-branch

Diff

Modified: branches/safari-534.57-branch/LayoutTests/ChangeLog (114455 => 114456)


--- branches/safari-534.57-branch/LayoutTests/ChangeLog	2012-04-17 22:56:23 UTC (rev 114455)
+++ branches/safari-534.57-branch/LayoutTests/ChangeLog	2012-04-17 22:57:53 UTC (rev 114456)
@@ -1,5 +1,21 @@
 2012-04-17  Lucas Forschler  <[email protected]>
 
+    Merge 109480
+
+    2012-03-01  Kent Tamura  <[email protected]>
+
+            REGRESSION(r106388): Form state is restored to a wrong document.
+            https://bugs.webkit.org/show_bug.cgi?id=79206
+
+            Reviewed by Brady Eidson.
+
+            * fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt: Added.
+            * fast/loader/form-state-restore-with-locked-back-forward-list.html: Added.
+            * fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html: Added.
+            * fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html: Added.
+
+2012-04-17  Lucas Forschler  <[email protected]>
+
     Merge 112023
     
     2012-03-24  Jeffrey Pfau  <[email protected]>

Copied: branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt (from rev 109480, trunk/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt) (0 => 114456)


--- branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt	                        (rev 0)
+++ branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt	2012-04-17 22:57:53 UTC (rev 114456)
@@ -0,0 +1,2 @@
+PASS location.search is "?TestName1=Ok1&TestName2=Ok2"
+

Copied: branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list.html (from rev 109480, trunk/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list.html) (0 => 114456)


--- branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list.html	                        (rev 0)
+++ branches/safari-534.57-branch/LayoutTests/fast/loader/form-state-restore-with-locked-back-forward-list.html	2012-04-17 22:57:53 UTC (rev 114456)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body _onLoad_="document.forms[0].submit();">
+<form method=POST action=""
+<input name="TestName1" type="hidden" value="Bad1">
+<input name="TestName2" type="hidden" value="Bad2">
+</form>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+</script>
+</body>
+</html>

Copied: branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html (from rev 109480, trunk/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html) (0 => 114456)


--- branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html	                        (rev 0)
+++ branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html	2012-04-17 22:57:53 UTC (rev 114456)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body _onLoad_="document.forms[0].submit();">
+<form method="GET" action=""
+<input name="TestName1" type="hidden" value="Ok1">
+<input name="TestName2" type="hidden" value="Ok2">
+</form>
+</body>
+</html>

Copied: branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html (from rev 109480, trunk/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html) (0 => 114456)


--- branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html	                        (rev 0)
+++ branches/safari-534.57-branch/LayoutTests/fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html	2012-04-17 22:57:53 UTC (rev 114456)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+shouldBeEqualToString("location.search", '?TestName1=Ok1&TestName2=Ok2');
+if (window.layoutTestController)
+    layoutTestController.notifyDone();
+</script>
+</body>

Modified: branches/safari-534.57-branch/Source/WebCore/ChangeLog (114455 => 114456)


--- branches/safari-534.57-branch/Source/WebCore/ChangeLog	2012-04-17 22:56:23 UTC (rev 114455)
+++ branches/safari-534.57-branch/Source/WebCore/ChangeLog	2012-04-17 22:57:53 UTC (rev 114456)
@@ -1,3 +1,34 @@
+2012-04-17  Lucas Forschler  <[email protected]>
+
+    Merge 109480
+
+    2012-03-01  Kent Tamura  <[email protected]>
+
+            REGRESSION(r106388): Form state is restored to a wrong document.
+            https://bugs.webkit.org/show_bug.cgi?id=79206
+
+            Reviewed by Brady Eidson.
+
+            In some cases, the URL of the current HistoryItem and the document
+            URL are mismatched.
+            A form state should be restored only if the document was loaded
+            with a HistoryItem and the document is not loaded as a
+            redirection.
+
+            Test: fast/loader/form-state-restore-with-locked-back-forward-list.html
+
+            * loader/FrameLoader.cpp:
+            (WebCore::FrameLoader::checkCompleted): Clear m_requestedHistoryItem.
+            (WebCore::FrameLoader::loadItem):
+            Save the requested HistoryItem for didLoadWithLodItem().
+            * loader/FrameLoader.h:
+            (WebCore::FrameLoader::requestedHistoryItem):
+            Added. Accessor for m_requestedHistoryItem.
+            * loader/HistoryController.cpp:
+            (WebCore::HistoryController::restoreDocumentState):
+            Restore a form state only if the current document was loaded with
+            FrameLoader::loadItem() and not redirection.
+
 2012-04-12  Lucas Forschler  <[email protected]>
 
     Merge 113415

Modified: branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.cpp (114455 => 114456)


--- branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.cpp	2012-04-17 22:56:23 UTC (rev 114455)
+++ branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.cpp	2012-04-17 22:57:53 UTC (rev 114456)
@@ -926,6 +926,7 @@
 
     // OK, completed.
     m_isComplete = true;
+    m_requestedHistoryItem = 0;
     m_frame->document()->setReadyState(Document::Complete);
 
     RefPtr<Frame> protect(m_frame);
@@ -3374,6 +3375,7 @@
 // Loads content into this frame, as specified by history item
 void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
 {
+    m_requestedHistoryItem = item;
     HistoryItem* currentItem = history()->currentItem();
     bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavigationTo(currentItem);
 

Modified: branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.h (114455 => 114456)


--- branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.h	2012-04-17 22:56:23 UTC (rev 114455)
+++ branches/safari-534.57-branch/Source/WebCore/loader/FrameLoader.h	2012-04-17 22:57:53 UTC (rev 114456)
@@ -129,6 +129,7 @@
     unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
 
     bool canHandleRequest(const ResourceRequest&);
+    HistoryItem* requestedHistoryItem() const { return m_requestedHistoryItem.get(); }
 
     // Also not cool.
     void stopAllLoaders(ClearProvisionalItemPolicy = ShouldClearProvisionalItem);
@@ -506,6 +507,7 @@
     RefPtr<FrameNetworkingContext> m_networkingContext;
 
     KURL m_previousUrl;
+    RefPtr<HistoryItem> m_requestedHistoryItem;
 };
 
 // This function is called by createWindow() in JSDOMWindowBase.cpp, for example, for

Modified: branches/safari-534.57-branch/Source/WebCore/loader/HistoryController.cpp (114455 => 114456)


--- branches/safari-534.57-branch/Source/WebCore/loader/HistoryController.cpp	2012-04-17 22:56:23 UTC (rev 114455)
+++ branches/safari-534.57-branch/Source/WebCore/loader/HistoryController.cpp	2012-04-17 22:57:53 UTC (rev 114456)
@@ -198,9 +198,10 @@
     
     if (!itemToRestore)
         return;
-
-    LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore);
-    doc->setStateForNewFormElements(itemToRestore->documentState());
+    if (m_frame->loader()->requestedHistoryItem() == m_currentItem.get() && !m_frame->loader()->documentLoader()->isClientRedirect()) {
+        LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore);
+        doc->setStateForNewFormElements(itemToRestore->documentState());
+    }
 }
 
 void HistoryController::invalidateCurrentItemCachedPage()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to