Index: chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc |
diff --git a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc |
index 3ace9753d7a8eb12ba3a8f5cd6f6e838e36a4147..f3c000d78a4b2ffcda889caedac00a9c96926aca 100644 |
--- a/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc |
+++ b/chrome/browser/ui/blocked_content/popup_blocker_browsertest.cc |
@@ -28,6 +28,7 @@ |
#include "components/content_settings/core/browser/host_content_settings_map.h" |
#include "components/omnibox/autocomplete_match.h" |
#include "components/omnibox/autocomplete_result.h" |
+#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/render_frame_host.h" |
@@ -484,4 +485,26 @@ IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, DenialOfService) { |
ASSERT_EQ(25, GetBlockedContentsCount()); |
} |
+// Verify that an onunload popup does not show up for about:blank. |
+IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, Regress427477) { |
+ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
+ ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
+ |
+ GURL url( |
+ embedded_test_server()->GetURL("/popup_blocker/popup-on-unload.html")); |
+ ui_test_utils::NavigateToURL(browser(), url); |
+ |
+ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
+ |
+ tab->GetController().GoBack(); |
+ content::WaitForLoadStop(tab); |
+ |
+ ASSERT_EQ(1u, chrome::GetBrowserCount(browser()->profile(), |
+ browser()->host_desktop_type())); |
+ ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
+ |
+ // The popup from the unload event handler should not show up for about:blank. |
+ ASSERT_EQ(0, GetBlockedContentsCount()); |
+} |
+ |
} // namespace |