summaryrefslogtreecommitdiffstats
path: root/content/browser/frame_host/navigation_entry_impl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/frame_host/navigation_entry_impl.cc')
-rw-r--r--content/browser/frame_host/navigation_entry_impl.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index 258429a..6b8e04a7 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -264,9 +264,17 @@ void NavigationEntryImpl::SetPageState(const PageState& state) {
return;
}
- // This should only be called when restoring a NavigationEntry, so there
- // should be no subframe FrameNavigationEntries yet.
- DCHECK_EQ(0U, frame_tree_->children.size());
+ // SetPageState should only be called before the NavigationEntry has been
+ // loaded, such as for restore (when there are no subframe
+ // FrameNavigationEntries yet). However, some callers expect to call this
+ // after a Clone but before loading the page. Clone will copy over the
+ // subframe entries, and we should reset them before setting the state again.
+ //
+ // TODO(creis): It would be good to verify that this NavigationEntry hasn't
+ // been loaded yet in cases that SetPageState is called while subframe
+ // entries exist, but there's currently no way to check that.
+ if (!frame_tree_->children.empty())
+ frame_tree_->children.clear();
// If the PageState can't be parsed or has no children, just store it on the
// main frame's FrameNavigationEntry without recursively creating subframe