Bug 1255511 - Skip beforeunload prompts once nsIAppStartup shuttingDown returns true. r?Gijs draft
authorMike Conley <mconley@mozilla.com>
Tue, 15 Mar 2016 14:45:38 -0400
changeset 340691 378266be4409e5163c9b53d1050da9cd405448ae
parent 338095 05c087337043dd8e71cc27bdb5b9d55fd00aaa26
child 516251 cf4408c73603f03b76aaaa4ea5d8e64847fc7893
push id13037
push usermconley@mozilla.com
push dateTue, 15 Mar 2016 21:34:40 +0000
reviewersGijs
bugs1255511
milestone48.0a1
Bug 1255511 - Skip beforeunload prompts once nsIAppStartup shuttingDown returns true. r?Gijs When the application is asked to quit, all windows are checked to see if they can close (which will spawn the permit unload dialogs). Once the user grants the quit via the permit unload dialogs, nsIAppStartup returns true for the shuttingDown attribute, and we know that all windows allowed the shutdown to occur. This means that we don't have to show the permitUnload dialogs again when SessionStore attempts to close the windows when it does its final async window flush during the quit-application-granted observer topic. MozReview-Commit-ID: DOy8ljngnTd
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6119,17 +6119,17 @@ var IndexedDBPromptHelper = {
     timeoutId = setTimeout(timeoutNotification, firstTimeoutDuration);
   }
 };
 
 function CanCloseWindow()
 {
   // Avoid redundant calls to canClose from showing multiple
   // PermitUnload dialogs.
-  if (window.skipNextCanClose) {
+  if (Services.startup.shuttingDown || window.skipNextCanClose) {
     return true;
   }
 
   for (let browser of gBrowser.browsers) {
     let {permitUnload, timedOut} = browser.permitUnload();
     if (timedOut) {
       return true;
     }