Backed out changeset 0da508ef253c (bug 896291) for mochitest-bc failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 17 Sep 2013 13:44:36 -0400
changeset 147433 ef744779aca21e3a251516d3130e8ae887924406
parent 147432 2d9b7fe6927636dcdf6b41fd9a2464377f11c515
child 147434 54f0359f93bf69218baded1962c492a9e2994f3e
push id2710
push userryanvm@gmail.com
push dateTue, 17 Sep 2013 17:44:36 +0000
treeherderfx-team@ef744779aca2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs896291
milestone27.0a1
backs out0da508ef253c9d3db0dcfa6d3f0b9f4bce8968b2
Backed out changeset 0da508ef253c (bug 896291) for mochitest-bc failures. CLOSED TREE
browser/base/content/tabbrowser.xml
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug896291.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1662,36 +1662,19 @@
                 throw new Error("Required argument missing: aTab");
 
               tabsToClose = this.getTabsToTheEndFrom(aTab).length;
               break;
             default:
               throw new Error("Invalid argument: " + aCloseTabs);
           }
 
-          let maxUndo =
-            Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
-          let warnOnCloseOtherTabs =
-            Services.prefs.getBoolPref("browser.tabs.warnOnCloseOtherTabs");
-          let warnOnCloseWindow =
-            Services.prefs.getBoolPref("browser.tabs.warnOnClose");
-          let isWindowClosing = aCloseTabs == this.closingTabsEnum.ALL;
-
-          let skipWarning =
-            // 1) If there is only one tab to close, we'll never warn the user.
-            tabsToClose <= 1 ||
-            // 2) If the whole window is going to be closed, don't warn the
-            //    user if the user has browser.tabs.warnOnClose set to false.
-            (isWindowClosing && !warnOnCloseWindow) ||
-            // 3) If the number of tabs are less than the undo threshold
-            //    or if the user has specifically opted-in to ignoring
-            //    this warning via the warnOnCloseOtherTabs pref.
-            (!isWindowClosing && (!warnOnCloseOtherTabs ||
-                                            tabsToClose <= maxUndo));
-          if (skipWarning)
+          if (tabsToClose <= 1 ||
+              aCloseTabs != this.closingTabsEnum.ALL ||
+              !Services.prefs.getBoolPref("browser.tabs.warnOnClose"))
             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;
 
@@ -1710,21 +1693,18 @@
                          + (ps.BUTTON_TITLE_CANCEL * ps.BUTTON_POS_1),
                          bundle.getString("tabs.closeButtonMultiple"),
                          null, null,
                          bundle.getString("tabs.closeWarningPromptMe"),
                          warnOnClose);
           var reallyClose = (buttonPressed == 0);
 
           // don't set the pref unless they press OK and it's false
-          if (reallyClose && !warnOnClose.value) {
-            let pref = isWindowClosing ? "browser.tabs.warnOnClose" :
-                                         "browser.tabs.warnOnCloseOtherTabs";
-            Services.prefs.setBoolPref(pref, false);
-          }
+          if (reallyClose && !warnOnClose.value)
+            Services.prefs.setBoolPref("browser.tabs.warnOnClose", false);
 
           return reallyClose;
         ]]>
       </body>
       </method>
 
       <method name="getTabsToTheEndFrom">
         <parameter name="aTab"/>
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -178,17 +178,16 @@ MOCHITEST_BROWSER_FILES = \
                  browser_bug820497.js \
                  browser_bug822367.js \
                  browser_bug902156.js \
                  browser_bug832435.js \
                  browser_bug839103.js \
                  browser_bug880101.js \
                  browser_bug882977.js \
                  browser_bug887515.js \
-                 browser_bug896291.js \
                  browser_canonizeURL.js \
                  browser_mixedcontent_securityflags.js \
                  browser_clearplugindata_noage.html \
                  browser_clearplugindata.html \
                  browser_clearplugindata.js \
                  browser_contentAreaClick.js \
                  browser_contextSearchTabPosition.js \
                  browser_CTP_drag_drop.js \
