Bug 385425, getting the quit prompt when restarting firefox after installing an add on, r=mano

This commit is contained in:
flamingice@sourmilk.net 2007-07-25 14:43:17 -07:00
parent 5b40195253
commit c68744a442
3 changed files with 23 additions and 12 deletions

View File

@ -79,7 +79,7 @@ BrowserGlue.prototype = {
cs.reset();
break;
case "quit-application-requested":
this._onQuitRequest(subject);
this._onQuitRequest(subject, data);
break;
case "quit-application-granted":
if (this._saveSession) {
@ -187,7 +187,7 @@ BrowserGlue.prototype = {
}
},
_onQuitRequest: function(aCancelQuit)
_onQuitRequest: function(aCancelQuit, aQuitType)
{
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
@ -207,6 +207,9 @@ BrowserGlue.prototype = {
if (pagecount < 2)
return;
if (aQuitType != "restart")
aQuitType = "quit";
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
var showPrompt = true;
@ -226,28 +229,33 @@ BrowserGlue.prototype = {
var brandBundle = bundleService.createBundle("chrome://branding/locale/brand.properties");
var appName = brandBundle.GetStringFromName("brandShortName");
var quitDialogTitle = quitBundle.formatStringFromName("quitDialogTitle",
[appName], 1);
var quitTitle = quitBundle.GetStringFromName("quitTitle");
var quitDialogTitle = quitBundle.formatStringFromName(aQuitType + "DialogTitle",
[appName], 1);
var quitTitle = quitBundle.GetStringFromName(aQuitType + "Title");
var cancelTitle = quitBundle.GetStringFromName("cancelTitle");
var saveTitle = quitBundle.GetStringFromName("saveTitle");
var neverAskText = quitBundle.GetStringFromName("neverAsk");
if (windowcount == 1)
var message = quitBundle.formatStringFromName("messageNoWindows",
[appName], 1);
var message;
if (aQuitType == "restart")
message = quitBundle.formatStringFromName("messageRestart",
[appName], 1);
else if (windowcount == 1)
message = quitBundle.formatStringFromName("messageNoWindows",
[appName], 1);
else
var message = quitBundle.formatStringFromName("message",
[appName], 1);
message = quitBundle.formatStringFromName("message",
[appName], 1);
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2 +
promptService.BUTTON_POS_0_DEFAULT;
var neverAsk = {value:false};
if (aQuitType != "restart")
flags += promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_2;
buttonChoice = promptService.confirmEx(null, quitDialogTitle, message,
flags, quitTitle, cancelTitle, saveTitle,
neverAskText, neverAsk);

View File

@ -1,8 +1,11 @@
quitDialogTitle=Quit %S
restartDialogTitle=Restart %S
quitTitle=&Quit
restartTitle=&Restart
cancelTitle=&Cancel
saveTitle=&Save and quit
neverAsk=Do not ask next time
message=Do you want %S to save your tabs and windows for the next time it starts?
messageNoWindows=Do you want %S to save your tabs for the next time it starts?
messageRestart=%S will try to restore your tabs and windows when it restarts.

View File

@ -1502,7 +1502,7 @@ function restartApp() {
.getService(Components.interfaces.nsIObserverService);
var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
.createInstance(Components.interfaces.nsISupportsPRBool);
os.notifyObservers(cancelQuit, "quit-application-requested", null);
os.notifyObservers(cancelQuit, "quit-application-requested", "restart");
// Something aborted the quit process.
if (cancelQuit.data)