Title: [154306] trunk
Revision
154306
Author
[email protected]
Date
2013-08-19 16:41:18 -0700 (Mon, 19 Aug 2013)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=120028
ASSERTION FAILED: m_history->provisionalItem() == m_requestedHistoryItem.get()
when navigating to an uncached subframe

Reviewed by Brady Eidson.

Source/WebCore:

Test: http/tests/navigation/post-frames-goback1-uncached.html

* loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame):
Set m_requestedHistoryItem in a code path that doesn't go through FrameLoader::loadItem.

* loader/HistoryController.cpp: (WebCore::HistoryController::restoreDocumentState):
Now that we always set m_requestedHistoryItem, there is no need to traverse frame
tree to see if this document is being loaded as part of b/f navigation (which was
add in bug 90870).

LayoutTests:

Added a nearly identical version of http/tests/navigation/post-frames-goback1.html
that checks what happens when navigating back to an uncached main resource.

* http/tests/navigation/post-frames-goback1-uncached-expected.txt: Added.
* http/tests/navigation/post-frames-goback1-uncached.html: Copied from LayoutTests/http/tests/navigation/post-frames-goback1.html.
* http/tests/navigation/resources/form-target-uncached.pl: Copied from LayoutTests/http/tests/navigation/resources/form-target.pl.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154305 => 154306)


--- trunk/LayoutTests/ChangeLog	2013-08-19 23:16:01 UTC (rev 154305)
+++ trunk/LayoutTests/ChangeLog	2013-08-19 23:41:18 UTC (rev 154306)
@@ -1,3 +1,18 @@
+2013-08-19  Alexey Proskuryakov  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=120028
+        ASSERTION FAILED: m_history->provisionalItem() == m_requestedHistoryItem.get()
+        when navigating to an uncached subframe
+
+        Reviewed by Brady Eidson.
+
+        Added a nearly identical version of http/tests/navigation/post-frames-goback1.html
+        that checks what happens when navigating back to an uncached main resource.
+
+        * http/tests/navigation/post-frames-goback1-uncached-expected.txt: Added.
+        * http/tests/navigation/post-frames-goback1-uncached.html: Copied from LayoutTests/http/tests/navigation/post-frames-goback1.html.
+        * http/tests/navigation/resources/form-target-uncached.pl: Copied from LayoutTests/http/tests/navigation/resources/form-target.pl.
+
 2013-08-18  Filip Pizlo  <[email protected]>
 
         DFG should inline typedArray.byteOffset

Added: trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached-expected.txt (0 => 154306)


--- trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached-expected.txt	2013-08-19 23:41:18 UTC (rev 154306)
@@ -0,0 +1,15 @@
+Tests that a POST targetted to a frame is handled correctly when navigating away and coming back to the page.
+
+
+
+
+--------
+Frame: 'target-frame'
+--------
+
+
+============== Back Forward List ==============
+curr->  http://127.0.0.1:8000/navigation/post-frames-goback1-uncached.html  **nav target**
+            http://127.0.0.1:8000/navigation/resources/form-target-uncached.pl (in frame "target-frame")
+        http://127.0.0.1:8000/navigation/resources/go-back.html  **nav target**
+===============================================

Added: trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached.html (0 => 154306)


--- trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/post-frames-goback1-uncached.html	2013-08-19 23:41:18 UTC (rev 154306)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.dumpChildFramesAsText();
+    testRunner.waitUntilDone();
+    testRunner.dumpBackForwardList();
+}
+   
+_onload_ = function()
+{
+    if (sessionStorage.didNav) {
+        delete sessionStorage.didNav;
+        delete sessionStorage.topShouldNavAndGoBack;
+        if (window.testRunner)
+            testRunner.notifyDone();
+    } else {
+        sessionStorage.topShouldNavAndGoBack = true;
+        document.getElementById('the-form').submit();
+    }
+}
+   
+</script>  
+
+<p>Tests that a POST targetted to a frame is handled correctly when navigating away and coming back to the page.</p>
+
+<form id="the-form" method="POST" action="" target="target-frame">
+  <input name="the-input" value="input value goes here">
+</form>
+
+<iframe name="target-frame" src=""
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/navigation/resources/form-target-uncached.pl (0 => 154306)


