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

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

Issue 1931793002: Stop using nested message loop for alert() and other JS dialogs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated comments and removed unused declaration Created 4 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 | « chrome/browser/ui/unload_controller.h ('k') | chrome/browser/unload_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/unload_controller.cc
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index 449338b5a2ecc03ec2225448ed82aa183fddf024..b28a88b4d07751f1537662568f72d6bca0872133 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -43,7 +43,6 @@ bool UnloadController::CanCloseContents(content::WebContents* contents) {
is_calling_before_unload_handlers();
}
-// static
bool UnloadController::ShouldRunUnloadEventsHelper(
content::WebContents* contents) {
// If |contents| is being inspected, devtools needs to intercept beforeunload
@@ -51,8 +50,14 @@ bool UnloadController::ShouldRunUnloadEventsHelper(
return DevToolsWindow::GetInstanceForInspectedWebContents(contents) != NULL;
}
-// static
bool UnloadController::RunUnloadEventsHelper(content::WebContents* contents) {
+ // Special case for when we quit an application. The devtools window can
+ // close if it's beforeunload event has already fired which will happen due
+ // to the interception of it's content's beforeunload.
+ if (browser_->is_devtools() &&
+ DevToolsWindow::HasFiredBeforeUnloadEventForDevToolsBrowser(browser_))
+ return false;
+
// If there's a devtools window attached to |contents|,
// we would like devtools to call its own beforeunload handlers first,
// and then call beforeunload handlers for |contents|.
« no previous file with comments | « chrome/browser/ui/unload_controller.h ('k') | chrome/browser/unload_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698