Bug 772319 - Add an option to disable the "Close other tabs" prompt. r=dao
authorOHZEKI Tetsuharu <saneyuki.s.snyk@gmail.com>
Fri, 05 Oct 2012 11:50:30 -0700
changeset 109413 2c8f5efea9ad7a1d11d35941909e2cebb87c900d
parent 109412 a0f3f60b8b03c94375c3061579ecfe8c5f45fe84
child 109414 64bf5f240ccbb4f6065d25212615718a1adc01f7
push id16015
push userdholbert@mozilla.com
push dateFri, 05 Oct 2012 18:51:13 +0000
treeherdermozilla-inbound@2c8f5efea9ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs772319
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 772319 - Add an option to disable the "Close other tabs" prompt. r=dao
browser/app/profile/firefox.js
browser/base/content/tabbrowser.xml
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -378,16 +378,17 @@ pref("browser.link.open_newwindow.overri
 // 2: don't divert window.open with features
 pref("browser.link.open_newwindow.restriction", 2);
 
 // Tabbed browser
 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);
 pref("browser.tabs.opentabfor.middleclick", true);
 pref("browser.tabs.loadDivertedInBackground", false);
 pref("browser.tabs.loadBookmarksInBackground", false);
 pref("browser.tabs.tabClipWidth", 140);
 pref("browser.tabs.animate", true);
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1445,19 +1445,20 @@
         <![CDATA[
           var tabsToClose = (aAll ?
                                this.tabs.length - this._removingTabs.length :
                                this.visibleTabs.length - 1)
                             - gBrowser._numPinnedTabs;
           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;
 
           // default to true: if it were false, we wouldn't get this far
           var warnOnClose = { value: true };
           var bundle = this.mStringBundle;
 
@@ -1471,23 +1472,23 @@
             ps.confirmEx(window,
                          bundle.getString("tabs.closeWarningTitle"),
                          bundle.getFormattedString("tabs.closeWarningMultipleTabs",
                                                    [tabsToClose]),
                          (ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_0)
                          + (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;
         ]]>
       </body>
       </method>
 
       <method name="removeAllTabsBut">