--- trunk/LayoutTests/http/tests/navigation/resources/form-target-uncached.pl	                        (rev 0)
+++ trunk/LayoutTests/http/tests/navigation/resources/form-target-uncached.pl	2013-08-19 23:41:18 UTC (rev 154306)
@@ -0,0 +1,60 @@
+#!/usr/bin/perl
+# Simple script to that dumps the HTTP request method and all input parameters.
+
+use CGI;
+$query = new CGI;
+
+print "Cache-Control: no-cache, no-store\r\n";
+print "Content-type: text/html\r\n";
+print "\r\n";
+
+$method = $query->request_method();
+
+print <<HEADER;
+<body>
+<p>This page was requested with the HTTP method $method.</p>
+
+<p>Parameters:</p>
+<ul>
+HEADER
+
+@paramNames = $query->param;
+
+foreach $paramName (@paramNames)
+{
+    print "<li>" . $paramName . " = " . $query->param($paramName) . "</li>"
+}
+
+print <<FOOTER
+</ul>
+<script>
+var isDone = true;
+if (sessionStorage.formTargetShouldNavAndGoBack) {
+  if (sessionStorage.didNav) {
+      delete sessionStorage.didNav;
+      delete sessionStorage.formTargetShouldNavAndGoBack;
+  } else {
+      isDone = false;
+      sessionStorage.didNav = true;
+      _onload_ = function() {
+          setTimeout(function() {window.location.href = ''}, 0);
+      };
+  }
+}
+
+if (sessionStorage.topShouldNavAndGoBack) {
+  if (!sessionStorage.didNav) {
+      isDone = false;
+      sessionStorage.didNav = true;
+      _onload_ = function() {
+          setTimeout(function() {top.location.href = ''}, 0);
+      };
+  }
+}
+
+if (isDone && window.testRunner)
+    testRunner.notifyDone();
+
+</script>
+</body>
+FOOTER
Property changes on: trunk/LayoutTests/http/tests/navigation/resources/form-target-uncached.pl
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (154305 => 154306)


--- trunk/Source/WebCore/ChangeLog	2013-08-19 23:16:01 UTC (rev 154305)
+++ trunk/Source/WebCore/ChangeLog	2013-08-19 23:41:18 UTC (rev 154306)
@@ -1,3 +1,21 @@
+2013-08-19  Alexey Proskuryakov  <[email protected]>
+
+        https://bugs.webkit.org/show_bug.cgi?id=120028
+        ASSERTION FAILED: m_history->provisionalItem() == m_requestedHistoryItem.get()
+        when navigating to an uncached subframe
+
+        Reviewed by Brady Eidson.
+
+        Test: http/tests/navigation/post-frames-goback1-uncached.html
+
+        * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURLIntoChildFrame):
+        Set m_requestedHistoryItem in a code path that doesn't go through FrameLoader::loadItem.
+
+        * loader/HistoryController.cpp: (WebCore::HistoryController::restoreDocumentState):
+        Now that we always set m_requestedHistoryItem, there is no need to traverse frame
+        tree to see if this document is being loaded as part of b/f navigation (which was
+        add in bug 90870).
+
 2013-08-19  Gavin Barraclough  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=119995

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (154305 => 154306)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2013-08-19 23:16:01 UTC (rev 154305)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2013-08-19 23:41:18 UTC (rev 154306)
@@ -869,6 +869,7 @@
         && !m_frame->document()->loadEventFinished()) {
         HistoryItem* childItem = parentItem->childItemWithTarget(childFrame->tree()->uniqueName());
         if (childItem) {
+            childFrame->loader().m_requestedHistoryItem = childItem;
             childFrame->loader().loadDifferentDocumentItem(childItem, loadType(), MayAttemptCacheOnlyLoadForFormSubmissionItem);
             return;
         }

Modified: trunk/Source/WebCore/loader/HistoryController.cpp (154305 => 154306)


--- trunk/Source/WebCore/loader/HistoryController.cpp	2013-08-19 23:16:01 UTC (rev 154305)
+++ trunk/Source/WebCore/loader/HistoryController.cpp	2013-08-19 23:41:18 UTC (rev 154306)
@@ -194,48 +194,32 @@
     }
 }
 
-static inline bool isAssociatedToRequestedHistoryItem(const HistoryItem* current, Frame* frame, const HistoryItem* requested)
-{
-    if (requested == current)
-        return true;
-    if (requested)
-        return false;
-    while ((frame = frame->tree()->parent())) {
-        requested = frame->loader().requestedHistoryItem();
-        if (!requested)
-            continue;
-        if (requested->isAncestorOf(current))
-            return true;
-    }
-    return false;
-}
-
 void HistoryController::restoreDocumentState()
 {
-    Document* doc = m_frame->document();
-        
-    HistoryItem* itemToRestore = 0;
-    
     switch (m_frame->loader().loadType()) {
         case FrameLoadTypeReload:
         case FrameLoadTypeReloadFromOrigin:
         case FrameLoadTypeSame:
         case FrameLoadTypeReplace:
-            break;
+            // Not restoring the document state.
+            return;
         case FrameLoadTypeBack:
         case FrameLoadTypeForward:
         case FrameLoadTypeIndexedBackForward:
         case FrameLoadTypeRedirectWithLockedBackForwardList:
         case FrameLoadTypeStandard:
-            itemToRestore = m_currentItem.get(); 
+            break;
     }
     
-    if (!itemToRestore)
+    if (!m_currentItem)
         return;
-    if (isAssociatedToRequestedHistoryItem(itemToRestore, m_frame, m_frame->loader().requestedHistoryItem()) && !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());
-    }
+    if (m_frame->loader().requestedHistoryItem() != m_currentItem.get())
+        return;
+    if (m_frame->loader().documentLoader()->isClientRedirect())
+        return;
+
+    LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), m_currentItem.get());
+    m_frame->document()->setStateForNewFormElements(m_currentItem->documentState());
 }
 
 void HistoryController::invalidateCurrentItemCachedPage()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to