Bug 772319 - Add an option to disable the "Close other tabs" prompt. r=dao, a=lsblakk
authorOHZEKI Tetsuharu <saneyuki.s.snyk@gmail.com>
Fri, 05 Oct 2012 11:50:30 -0700
changeset 109691 b14b009ce8aa7e41171a969d0c310cd69662d00f
parent 109690 8c3b288ab1be6d111609008d66844718fa83e478
child 109692 d15dced2abd264fb21b4fab92067d7fec98e1281
push id1617
push userryanvm@gmail.com
push dateSat, 27 Oct 2012 22:28:29 +0000
treeherdermozilla-beta@77455622c8ac [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, lsblakk
bugs772319
milestone17.0
Bug 772319 - Add an option to disable the "Close other tabs" prompt. r=dao, a=lsblakk
browser/app/profile/firefox.js
browser/base/content/tabbrowser.xml
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -376,16 +376,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
@@ -1417,19 +1417,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;
 
@@ -1443,23 +1444,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">