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
--- 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;