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

Unified Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 1849013004: Fix JavaScript alerts from frames with oopif on, after a cross-process click. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alertfix
Patch Set: fixes Created 4 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 | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
index 4ef56690dc2802bd2b6b5e226722a0c04e26fa0b..6534b140d49ebc3ae4866eac2a78143fbc8f25eb 100644
--- a/content/browser/web_contents/web_contents_impl_browsertest.cc
+++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
@@ -968,7 +968,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
dialog_manager.Wait();
EXPECT_EQ("about:blank", dialog_manager.last_message());
- // Navigate cross-domain.
+ // Navigate the subframe cross-site.
NavigateFrameToURL(frame,
embedded_test_server()->GetURL("b.com", "/title2.html"));
EXPECT_TRUE(WaitForLoadStop(wc));
@@ -980,14 +980,6 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
EXPECT_EQ(GURL("http://b.com/title2.html"),
GURL(dialog_manager.last_message()).ReplaceComponents(clear_port));
- // Dialogs do not work with out-of-process iframes yet.
- // http://crbug.com/453893
- if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
- wc->SetDelegate(nullptr);
- wc->SetJavaScriptDialogManagerForTesting(nullptr);
- return; // :(
- }
-
// A dialog from the main frame.
EXPECT_TRUE(
content::ExecuteScript(root->current_frame_host(), alert_location));
@@ -995,6 +987,25 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
EXPECT_EQ(GURL("http://a.com/title1.html"),
GURL(dialog_manager.last_message()).ReplaceComponents(clear_port));
+ // Navigate the top frame cross-site; ensure that dialogs work.
+ NavigateToURL(shell(),
+ embedded_test_server()->GetURL("c.com", "/title3.html"));
+ EXPECT_TRUE(WaitForLoadStop(wc));
+ EXPECT_TRUE(
+ content::ExecuteScript(root->current_frame_host(), alert_location));
+ dialog_manager.Wait();
+ EXPECT_EQ(GURL("http://c.com/title3.html"),
+ GURL(dialog_manager.last_message()).ReplaceComponents(clear_port));
+
+ // Navigate back; ensure that dialogs work.
+ wc->GetController().GoBack();
+ EXPECT_TRUE(WaitForLoadStop(wc));
+ EXPECT_TRUE(
+ content::ExecuteScript(root->current_frame_host(), alert_location));
+ dialog_manager.Wait();
+ EXPECT_EQ(GURL("http://a.com/title1.html"),
+ GURL(dialog_manager.last_message()).ReplaceComponents(clear_port));
+
wc->SetDelegate(nullptr);
wc->SetJavaScriptDialogManagerForTesting(nullptr);
}
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698