Stop reviving crashed RenderFrameHost. Get a new one instead.
On same-site navigations, the browser reuses the current
RenderFrameHost, even if the current RenderFrameHost is crashed.
Instead of reviving the crashed one, we should get a new RenderFrameHost.
This can be seen as a small step in the direction of RenderDocument, which
intend to get a new RenderFrameHost every time, even if the previous
RenderFrameHost is not crashed.
https://docs.google.com/document/d/1C2VKkFRSc0kdmqjKan1G4NlNlxWZqE4Wam41FNMgnmA/edit
Bug: 981339
Change-Id: I17b11abe759906a7f360abeaa45f0bfc77e08768
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1688957
Commit-Queue: Arthur Sonzogni <[email protected]>
Reviewed-by: Charlie Reis <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#685282}
diff --git a/content/browser/frame_host/frame_tree_browsertest.cc b/content/browser/frame_host/frame_tree_browsertest.cc
index 29e7e7d..21aee82 100644
--- a/content/browser/frame_host/frame_tree_browsertest.cc
+++ b/content/browser/frame_host/frame_tree_browsertest.cc
@@ -124,10 +124,10 @@
// Ensure the view and frame are live.
RenderViewHost* rvh = shell()->web_contents()->GetRenderViewHost();
- RenderFrameHostImpl* rfh =
+ RenderFrameHostImpl* rfh1 =
static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame());
EXPECT_TRUE(rvh->IsRenderViewLive());
- EXPECT_TRUE(rfh->IsRenderFrameLive());
+ EXPECT_TRUE(rfh1->IsRenderFrameLive());
// Crash the renderer so that it doesn't send any FrameDetached messages.
RenderProcessHostWatcher crash_observer(
@@ -144,7 +144,7 @@
// Ensure the view and frame aren't live anymore.
EXPECT_FALSE(rvh->IsRenderViewLive());
- EXPECT_FALSE(rfh->IsRenderFrameLive());
+ EXPECT_FALSE(rfh1->IsRenderFrameLive());
// Navigate to a new URL.
GURL url(embedded_test_server()->GetURL("/title1.html"));
@@ -152,9 +152,10 @@
EXPECT_EQ(0UL, root->child_count());
EXPECT_EQ(url, root->current_url());
+ RenderFrameHostImpl* rfh2 = root->current_frame_host();
// Ensure the view and frame are live again.
EXPECT_TRUE(rvh->IsRenderViewLive());
- EXPECT_TRUE(rfh->IsRenderFrameLive());
+ EXPECT_TRUE(rfh2->IsRenderFrameLive());
}
// Test that we can navigate away if the previous renderer doesn't clean up its