Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Unified Diff: Source/WebCore/loader/HistoryController.cpp

Issue 10918017: Merge 126839 - REGRESSION(r109480): Form state for iframe content is not restored (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/history/HistoryItem.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/loader/HistoryController.cpp
===================================================================
--- Source/WebCore/loader/HistoryController.cpp (revision 127219)
+++ Source/WebCore/loader/HistoryController.cpp (working copy)
@@ -163,7 +163,7 @@
Document* document = m_frame->document();
ASSERT(document);
- if (item->isCurrentDocument(document)) {
+ if (item->isCurrentDocument(document) && document->attached()) {
LOG(Loading, "WebCoreLoading %s: saving form state to %p", m_frame->tree()->uniqueName().string().utf8().data(), item);
item->setDocumentState(document->formElementsState());
}
@@ -179,6 +179,22 @@
}
}
+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();
@@ -201,7 +217,7 @@
if (!itemToRestore)
return;
- if (m_frame->loader()->requestedHistoryItem() == m_currentItem.get() && !m_frame->loader()->documentLoader()->isClientRedirect()) {
+ 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());
}
« no previous file with comments | « Source/WebCore/history/HistoryItem.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698