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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1960703003: Take session history SiteInstance into account for unique origin navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 575628c31a19583c561195f21c2ce711eab0c1a2..e0f5ccb2284aa8b555345b8b46614e5173a842ce 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -6280,4 +6280,53 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
EXPECT_TRUE(observer.WasUserInteractionReceived());
}
+// Ensures that navigating to data: URLs present in session history will
+// correctly commit the navigation in the same process as the parent frame.
+// See https://crbug.com/606996.
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
+ NavigateSubframeToDataUrlInSessionHistory) {
+ GURL main_url(embedded_test_server()->GetURL(
+ "a.com", "/cross_site_iframe_factory.html?a(b,b)"));
+ GURL about_blank_url("about:blank");
Charlie Reis 2016/05/09 17:05:10 Looks unused.
nasko 2016/05/09 18:33:15 I wonder why clang didn't complain.
+ EXPECT_TRUE(NavigateToURL(shell(), main_url));
+
+ FrameTreeNode* root = web_contents()->GetFrameTree()->root();
+ EXPECT_EQ(2U, root->child_count());
+ EXPECT_EQ(
+ " Site A ------------ proxies for B\n"
+ " |--Site B ------- proxies for A\n"
+ " +--Site B ------- proxies for A\n"
+ "Where A = http://a.com/\n"
+ " B = http://b.com/",
+ DepictFrameTree(root));
+
+ TestNavigationObserver observer(shell()->web_contents());
+ FrameTreeNode* child = root->child_at(0);
+
+ // Navigate iframe to a data URL, which will commit in a new SiteInstance.
+ GURL data_url("data:text/html,dataurl");
+ NavigateFrameToURL(child, data_url);
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(data_url, observer.last_navigation_url());
+ SiteInstanceImpl* orig_site_instance =
Charlie Reis 2016/05/09 17:05:10 scoped_refptr
nasko 2016/05/09 18:33:15 Done.
+ child->current_frame_host()->GetSiteInstance();
+ EXPECT_NE(orig_site_instance, root->current_frame_host()->GetSiteInstance());
Charlie Reis 2016/05/09 17:05:10 nit: Reverse order. (orig_site_instance is the ac
nasko 2016/05/09 18:33:15 Done.
+
+ // Navigate it to another cross-site url.
+ GURL cross_site_url(embedded_test_server()->GetURL("c.com", "/title1.html"));
+ NavigateFrameToURL(child, cross_site_url);
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(cross_site_url, observer.last_navigation_url());
+ EXPECT_EQ(3, web_contents()->GetController().GetEntryCount());
+ EXPECT_NE(orig_site_instance, child->current_frame_host()->GetSiteInstance());
+
+ // Go back and ensure the data: URL committed in the same SiteInstance as the
+ // original navigation.
+ EXPECT_TRUE(web_contents()->GetController().CanGoBack());
+ TestFrameNavigationObserver frame_observer(child);
+ web_contents()->GetController().GoBack();
+ frame_observer.WaitForCommit();
+ EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance());
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698