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

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

Issue 892123002: PlzNavigate: change behavior when navigating with a non-live RFH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comment Created 5 years, 10 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/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index baefe87ff15bb16c12ee8ea585baedb23b800296..f7f938836f33c10e1ac46a3a2fa20023025fda60 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -694,17 +694,6 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
CleanUpNavigation();
navigation_rfh = render_frame_host_.get();
} else {
- // If the current render_frame_host_ isn't live, we should create it so
- // that we don't show a sad tab while the navigation is ongoing.
- // (Bug 1145340)
- if (!render_frame_host_->IsRenderFrameLive()) {
- // Note: we don't call InitRenderView here because we are navigating away
- // soon anyway, and we don't have the NavigationEntry for this host.
- delegate_->CreateRenderViewForRenderManager(
- render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
- MSG_ROUTING_NONE, frame_tree_node_->IsMainFrame());
- }
-
// If the SiteInstance for the final URL doesn't match the one from the
// speculatively created RenderFrameHost, create a new RenderFrameHost using
// this new SiteInstance.
@@ -719,6 +708,16 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
}
DCHECK(speculative_render_frame_host_);
navigation_rfh = speculative_render_frame_host_.get();
+
+ // Check if our current RFH is live.
+ if (!render_frame_host_->IsRenderFrameLive()) {
+ // The current RFH is not live. There's no reason to sit around with a
+ // sad tab or a newly created RFH while we wait for the navigation to
+ // complete. Just switch to the speculative RFH now and go back to non
+ // cross-navigating (Note that we don't care about on{before}unload
+ // handlers if the current RFH isn't live.)
+ CommitPending();
+ }
}
DCHECK(navigation_rfh &&
(navigation_rfh == render_frame_host_.get() ||

Powered by Google App Engine
This is Rietveld 408576698