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

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

Issue 1777903003: Ensure the NavigationHandle's nav entry ID is updated during transfers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix else branch Created 4 years, 9 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/navigator_impl.cc
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index baf2bcdb4c383096c4c14d1858a34ddb305befb7..c175c7993862a310589d86a1b9dfed146574ed49 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -125,7 +125,8 @@ void NavigatorImpl::DidStartProvisionalLoad(
if (is_main_frame && !is_error_page) {
DidStartMainFrameNavigation(validated_url,
- render_frame_host->GetSiteInstance());
+ render_frame_host->GetSiteInstance(),
+ render_frame_host->navigation_handle());
}
if (delegate_) {
@@ -846,7 +847,7 @@ void NavigatorImpl::OnBeginNavigation(
// RenderFrameHost.
DidStartMainFrameNavigation(
common_params.url,
- frame_tree_node->current_frame_host()->GetSiteInstance());
+ frame_tree_node->current_frame_host()->GetSiteInstance(), nullptr);
navigation_data_.reset();
}
@@ -1090,7 +1091,8 @@ void NavigatorImpl::RecordNavigationMetrics(
void NavigatorImpl::DidStartMainFrameNavigation(
const GURL& url,
- SiteInstanceImpl* site_instance) {
+ SiteInstanceImpl* site_instance,
+ NavigationHandleImpl* navigation_handle) {
// If there is no browser-initiated pending entry for this navigation and it
// is not for the error URL, create a pending entry using the current
// SiteInstance, and ensure the address bar updates accordingly. We don't
@@ -1109,12 +1111,20 @@ void NavigatorImpl::DidStartMainFrameNavigation(
entry->set_site_instance(site_instance);
// TODO(creis): If there's a pending entry already, find a safe way to
// update it instead of replacing it and copying over things like this.
+ // That will allow us to skip the NavigationHandle update below as well.
if (pending_entry) {
entry->set_transferred_global_request_id(
pending_entry->transferred_global_request_id());
entry->set_should_replace_entry(pending_entry->should_replace_entry());
entry->SetRedirectChain(pending_entry->GetRedirectChain());
}
+
+ // If there's a current NavigationHandle, update its pending NavEntry ID.
Charlie Harrison 2016/03/11 15:15:14 Good catch.
+ // This is necessary for transfer navigations. The handle may be null in
+ // PlzNavigate.
+ if (navigation_handle)
+ navigation_handle->set_pending_nav_entry_id(entry->GetUniqueID());
+
controller_->SetPendingEntry(std::move(entry));
if (delegate_)
delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);

Powered by Google App Engine
This is Rietveld 408576698