Bug 722994 - globalOverlay.js uses global Private Browsing state to control display of a prompt; r=ehsan

This commit is contained in:
Saurabh Anand 2012-06-27 15:14:45 +05:30
parent 9e198d3f62
commit 1651f71fd2
2 changed files with 8 additions and 20 deletions

View File

@ -492,13 +492,6 @@ BrowserGlue.prototype = {
if (!aQuitType)
aQuitType = "quit";
// Never show a prompt inside private browsing mode
var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService).
privateBrowsingEnabled;
if (inPrivateBrowsing)
return;
var showPrompt = false;
var mostRecentBrowserWindow;
@ -530,6 +523,12 @@ BrowserGlue.prototype = {
return;
}
var inPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService).
privateBrowsingEnabled;
if (inPrivateBrowsing)
return;
if (!showPrompt)
return;

View File

@ -16,22 +16,11 @@ function closeWindow(aClose, aPromptFunction)
if (++windowCount == 2)
break;
}
var inPrivateBrowsing = false;
try {
if (["@mozilla.org/privatebrowsing;1"] in Components.classes) {
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("lastwindow"))
return false;
else if (windowCount != 1 || inPrivateBrowsing)
else if (windowCount != 1)
#endif
if (typeof(aPromptFunction) == "function" && !aPromptFunction())
return false;