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

Unified Diff: content/browser/frame_host/navigation_controller_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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4179c2d32c673874a6888914dea717baf1821d0a..dc3b38c7dd42ed651fab35bb9663bdb2b73a0957 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1150,6 +1150,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
@@ -1175,31 +1178,24 @@ 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);
+ // The site instance will normally be the same except during session restore,
+ // when no site instance will be assigned.
+ DCHECK(entry->site_instance() == nullptr ||
+ entry->site_instance() == rfh->GetSiteInstance());
- // 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.
if (ui::PageTransitionIsRedirect(params.transition))
entry->GetFavicon() = FaviconStatus();
- // The site instance will normally be the same except during session restore,
- // when no site instance will be assigned.
- DCHECK(entry->site_instance() == nullptr ||
- entry->site_instance() == rfh->GetSiteInstance());
- entry->set_site_instance(
- static_cast<SiteInstanceImpl*>(rfh->GetSiteInstance()));
-
// The entry we found in the list might be pending if the user hit
// back/forward/reload. This load should commit it (since it's already in the
// list, we can just discard the pending pointer). We should also discard the
@@ -1239,13 +1235,14 @@ void NavigationControllerImpl::RendererDidNavigateToSamePage(
if (existing_entry->update_virtual_url_with_url())
UpdateVirtualURLToURL(existing_entry, params.url);
existing_entry->SetURL(params.url);
- existing_entry->SetReferrer(params.referrer);
- // 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();
}
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698