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

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

Issue 1134193003: Avoid renderer kills on subframe navigations after main frame replaceState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index d0c797accff73530650ccb7b55f8132b3edaa7e2..3ad1d3d7f12f70bf76578483f6eb51e698bc5e36 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -1207,6 +1207,58 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
}
+// Ensure the renderer process does not get killed if the main frame URL's path
+// changes when going back in a subframe, since this is currently possible after
+// a replaceState in the main frame (thanks to https://crbug.com/373041).
+// See https:///crbug.com/486916.
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
+ SubframeBackFromReplaceState) {
+ // Start at a page with a real iframe.
+ GURL url1(embedded_test_server()->GetURL(
+ "/navigation_controller/page_with_data_iframe.html"));
+ NavigateToURL(shell(), url1);
+
+ // It is safe to obtain the root frame tree node here, as it doesn't change.
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+ ASSERT_EQ(1U, root->child_count());
+ ASSERT_NE(nullptr, root->child_at(0));
+
+ {
+ // Navigate in the iframe.
+ FrameNavigateParamsCapturer capturer(root->child_at(0));
+ GURL frame_url(embedded_test_server()->GetURL(
+ "/navigation_controller/simple_page_2.html"));
+ NavigateFrameToURL(root->child_at(0), frame_url);
+ capturer.Wait();
+ EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, capturer.details().type);
+ }
+
+ {
+ // history.replaceState().
+ FrameNavigateParamsCapturer capturer(root);
+ std::string script =
+ "history.replaceState({}, 'replaced', 'replaced')";
+ EXPECT_TRUE(content::ExecuteScript(root->current_frame_host(), script));
+ capturer.Wait();
+ }
+
+ {
+ // Go back in the iframe.
+ TestNavigationObserver back_load_observer(shell()->web_contents());
+ shell()->web_contents()->GetController().GoBack();
+ back_load_observer.Wait();
+ }
+
+ // For now, we expect the main frame's URL to revert. This won't happen once
+ // https://crbug.com/373041 is fixed.
+ EXPECT_EQ(url1, shell()->web_contents()->GetLastCommittedURL());
+
+ // Make sure the renderer process has not been killed.
+ EXPECT_TRUE(root->current_frame_host()->IsRenderFrameLive());
+}
+
namespace {
class FailureWatcher : public WebContentsObserver {
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698