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

Unified Diff: content/browser/frame_host/navigation_entry_impl.cc

Issue 2284533002: Ensure FrameNavigationEntry is fully updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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
Index: content/browser/frame_host/navigation_entry_impl.cc
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index d6e07afff5547badabbd5234140a9d6637dfd221..cdfe58ed450f5e173e646aa8592cf81d98badebf 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -697,9 +697,33 @@ void NavigationEntryImpl::AddOrUpdateFrameEntry(
const PageState& page_state,
const std::string& method,
int64_t post_id) {
+ // We should only have an empty PageState if the navigation is new, and thus
+ // page ID is -1.
+ if (!page_state.IsValid() && GetPageID() != -1) {
+ // Temporarily generate a minidump to diagnose https://crbug.com/568703.
+ base::debug::DumpWithoutCrashing();
+ NOTREACHED() << "Shouldn't set an empty PageState.";
+ }
+
+ // If this is called for the main frame, the FrameNavigationEntry is
+ // guaranteed to exist, so just update it directly and return.
+ if (frame_tree_node->IsMainFrame()) {
+ // If the document of the FrameNavigationEntry is changing, we must clear
+ // any child FrameNavigationEntries.
+ if (root_node()->frame_entry->document_sequence_number() !=
+ document_sequence_number)
+ root_node()->children.clear();
+
+ root_node()->frame_entry->UpdateEntry(
+ frame_tree_node->unique_name(), item_sequence_number,
+ document_sequence_number, site_instance,
+ std::move(source_site_instance), url, referrer, page_state, method,
+ post_id);
+ return;
+ }
+
// We should already have a TreeNode for the parent node by the time this node
// commits. Find it first.
- DCHECK(frame_tree_node->parent());
NavigationEntryImpl::TreeNode* parent_node =
FindFrameEntry(frame_tree_node->parent());
if (!parent_node) {

Powered by Google App Engine
This is Rietveld 408576698