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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2525433003: Site Isolation: test srcdoc navigation after a cross-site navigation. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 | no next file » | 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 006b70b8bf29cd0438ae69643e851a0c608d46f7..494b5c5040819cad8ee9df1c4df7eabb51fb383a 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -8764,4 +8764,44 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessFeaturePolicyBrowserTest,
"{\"vibrate\":[\"*\"]}",
root->child_at(0)->current_replication_state().feature_policy_header);
}
+
+// Ensure that an iframe that navigates cross-site doesn't use the same process
+// as its parent. Then when its parent navigates it via the "srcdoc" attribute,
+// it must reuse its parent's process.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+ IframeSrcdocAfterCrossSiteNavigation) {
+ GURL parent_url(embedded_test_server()->GetURL(
+ "a.com", "/cross_site_iframe_factory.html?a(b)"));
+ GURL child_url(embedded_test_server()->GetURL(
+ "b.com", "/cross_site_iframe_factory.html?b()"));
+ GURL blank_url(url::kAboutBlankURL);
+
+ // #1 Navigate to a page with a cross-site iframe.
+ EXPECT_TRUE(NavigateToURL(shell(), parent_url));
+
+ // Ensure that the iframe uses its own process.
+ FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+ ASSERT_EQ(1u, root->child_count());
+ FrameTreeNode* child = root->child_at(0);
+ EXPECT_EQ(parent_url, root->current_url());
+ EXPECT_EQ(child_url, child->current_url());
+ EXPECT_NE(root->current_frame_host()->GetSiteInstance(),
+ child->current_frame_host()->GetSiteInstance());
+ EXPECT_NE(root->current_frame_host()->GetProcess(),
+ child->current_frame_host()->GetProcess());
+
+ // #2 Navigate the iframe to its srcdoc attribute.
+ TestNavigationObserver load_observer(shell()->web_contents());
+ EXPECT_TRUE(ExecuteScript(
+ root, "document.getElementById('child-0').srcdoc = 'srcdoc content';"));
+ load_observer.Wait();
+
+ // Ensure that the iframe reuses its parent's process.
+ EXPECT_EQ(blank_url, child->current_url());
+ EXPECT_EQ(root->current_frame_host()->GetSiteInstance(),
+ child->current_frame_host()->GetSiteInstance());
+ EXPECT_EQ(root->current_frame_host()->GetProcess(),
+ child->current_frame_host()->GetProcess());
+}
+
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698