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

Unified Diff: chrome/browser/ui/browser_browsertest.cc

Issue 256233002: Ensure that modal dialogs from subframes can be cleaned up correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak. Created 6 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 | « no previous file | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 25255053114218e9cde9e44375e58a69d435b216..64322fe8629c92b1dbb34aa728400048d2ec46ac 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -574,6 +574,33 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsDialogs) {
ui_test_utils::NavigateToURL(browser(), url2);
}
+// Make sure that dialogs opened by subframes are closed when the process dies.
+// See http://crbug.com/366510.
+IN_PROC_BROWSER_TEST_F(BrowserTest, SadTabCancelsSubframeDialogs) {
+ // Navigate to an iframe that opens an alert dialog.
+ WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
+ contents->GetMainFrame()->ExecuteJavaScript(
+ ASCIIToUTF16("window.location.href = 'data:text/html,"
+ "<iframe srcdoc=\"<script>alert(1)</script>\">'"));
+ AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
+ EXPECT_TRUE(alert->IsValid());
+ AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
+ EXPECT_TRUE(dialog_queue->HasActiveDialog());
+
+ // Crash the renderer process and ensure the dialog is gone.
+ content::RenderProcessHost* child_process = contents->GetRenderProcessHost();
+ content::RenderProcessHostWatcher crash_observer(
+ child_process,
+ content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+ base::KillProcess(child_process->GetHandle(), 0, false);
+ crash_observer.Wait();
+ EXPECT_FALSE(dialog_queue->HasActiveDialog());
+
+ // Make sure subsequent navigations work.
+ GURL url2("data:text/html,foo");
+ ui_test_utils::NavigateToURL(browser(), url2);
+}
+
// Test for crbug.com/22004. Reloading a page with a before unload handler and
// then canceling the dialog should not leave the throbber spinning.
IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
« no previous file with comments | « no previous file | content/browser/renderer_host/render_view_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698