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

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

Issue 2224213005: Ensure FrameNavigationEntry is fully updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear children FNEs of main frame on redirects. 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_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 2b21fd9296ce3828ee0b2417a9174fc788e022e6..b8c1308dbb68e49e83fbc7a39855c06b058dca82 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1174,6 +1174,9 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
// We should only get here for main frame navigations.
DCHECK(!rfh->GetParent());
+ // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
+ // in https://crbug.com/596707.
+
NavigationEntryImpl* entry;
if (params.intended_as_new_entry) {
// This was intended as a new entry but the pending entry was lost in the
@@ -1199,25 +1202,13 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
if (entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(entry, params.url);
- // Update the post parameters.
- FrameNavigationEntry* frame_entry =
- entry->GetFrameEntry(rfh->frame_tree_node());
- frame_entry->set_method(params.method);
- frame_entry->set_post_id(params.post_id);
-
- // If the document sequence number has changed due to redirects or a
- // location.replace, then the child FrameNavigationEntries that were there
- // before no longer apply. We can leave them around for in-page navigations.
- if (frame_entry->document_sequence_number() !=
- params.document_sequence_number)
- entry->ClearChildren(rfh->frame_tree_node());
-
- // Update the ISN and DSN in case this was a location.replace, which can cause
- // them to change.
- // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
- // in https://crbug.com/596707.
- frame_entry->set_item_sequence_number(params.item_sequence_number);
- frame_entry->set_document_sequence_number(params.document_sequence_number);
+ // Update the existing FrameNavigationEntry to ensure all of its members
+ // reflect the parameters coming from the renderer process.
+ entry->AddOrUpdateFrameEntry(
+ rfh->frame_tree_node(), params.item_sequence_number,
+ params.document_sequence_number, rfh->GetSiteInstance(), nullptr,
+ params.url, params.referrer, params.page_state, params.method,
+ params.post_id);
// The redirected to page should not inherit the favicon from the previous
// page.
@@ -1272,11 +1263,13 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
existing_entry->SetURL(params.url);
existing_entry->SetReferrer(params.referrer);
Charlie Reis 2016/08/10 17:03:09 Setting referrer is redundant with AddOrUpdateFram
nasko 2016/08/10 18:08:51 Done.
- // The page may have been requested with a different HTTP method.
- FrameNavigationEntry* frame_entry =
- existing_entry->GetFrameEntry(rfh->frame_tree_node());
- frame_entry->set_method(params.method);
- frame_entry->set_post_id(params.post_id);
+ // Update the existing FrameNavigationEntry to ensure all of its members
+ // reflect the parameters coming from the renderer process.
+ existing_entry->AddOrUpdateFrameEntry(
+ rfh->frame_tree_node(), params.item_sequence_number,
+ params.document_sequence_number, rfh->GetSiteInstance(), nullptr,
+ params.url, params.referrer, params.page_state, params.method,
+ params.post_id);
DiscardNonCommittedEntries();
}

Powered by Google App Engine
This is Rietveld 408576698