bug 433018, patch by gavin, r+ui-r+a=me
authormconnor@steelgryphon.com
Sat, 10 May 2008 08:52:32 -0700
changeset 15108 cb0bcaf2770b9941b6cb92527a7c513de5091bc1
parent 15107 98642924e18457d553b27ad96bad113d9ee836cb
child 15109 be617a342bdf574a8870dcb776dc0f10417ce3e5
push idunknown
push userunknown
push dateunknown
bugs433018
milestone1.9pre
bug 433018, patch by gavin, r+ui-r+a=me
browser/components/nsBrowserGlue.js
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -263,22 +263,32 @@ BrowserGlue.prototype = {
   _onQuitRequest: function(aCancelQuit, aQuitType)
   {
     // If user has already dismissed quit request, then do nothing
     if ((aCancelQuit instanceof Ci.nsISupportsPRBool) && aCancelQuit.data)
       return;
 
     var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
              getService(Ci.nsIWindowMediator);
+
     var windowcount = 0;
+    var pagecount = 0;
     var browserEnum = wm.getEnumerator("navigator:browser");
-    while (browserEnum.hasMoreElements() && browserEnum.getNext())
-       windowcount++;
+    while (browserEnum.hasMoreElements()) {
+      windowcount++;
+
+      var browser = browserEnum.getNext();
+      var tabbrowser = browser.document.getElementById("content");
+      if (tabbrowser)
+        pagecount += tabbrowser.browsers.length;
+    }
 
     this._saveSession = false;
+    if (pagecount < 2)
+      return;
 
     if (aQuitType != "restart")
       aQuitType = "quit";
 
     var prefBranch = Cc["@mozilla.org/preferences-service;1"].
                      getService(Ci.nsIPrefBranch);
     var showPrompt = true;
     try {