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

Unified Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 1381443003: Disable support for swapped out RenderFrame(Host) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix crashing on window access after forward/back navigation. Created 5 years, 3 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/frame_host/render_frame_host_manager_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index 8ee53ea1bf7ad70aa44880c4a863895e4e223fb5..3006fa1606b5e5d5b260e877b57e6e425d94f341 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -2062,4 +2062,72 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, UpdateOpener) {
EXPECT_EQ(bar_root, foo_root->opener());
}
+IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
+ PopupCrossProcessNavigateAndBack) {
+ StartServer();
+
+ // Load a page with links that open in a new window.
+ std::string replacement_path;
+ ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
+ "files/click-noreferrer-links.html",
+ foo_host_port_,
+ &replacement_path));
+ NavigateToURL(shell(), test_server()->GetURL(replacement_path));
+
+ // Get the original SiteInstance for later comparison.
+ scoped_refptr<SiteInstance> orig_site_instance(
+ shell()->web_contents()->GetSiteInstance());
+ EXPECT_TRUE(orig_site_instance.get() != NULL);
+
+ // Test clicking a target=foo link.
+ ShellAddedObserver new_shell_observer;
+ bool success = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ shell()->web_contents(),
+ "window.domAutomationController.send(clickSameSiteTargetedLink());",
+ &success));
+ EXPECT_TRUE(success);
+ Shell* new_shell = new_shell_observer.GetShell();
+ EXPECT_TRUE(new_shell->web_contents()->HasOpener());
+
+ // Wait for the navigation in the new tab to finish, if it hasn't.
+ WaitForLoadStop(new_shell->web_contents());
+ EXPECT_EQ("/files/navigate_opener.html",
+ new_shell->web_contents()->GetLastCommittedURL().path());
+
+ // Should have the same SiteInstance.
+ scoped_refptr<SiteInstance> blank_site_instance(
+ new_shell->web_contents()->GetSiteInstance());
+ EXPECT_EQ(orig_site_instance, blank_site_instance);
+
+ // Capture the window reference, so we can check that accessing its location
+ // works after navigating cross-process and back.
+ GURL expected_url = new_shell->web_contents()->GetLastCommittedURL();
+ EXPECT_TRUE(ExecuteScript(shell()->web_contents(),
+ "saveWindowReference();"));
+
+ // Now navigate the new tab to a different site.
+ NavigateToURL(new_shell, GetCrossSiteURL("files/title1.html"));
+ scoped_refptr<SiteInstance> new_site_instance(
+ new_shell->web_contents()->GetSiteInstance());
+ EXPECT_NE(orig_site_instance, new_site_instance);
+ EXPECT_TRUE(new_shell->web_contents()->HasOpener());
+
+ // Go back
Charlie Reis 2015/09/30 21:08:03 nit: End with period.
+ {
+ TestNavigationObserver back_nav_load_observer(new_shell->web_contents());
+ new_shell->web_contents()->GetController().GoBack();
+ back_nav_load_observer.Wait();
+ }
+
+ // Check that the location.href attribute is accessible and is correct.
+ std::string result;
+ EXPECT_TRUE(ExecuteScriptAndExtractString(
+ shell()->web_contents(),
+ "window.domAutomationController.send(getExitingWindowLocation());",
+ &result));
+ EXPECT_EQ(expected_url.spec(), result);
+}
+
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698