Bug 502307 - Closing multiple tabs in the last browser window with Private Browsing enabled yields no warning regardless of preference setting; r=enndeakin

This commit is contained in:
Ehsan Akhgari 2009-07-17 23:08:22 +04:30
parent 0ffe947eb7
commit c339c67f28

View File

@ -13,10 +13,19 @@ function closeWindow(aClose, aPromptFunction)
break;
}
var inPrivateBrowsing = false;
try {
var pbSvc = Components.classes["@mozilla.org/privatebrowsing;1"]
.getService(Components.interfaces.nsIPrivateBrowsingService);
inPrivateBrowsing = pbSvc.privateBrowsingEnabled;
} catch(e) {
// safe to ignore
}
// If we're down to the last window and someone tries to shut down, check to make sure we can!
if (windowCount == 1 && !canQuitApplication())
return false;
else if (windowCount != 1)
else if (windowCount != 1 || inPrivateBrowsing)
#endif
if (typeof(aPromptFunction) == "function" && !aPromptFunction())
return false;