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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 1224363002: OOPIF: Fix window.open to work from frames with remote parent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 36ee7b0ea6a129ae8e209f7b98955fa62126150f..47eb4f3dc2dac1fe37d63b709f4ed5a453480c17 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -2696,4 +2696,44 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, RFPHDestruction) {
DepictFrameTree(root));
}
+IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, OpenPopupWithRemoteParent) {
+ GURL main_url(
+ embedded_test_server()->GetURL("a.com", "/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();
+
+ // Navigate first child cross-site.
+ GURL frame_url(embedded_test_server()->GetURL("b.com", "/title3.html"));
+ NavigateFrameToURL(root->child_at(0), frame_url);
+
+ // Open a popup from the first child.
+ ShellAddedObserver new_shell_observer;
+ bool success = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ root->child_at(0)->current_frame_host(),
+ "window.domAutomationController.send(!!window.open('about:blank'));",
Charlie Reis 2015/07/09 23:42:51 Can you also add a test for window.open to a cross
alexmos 2015/07/10 18:35:00 Done. It works as-is. :) I factored out the po
Charlie Reis 2015/07/10 21:44:49 Yes, content_browser_test_utils_internal.h is prob
+ &success));
+ EXPECT_TRUE(success);
+ Shell* new_shell = new_shell_observer.GetShell();
+
+ // Check that the popup's opener is correct on both the browser and renderer
+ // sides.
+ FrameTreeNode* popup_root =
+ static_cast<WebContentsImpl*>(new_shell->web_contents())
+ ->GetFrameTree()
+ ->root();
+ EXPECT_EQ(root->child_at(0), popup_root->opener());
+
+ std::string opener_url;
+ EXPECT_TRUE(ExecuteScriptAndExtractString(
+ popup_root->current_frame_host(),
+ "window.domAutomationController.send(window.opener.location.href);",
+ &opener_url));
+ EXPECT_EQ(frame_url.spec(), opener_url);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698