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

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: 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
Index: chrome/browser/ui/unload_controller.cc
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index 4dfcf3633a123951e42894430c0a9e06f2bef200..1d62ccebc6139e8024d5909be0431fd87882135f 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|.

Powered by Google App Engine
This is Rietveld 408576698