Bug 1388422 - Clean up all traces of the 'browser.uiCustomization.disableAnimation' pref used to disable Customize Mode transitions in unit tests. r?Gijs draft
authorMike de Boer <mdeboer@mozilla.com>
Wed, 20 Sep 2017 14:25:58 +0200
changeset 667626 6f6f6526e4fba90ae3f56c471d2822d5dd2df8fe
parent 667608 a20de99fa3c1ba6287fe47d493a859a4e95120b0
child 667627 d552df09385facb4ec4ebc6b52c34162a5695ce6
push id80786
push usermdeboer@mozilla.com
push dateWed, 20 Sep 2017 12:47:46 +0000
reviewersGijs
bugs1388422
milestone57.0a1
Bug 1388422 - Clean up all traces of the 'browser.uiCustomization.disableAnimation' pref used to disable Customize Mode transitions in unit tests. r?Gijs MozReview-Commit-ID: 44Q9NbKEJeC
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/test/head.js
browser/components/search/test/browser_searchbar_openpopup.js
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -4,17 +4,16 @@
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["CustomizeMode"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 const kPrefCustomizationDebug = "browser.uiCustomization.debug";
-const kPrefCustomizationAnimation = "browser.uiCustomization.disableAnimation";
 const kPaletteId = "customization-palette";
 const kDragDataTypePrefix = "text/toolbarwrapper-id/";
 const kSkipSourceNodePref = "browser.uiCustomization.skipSourceNodeCheck";
 const kToolbarVisibilityBtn = "customization-toolbar-visibility-button";
 const kDrawInTitlebarPref = "browser.tabs.drawInTitlebar";
 const kExtraDragSpacePref = "browser.tabs.extraDragSpace";
 const kMaxTransitionDurationMs = 2000;
 const kKeepBroadcastAttributes = "keepbroadcastattributeswhencustomizing";
@@ -54,18 +53,16 @@ XPCOMUtils.defineLazyGetter(this, "log",
   gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false);
   let consoleOptions = {
     maxLogLevel: gDebug ? "all" : "log",
     prefix: "CustomizeMode",
   };
   return new scope.ConsoleAPI(consoleOptions);
 });
 
-var gDisableAnimation = null;
-
 var gDraggingInToolbars;
 
 var gTab;
 
 function closeGlobalTab() {
   let win = gTab.ownerGlobal;
   if (win.gBrowser.browsers.length == 1) {
     win.BrowserOpenTab();
@@ -91,20 +88,16 @@ function unregisterGlobalTab() {
   win.gBrowser.removeTabsProgressListener(gTabsProgressListener);
 
   gTab.removeAttribute("customizemode");
 
   gTab = null;
 }
 
 function CustomizeMode(aWindow) {
-  if (gDisableAnimation === null) {
-    gDisableAnimation = Services.prefs.getPrefType(kPrefCustomizationAnimation) == Ci.nsIPrefBranch.PREF_BOOL &&
-                        Services.prefs.getBoolPref(kPrefCustomizationAnimation);
-  }
   this.window = aWindow;
   this.document = aWindow.document;
   this.browser = aWindow.gBrowser;
   this.areas = new Set();
 
   // There are two palettes - there's the palette that can be overlayed with
   // toolbar items in browser.xul. This is invisible, and never seen by the
   // user. Then there's the visible palette, which gets populated and displayed
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -185,38 +185,34 @@ function getAreaWidgetIds(areaId) {
 function simulateItemDrag(aToDrag, aTarget) {
   synthesizeDrop(aToDrag.parentNode, aTarget);
 }
 
 function endCustomizing(aWindow = window) {
   if (aWindow.document.documentElement.getAttribute("customizing") != "true") {
     return true;
   }
-  Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
   return new Promise(resolve => {
     function onCustomizationEnds() {
-      Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", false);
       aWindow.gNavToolbox.removeEventListener("aftercustomization", onCustomizationEnds);
       resolve();
     }
     aWindow.gNavToolbox.addEventListener("aftercustomization", onCustomizationEnds);
     aWindow.gCustomizeMode.exit();
 
   });
 }
 
 function startCustomizing(aWindow = window) {
   if (aWindow.document.documentElement.getAttribute("customizing") == "true") {
     return null;
   }
-  Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
   return new Promise(resolve => {
     function onCustomizing() {
       aWindow.gNavToolbox.removeEventListener("customizationready", onCustomizing);
-      Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", false);
       resolve();
     }
     aWindow.gNavToolbox.addEventListener("customizationready", onCustomizing);
     aWindow.gCustomizeMode.enter();
   });
 }
 
 function promiseObserverNotified(aTopic) {
--- a/browser/components/search/test/browser_searchbar_openpopup.js
+++ b/browser/components/search/test/browser_searchbar_openpopup.js
@@ -37,27 +37,25 @@ function synthesizeNativeMouseClick(aEle
     utils.sendNativeMouseEvent(x * scale, y * scale, mouseUp, 0, null);
   });
 }
 
 async function endCustomizing(aWindow = window) {
   if (aWindow.document.documentElement.getAttribute("customizing") != "true") {
     return true;
   }
-  await SpecialPowers.pushPrefEnv({set: [["browser.uiCustomization.disableAnimation", true]]});
   let eventPromise = BrowserTestUtils.waitForEvent(aWindow.gNavToolbox, "aftercustomization");
   aWindow.gCustomizeMode.exit();
   return eventPromise;
 }
 
 async function startCustomizing(aWindow = window) {
   if (aWindow.document.documentElement.getAttribute("customizing") == "true") {
     return true;
   }
-  await SpecialPowers.pushPrefEnv({set: [["browser.uiCustomization.disableAnimation", true]]});
   let eventPromise = BrowserTestUtils.waitForEvent(aWindow.gNavToolbox, "customizationready");
   aWindow.gCustomizeMode.enter();
   return eventPromise;
 }
 
 let searchbar;
 let textbox;
 let searchIcon;