Bug 772319 - Add an option to disable the "Close other tabs" prompt. r=dao

This commit is contained in:
OHZEKI Tetsuharu 2012-10-05 11:50:30 -07:00
parent 7edeb4ff2a
commit b1f5762d25
2 changed files with 7 additions and 5 deletions

View File

@ -383,6 +383,7 @@ pref("browser.tabs.autoHide", false);
pref("browser.tabs.closeWindowWithLastTab", true);
pref("browser.tabs.insertRelatedAfterCurrent", true);
pref("browser.tabs.warnOnClose", true);
pref("browser.tabs.warnOnCloseOtherTabs", true);
pref("browser.tabs.warnOnOpen", true);
pref("browser.tabs.maxOpenBeforeWarn", 15);
pref("browser.tabs.loadInBackground", true);

View File

@ -1450,9 +1450,10 @@
if (tabsToClose <= 1)
return true;
var canDisablePrompt = !!aAll;
const pref = "browser.tabs.warnOnClose";
if (canDisablePrompt && !Services.prefs.getBoolPref(pref))
const pref = aAll ?
"browser.tabs.warnOnClose" : "browser.tabs.warnOnCloseOtherTabs";
var shouldPrompt = Services.prefs.getBoolPref(pref);
if (!shouldPrompt)
return true;
var ps = Services.prompt;
@ -1476,13 +1477,13 @@
+ (ps.BUTTON_TITLE_CANCEL * ps.BUTTON_POS_1),
bundle.getString("tabs.closeButtonMultiple"),
null, null,
canDisablePrompt ?
aAll ?
bundle.getString("tabs.closeWarningPromptMe") : null,
warnOnClose);
var reallyClose = (buttonPressed == 0);
// don't set the pref unless they press OK and it's false
if (canDisablePrompt && reallyClose && !warnOnClose.value)
if (aAll && reallyClose && !warnOnClose.value)
Services.prefs.setBoolPref(pref, false);
return reallyClose;