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

Unified Diff: chrome/browser/ui/fast_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 comment 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
Index: chrome/browser/ui/fast_unload_controller.cc
diff --git a/chrome/browser/ui/fast_unload_controller.cc b/chrome/browser/ui/fast_unload_controller.cc
index cf90eec33f48031a592144759b0efe8efe75d7f3..0cea0eae8bd275cc3dc49d4daf8d9c50a81f0853 100644
--- a/chrome/browser/ui/fast_unload_controller.cc
+++ b/chrome/browser/ui/fast_unload_controller.cc
@@ -73,7 +73,6 @@ bool FastUnloadController::CanCloseContents(content::WebContents* contents) {
is_calling_before_unload_handlers();
}
-// static
bool FastUnloadController::ShouldRunUnloadEventsHelper(
content::WebContents* contents) {
// If |contents| is being inspected, devtools needs to intercept beforeunload
@@ -81,9 +80,15 @@ bool FastUnloadController::ShouldRunUnloadEventsHelper(
return DevToolsWindow::GetInstanceForInspectedWebContents(contents) != NULL;
}
-// static
bool FastUnloadController::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