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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1039403002: OOPIF: Remove the FrameTreeNode when a RemoteFrame is detached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 f758c2f07d3e04068c5d4d9d875463397d58d71d..50cf47e2a226ea4a4b8c6af65b8540a9e291cfca 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -281,6 +281,39 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframe) {
EXPECT_TRUE(child->current_frame_host()->GetRenderWidgetHost());
}
+// Ensure that OOPIFs are deleted after navigating to a new main frame.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CleanupCrossSiteIframe) {
+ GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html"));
+ NavigateToURL(shell(), main_url);
+
+ // 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();
+
+ TestNavigationObserver observer(shell()->web_contents());
+
+ // Load cross-site page into iframe.
+ GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html");
+ NavigateFrameToURL(root->child_at(0), url);
+ // Verify that the navigation succeeded and the expected URL was loaded.
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(url, observer.last_navigation_url());
+
+ // Ensure that we have created a new process for the subframe.
+ FrameTreeNode* child = root->child_at(0);
+ ASSERT_EQ(2U, root->child_count());
+ SiteInstance* site_instance = child->current_frame_host()->GetSiteInstance();
+ EXPECT_NE(shell()->web_contents()->GetSiteInstance(), site_instance);
+
+ // Load a new same-site page in the top-level frame.
+ GURL new_url(embedded_test_server()->GetURL("/title1.html"));
+ NavigateToURL(shell(), new_url);
+
+ // Ensure that the subframe is gone.
+ ASSERT_EQ(0U, root->child_count());
+}
+
// Disabled for flaky crashing: crbug.com/446575
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
NavigateRemoteFrame) {

Powered by Google App Engine
This is Rietveld 408576698