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

Unified Diff: chrome/browser/chrome_site_per_process_browsertest.cc

Issue 2863203002: Ignore print() during page dismissal. (Closed)
Patch Set: rebase, addressing comments Created 3 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_site_per_process_browsertest.cc
diff --git a/chrome/browser/chrome_site_per_process_browsertest.cc b/chrome/browser/chrome_site_per_process_browsertest.cc
index 54f55ef8072812b9fdf6affffb774c4221ac4fc6..1c6047fb03be16cd67d385b5aa7a76edacc30db0 100644
--- a/chrome/browser/chrome_site_per_process_browsertest.cc
+++ b/chrome/browser/chrome_site_per_process_browsertest.cc
@@ -517,6 +517,48 @@ IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest,
ASSERT_EQ(2, browser()->tab_strip_model()->count());
}
+IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PrintIgnoredInUnloadHandler) {
+ ui_test_utils::NavigateToURL(
+ browser(), GURL(embedded_test_server()->GetURL("a.com", "/title1.html")));
+
+ content::WebContents* active_web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ // Create 2 iframes and navigate them to b.com.
+ EXPECT_TRUE(ExecuteScript(active_web_contents,
+ "var i = document.createElement('iframe'); i.id = "
+ "'child-0'; document.body.appendChild(i);"));
+ EXPECT_TRUE(ExecuteScript(active_web_contents,
+ "var i = document.createElement('iframe'); i.id = "
+ "'child-1'; document.body.appendChild(i);"));
+ EXPECT_TRUE(NavigateIframeToURL(
+ active_web_contents, "child-0",
+ GURL(embedded_test_server()->GetURL("b.com", "/title1.html"))));
+ EXPECT_TRUE(NavigateIframeToURL(
+ active_web_contents, "child-1",
+ GURL(embedded_test_server()->GetURL("b.com", "/title1.html"))));
+
+ content::RenderFrameHost* child_0 =
+ ChildFrameAt(active_web_contents->GetMainFrame(), 0);
+ content::RenderFrameHost* child_1 =
+ ChildFrameAt(active_web_contents->GetMainFrame(), 1);
+
+ // Add an unload handler that calls print() to child-0 iframe.
+ EXPECT_TRUE(ExecuteScript(
+ child_0, "document.body.onunload = function() { print(); }"));
+
+ // Transfer child-0 to a new process hosting c.com.
+ EXPECT_TRUE(NavigateIframeToURL(
+ active_web_contents, "child-0",
+ GURL(embedded_test_server()->GetURL("c.com", "/title1.html"))));
+
+ // Check that b.com's process is still alive.
+ bool renderer_alive = false;
+ EXPECT_TRUE(ExecuteScriptAndExtractBool(
+ child_1, "window.domAutomationController.send(true);", &renderer_alive));
+ EXPECT_TRUE(renderer_alive);
+}
+
#if BUILDFLAG(ENABLE_SPELLCHECK)
// Class to sniff incoming IPCs for spell check messages.
class TestSpellCheckMessageFilter : public content::BrowserMessageFilter {
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698