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

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

Issue 1683593002: Don't use pending NavigationEntries for navigation transfers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 79265e443d7fefbb85301a8ce7ca4ad25c37eb0d..5e6f2ac705403f6e0fe5476def0ed1b0120c7334 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -726,18 +726,53 @@ void NavigatorImpl::RequestTransferURL(
is_renderer_initiated = false;
}
- NavigationController::LoadURLParams load_url_params(dest_url);
+ // Create a NavigationEntry for the transfer, without making it the pending
+ // entry. Subframe transfers should only be possible in OOPIF-enabled modes,
+ // and should have a clone of the last committed entry with a
+ // FrameNavigationEntry for the target frame. Main frame transfers should
+ // have a new NavigationEntry.
+ // TODO(creis): Make this unnecessary by creating (and validating) the params
+ // directly, passing them to the destination RenderFrameHost.
+ scoped_ptr<NavigationEntryImpl> entry;
+ if (!node->IsMainFrame()) {
+ // Subframe case: create FrameNavigationEntry.
+ CHECK(SiteIsolationPolicy::UseSubframeNavigationEntries());
+ if (controller_->GetLastCommittedEntry()) {
+ entry = controller_->GetLastCommittedEntry()->Clone();
+ entry->SetPageID(-1);
+ } else {
+ // If there's no last committed entry, create an entry for about:blank
+ // with a subframe entry for our destination.
alexmos 2016/03/21 21:41:26 Just curious, the old path through LoadURLWithPara
Charlie Reis 2016/03/30 15:26:07 Yes, now we can create OOPIFs in the initial blank
+ // TODO(creis): Ensure this case can't exist in https://crbug.com/524208.
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ controller_->CreateNavigationEntry(
+ GURL(url::kAboutBlankURL), referrer, page_transition,
alexmos 2016/03/21 21:41:26 Should this pass referrer_to_use? Same for two ot
Charlie Reis 2016/03/30 15:26:07 Good catch!
+ is_renderer_initiated, std::string(),
+ controller_->GetBrowserContext()));
+ }
+ entry->AddOrUpdateFrameEntry(node, std::string(), -1, -1, nullptr, dest_url,
+ referrer, PageState());
+ } else {
+ // Main frame case.
+ entry = NavigationEntryImpl::FromNavigationEntry(
+ controller_->CreateNavigationEntry(dest_url, referrer, page_transition,
+ is_renderer_initiated, std::string(),
+ controller_->GetBrowserContext()));
+ }
+
// The source_site_instance may matter for navigations via RenderFrameProxy.
- load_url_params.source_site_instance = source_site_instance;
- load_url_params.transition_type = page_transition;
- load_url_params.frame_tree_node_id = node->frame_tree_node_id();
- load_url_params.referrer = referrer_to_use;
- load_url_params.redirect_chain = redirect_chain;
- load_url_params.is_renderer_initiated = is_renderer_initiated;
- load_url_params.transferred_global_request_id = transferred_global_request_id;
- load_url_params.should_replace_current_entry = should_replace_current_entry;
-
- controller_->LoadURLWithParams(load_url_params);
alexmos 2016/03/21 21:41:26 The old path used to return early if the target UR
Charlie Reis 2016/03/30 15:26:08 Right, we can't get a transfer for a debug URL.
+ entry->set_source_site_instance(
+ static_cast<SiteInstanceImpl*>(source_site_instance));
+ entry->SetRedirectChain(redirect_chain);
+ // Don't allow an entry replacement if there is no entry to replace.
+ // http://crbug.com/457149
+ if (should_replace_current_entry && controller_->GetEntryCount() > 0)
+ entry->set_should_replace_entry(true);
+ entry->set_transferred_global_request_id(transferred_global_request_id);
alexmos 2016/03/21 21:41:26 Does entry->SetIsOverridingUserAgent() also need t
Charlie Reis 2016/03/30 15:26:07 Ah, nice find. I must have assumed there was no e
+ // TODO(creis): Set user gesture and intent received timestamp on Android.
+ FrameNavigationEntry* frame_entry = entry->GetFrameEntry(node);
+ NavigateToEntry(node, *frame_entry, *entry.get(),
+ NavigationController::NO_RELOAD, false, false);
}
// PlzNavigate
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698