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

Unified Diff: chrome/browser/extensions/process_manager_browsertest.cc

Issue 2809653008: Don't create unnecessary OOPIFs for subframe navigations that don't require a dedicated process. (Closed)
Patch Set: Revise comment Created 3 years, 8 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 | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/process_manager_browsertest.cc
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index adaf411010263d70ef6491d0d12833856fa99f96..e7022f06e2cc2280670ba217982ce1157f3df1e4 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -1220,4 +1220,55 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest,
VerifyPostMessageToOpener(popup->GetMainFrame(), extension_frame);
}
+// Test that when a web site has an extension iframe, navigating that iframe to
+// a different web site without --site-per-process will place it in the parent
+// frame's process. See https://crbug.com/711006.
+IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest,
+ ExtensionFrameNavigatesToParentSiteInstance) {
+ // This test matters only *without* --site-per-process.
+ if (content::AreAllSitesIsolatedForTesting())
Devlin 2017/04/17 21:49:32 Would it be worth enforcing this in the test via S
alexmos 2017/04/17 22:38:59 Good idea, but it might be tricky. I don't see an
Devlin 2017/04/17 23:03:37 Fair enough, but my $0.02 are that it's worth look
alexmos 2017/04/17 23:07:58 Acknowledged, we probably should discuss bot confi
+ return;
+
+ host_resolver()->AddRule("*", "127.0.0.1");
+
+ // Create a simple extension without a background page.
+ const Extension* extension = CreateExtension("Extension", false);
+ embedded_test_server()->ServeFilesFromDirectory(extension->path());
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ // Navigate main tab to a web page with a blank iframe. There should be no
+ // extension frames yet.
+ NavigateToURL(embedded_test_server()->GetURL("a.com", "/blank_iframe.html"));
+ ProcessManager* pm = ProcessManager::Get(profile());
+ EXPECT_EQ(0u, pm->GetAllFrames().size());
+ EXPECT_EQ(0u, pm->GetRenderFrameHostsForExtension(extension->id()).size());
+
+ content::WebContents* tab =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ // Navigate subframe to an extension URL. This should go into a new
+ // extension process.
+ const GURL extension_url(extension->url().Resolve("empty.html"));
+ EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", extension_url));
+ EXPECT_EQ(1u, pm->GetRenderFrameHostsForExtension(extension->id()).size());
+ EXPECT_EQ(1u, pm->GetAllFrames().size());
+
+ content::RenderFrameHost* main_frame = tab->GetMainFrame();
+ {
+ content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0);
+ EXPECT_NE(subframe->GetProcess(), main_frame->GetProcess());
+ EXPECT_NE(subframe->GetSiteInstance(), main_frame->GetSiteInstance());
+ }
+
+ // Navigate subframe to b.com. This should be brought back to the parent
+ // frame's (a.com) process.
+ GURL b_url(embedded_test_server()->GetURL("b.com", "/empty.html"));
+ EXPECT_TRUE(content::NavigateIframeToURL(tab, "frame0", b_url));
+ {
+ content::RenderFrameHost* subframe = ChildFrameAt(main_frame, 0);
+ EXPECT_EQ(subframe->GetProcess(), main_frame->GetProcess());
+ EXPECT_EQ(subframe->GetSiteInstance(), main_frame->GetSiteInstance());
+ }
+}
+
} // namespace extensions
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698