Bug 952925 - Part 1: Cleanup BrowserGlue._onQuitRequest. r=ehsan

This commit is contained in:
Birunthan Mohanathas 2014-08-08 07:04:45 -07:00
Родитель c70ab152cb
Коммит 5beefd2a99
1 изменённых файлов: 10 добавлений и 15 удалений

Просмотреть файл

@ -865,8 +865,6 @@ BrowserGlue.prototype = {
if (!aQuitType)
aQuitType = "quit";
var mostRecentBrowserWindow;
// browser.warnOnQuit is a hidden global boolean to override all quit prompts
// browser.showQuitWarning specifically covers quitting
// browser.tabs.warnOnClose is the global "warn when closing multiple tabs" pref
@ -876,6 +874,8 @@ BrowserGlue.prototype = {
if (sessionWillBeRestored || !Services.prefs.getBoolPref("browser.warnOnQuit"))
return;
let win = Services.wm.getMostRecentWindow("navigator:browser");
// On last window close or quit && showQuitWarning, we want to show the
// quit warning.
if (!Services.prefs.getBoolPref("browser.showQuitWarning")) {
@ -884,9 +884,8 @@ BrowserGlue.prototype = {
// we should show the window closing warning instead. warnAboutClosing
// tabs checks browser.tabs.warnOnClose and returns if it's ok to close
// the window. It doesn't actually close the window.
mostRecentBrowserWindow = Services.wm.getMostRecentWindow("navigator:browser");
let allTabs = mostRecentBrowserWindow.gBrowser.closingTabsEnum.ALL;
aCancelQuit.data = !mostRecentBrowserWindow.gBrowser.warnAboutClosingTabs(allTabs)
aCancelQuit.data =
!win.gBrowser.warnAboutClosingTabs(win.gBrowser.closingTabsEnum.ALL);
}
return;
}
@ -895,12 +894,12 @@ BrowserGlue.prototype = {
if (allWindowsPrivate)
return;
var quitBundle = Services.strings.createBundle("chrome://browser/locale/quitDialog.properties");
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
let quitBundle = Services.strings.createBundle("chrome://browser/locale/quitDialog.properties");
let brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
var appName = brandBundle.GetStringFromName("brandShortName");
var quitTitleString = "quitDialogTitle";
var quitDialogTitle = quitBundle.formatStringFromName(quitTitleString, [appName], 1);
let appName = brandBundle.GetStringFromName("brandShortName");
let quitDialogTitle = quitBundle.formatStringFromName("quitDialogTitle",
[appName], 1);
var message;
if (windowcount == 1)
@ -923,12 +922,8 @@ BrowserGlue.prototype = {
var button2Title = quitBundle.GetStringFromName("quitTitle");
var neverAskText = quitBundle.GetStringFromName("neverAsk2");
// This wouldn't have been set above since we shouldn't be here for
// aQuitType == "lastwindow"
mostRecentBrowserWindow = Services.wm.getMostRecentWindow("navigator:browser");
var buttonChoice =
promptService.confirmEx(mostRecentBrowserWindow, quitDialogTitle, message,
promptService.confirmEx(win, quitDialogTitle, message,
flags, button0Title, button1Title, button2Title,
neverAskText, neverAsk);