Commit 4d286a95 authored by ap@apple.com's avatar ap@apple.com
Browse files

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154306 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 537a477d
2013-08-19 Alexey Proskuryakov <ap@apple.com>
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 <fpizlo@apple.com>
 
DFG should inline typedArray.byteOffset
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**
===============================================
<!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="resources/form-target-uncached.pl" target="target-frame">
<input name="the-input" value="input value goes here">
</form>
<iframe name="target-frame" src="about:blank"></iframe>
</body>
</html>
#!/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 = 'go-back.html'}, 0);
};
}
}
if (sessionStorage.topShouldNavAndGoBack) {
if (!sessionStorage.didNav) {
isDone = false;
sessionStorage.didNav = true;
onload = function() {
setTimeout(function() {top.location.href = 'go-back.html'}, 0);
};
}
}
if (isDone && window.testRunner)
testRunner.notifyDone();
</script>
</body>
FOOTER
2013-08-19 Alexey Proskuryakov <ap@apple.com>
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 <barraclough@apple.com>
 
https://bugs.webkit.org/show_bug.cgi?id=119995
......@@ -869,6 +869,7 @@ void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
&& !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;
}
......
......@@ -194,48 +194,32 @@ void HistoryController::saveDocumentAndScrollState()
}
}
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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment