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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2383773002: Prevent RFH from attempting to transfer after it's been swapped out (Closed)
Patch Set: Addressed comments Created 4 years, 2 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/render_frame_host_manager.cc ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index 37978b53d46c6f7d4accb8a2f205ea2b3e26b5d2..692587c8208f1de5282344250b8166b208544e77 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -8230,4 +8230,41 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateInUnloadHandler) {
DepictFrameTree(root));
}
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+ RFHTransfersWhilePendingDeletion) {
+ GURL main_url(embedded_test_server()->GetURL("a.com", "/title1.html"));
+ NavigateToURL(shell(), main_url);
+
+ FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
+ ->GetFrameTree()
+ ->root();
+
+ // Start a cross-process navigation and wait until the response is received.
+ GURL cross_site_url_1 =
+ embedded_test_server()->GetURL("b.com", "/title1.html");
+ TestNavigationManager cross_site_manager(shell()->web_contents(),
+ cross_site_url_1);
+ shell()->web_contents()->GetController().LoadURL(
+ cross_site_url_1, Referrer(), ui::PAGE_TRANSITION_LINK, std::string());
+ EXPECT_TRUE(cross_site_manager.WaitForWillProcessResponse());
+
+ // Start a renderer-initiated navigation to a cross-process url and make sure
+ // the navigation will be blocked before being transferred.
+ GURL cross_site_url_2 =
+ embedded_test_server()->GetURL("c.com", "/title1.html");
+ TestNavigationManager transfer_manager(shell()->web_contents(),
+ cross_site_url_2);
+ EXPECT_TRUE(ExecuteScript(
+ root, "location.href = '" + cross_site_url_2.spec() + "';"));
+ EXPECT_TRUE(transfer_manager.WaitForWillProcessResponse());
+
+ // Now have the cross-process navigation commit and mark the current RFH as
+ // pending deletion.
+ cross_site_manager.WaitForNavigationFinished();
+
+ // Resume the navigation in the previous RFH that has just been marked as
+ // pending deletion. We should not crash.
+ transfer_manager.WaitForNavigationFinished();
+}
+
} // namespace content
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/public/test/browser_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698