deleted file mode 100644
--- a/browser/base/content/test/browser_bug896291.js
+++ /dev/null
@@ -1,92 +0,0 @@
-function numClosedTabs()
-  Cc["@mozilla.org/browser/sessionstore;1"].
-    getService(Ci.nsISessionStore).
-    getNumberOfTabsClosedLast(window);
-
-const kPromptServiceUUID = "{6cc9c9fe-bc0b-432b-a410-253ef8bcc699}";
-const kPromptServiceContractID = "@mozilla.org/embedcomp/prompt-service;1";
-const Cm = Components.manager;
-
-// Save original prompt service factory
-const kPromptServiceFactory = Cm.getClassObject(Cc[kPromptServiceContractID],
-                                                Ci.nsIFactory);
-
-let fakePromptServiceFactory = {
-  createInstance: function(aOuter, aIid) {
-    if (aOuter != null)
-      throw Cr.NS_ERROR_NO_AGGREGATION;
-    return promptService.QueryInterface(aIid);
-  }
-};
-
-// This will first return 1 as the button pressed (cancel), and
-// all subsequent calls will return 0 (accept).
-let buttonPressed = 1;
-let promptService = {
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIPromptService]),
-  confirmEx: function() {
-    return Math.max(buttonPressed--, 0);
-  }
-};
-
-Cm.QueryInterface(Ci.nsIComponentRegistrar)
-  .registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
-                   kPromptServiceContractID, fakePromptServiceFactory);
-
-let originalTab;
-let maxTabsUndo;
-let maxTabsUndoPlusOne;
-
-function verifyUndoMultipleClose() {
-  gBrowser.removeAllTabsBut(originalTab);
-  is(gBrowser.tabs.length, 1 + maxTabsUndoPlusOne, /* The '1 +' is for the original tab */
-     "All tabs should still be open when the 'Cancel' option on the prompt is chosen");
-  gBrowser.removeAllTabsBut(originalTab);
-  is(gBrowser.tabs.length, 1,
-     "All other tabs should be closed when the 'OK' option on the prompt is chosen");
-  finish();
-}
-
-function test() {
-  waitForExplicitFinish();
-  Services.prefs.setBoolPref("browser.tabs.animate", false);
-
-  registerCleanupFunction(function() {
-    Services.prefs.clearUserPref("browser.tabs.animate");
-
-    // Unregister the factory so we do not leak
-    Cm.QueryInterface(Ci.nsIComponentRegistrar)
-      .unregisterFactory(Components.ID(kPromptServiceUUID),
-                         fakePromptServiceFactory);
-
-    // Restore the original factory
-    Cm.QueryInterface(Ci.nsIComponentRegistrar)
-      .registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
-                       kPromptServiceContractID, kPromptServiceFactory);
-
-    originalTab.linkedBrowser.loadURI("about:blank");
-    originalTab = null;
-  });
-
-  let undoCloseTabElement = document.getElementById("context_undoCloseTab");
-  updateTabContextMenu();
-  is(undoCloseTabElement.label, undoCloseTabElement.getAttribute("singletablabel"),
-     "The label should be showing that the command will restore a single tab");
-
-  originalTab = gBrowser.selectedTab;
-  gBrowser.selectedBrowser.loadURI("http://mochi.test:8888/");
-
-  maxTabsUndo = Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo");
-  maxTabsUndoPlusOne = maxTabsUndo + 1;
-  let numberOfTabsLoaded = 0;
-  for (let i = 0; i < maxTabsUndoPlusOne; i++) {
-    let tab = gBrowser.addTab("http://mochi.test:8888/");
-    let browser = gBrowser.getBrowserForTab(tab);
-    browser.addEventListener("load", function onLoad() {
-      browser.removeEventListener("load", onLoad, true);
-
-      if (++numberOfTabsLoaded == maxTabsUndoPlusOne)
-        verifyUndoMultipleClose();
-    }, true);
-  }
-}