Bug 1380065 - Disable arrow-panel animations if the cosmeticAnimations pref is set to false. r=jaws draft
authorSam Foster <sfoster@mozilla.com>
Thu, 13 Jul 2017 14:30:38 -0400
changeset 614788 effd7fab536294de967661be4dcaaadc5b869db7
parent 614544 462d7561089c98e33382384896434861ad7bc491
child 638967 5a544d3d389ff34a81ed217d6687dd7ef3bd3a8d
push id70126
push userbmo:sfoster@mozilla.com
push dateTue, 25 Jul 2017 01:12:09 +0000
reviewersjaws
bugs1380065
milestone56.0a1
Bug 1380065 - Disable arrow-panel animations if the cosmeticAnimations pref is set to false. r=jaws * Toggle animate=false attribute on arrow panels when toolkit.cosmeticAnimations.enabled is false * Use preferences-service component to lookup the pref in the arrowpanel binding * Disable this pref during tests to remove a source of instability and timing-based test failures in chrome/UI tests. * Enable cosmeticAnimations for tests which depend on existing behavior * Re-enable cosmeticAnimations pref for browser_ext_popup_select.js which is known to be more reliable with animations MozReview-Commit-ID: IvA2ySPPmeJ
browser/base/content/test/about/browser_aboutStopReload.js
browser/base/content/test/alerts/browser_notification_tab_switching.js
browser/base/content/test/general/browser_alltabslistener.js
browser/base/content/test/performance/browser_tabclose_grow_reflows.js
browser/base/content/test/performance/browser_tabclose_reflows.js
browser/base/content/test/performance/browser_tabopen_reflows.js
browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
browser/base/content/test/popupNotifications/head.js
browser/base/content/test/siteIdentity/browser_bug902156.js
browser/base/content/test/tabcrashed/browser_noPermanentKey.js
browser/base/content/test/tabcrashed/browser_withoutDump.js
browser/base/content/test/tabs/browser_tabCloseProbes.js
browser/base/content/test/urlbar/browser_page_action_menu.js
browser/components/extensions/test/browser/browser_ext_popup_select.js
browser/components/migration/tests/browser/browser_undo_notification.js
browser/modules/test/browser/browser_ProcessHangNotifications.js
browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
dom/html/test/test_fullscreen-api-race.html
testing/profiles/prefs_general.js
toolkit/content/tests/chrome/test_arrowpanel.xul
toolkit/content/tests/chrome/test_bug457632.xul
toolkit/content/tests/mochitest/test_mousecapture.xhtml
toolkit/content/widgets/popup.xml
toolkit/themes/osx/mochitests/test_bug510426.xul
--- a/browser/base/content/test/about/browser_aboutStopReload.js
+++ b/browser/base/content/test/about/browser_aboutStopReload.js
@@ -6,16 +6,23 @@ async function getAnimatePromise(elt) {
   return BrowserTestUtils.waitForAttribute("animate", elt)
     .then(() => Assert.ok(true, `${elt.id} should animate`));
 }
 
 function stopReloadMutationCallback() {
   Assert.ok(false, "stop-reload's animate attribute should not have been mutated");
 }
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 add_task(async function checkDontShowStopOnNewTab() {
   let stopReloadContainer = document.getElementById("stop-reload-button");
   let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback);
 
   await waitForNoAnimation(stopReloadContainer);
   stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
   let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
                                                         opening: "about:robots",
--- a/browser/base/content/test/alerts/browser_notification_tab_switching.js
+++ b/browser/base/content/test/alerts/browser_notification_tab_switching.js
@@ -4,16 +4,23 @@
 
 "use strict";
 
 var tab;
 var notification;
 var notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
 var newWindowOpenedFromTab;
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 add_task(async function test_notificationPreventDefaultAndSwitchTabs() {
   let pm = Services.perms;
   pm.add(makeURI(notificationURL), "desktop-notification", pm.ALLOW_ACTION);
 
   let originalTab = gBrowser.selectedTab;
   await BrowserTestUtils.withNewTab({
     gBrowser,
     url: notificationURL
--- a/browser/base/content/test/general/browser_alltabslistener.js
+++ b/browser/base/content/test/general/browser_alltabslistener.js
@@ -79,19 +79,27 @@ var gAllProgressListener = {
 }
 
 var gFrontNotifications, gAllNotifications, gFrontNotificationsPos, gAllNotificationsPos;
 var gBackgroundTab, gForegroundTab, gBackgroundBrowser, gForegroundBrowser, gTestBrowser;
 var gTestPage = "/browser/browser/base/content/test/general/alltabslistener.html";
 const kBasePage = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
 var gNextTest;
 
+
 function test() {
   waitForExplicitFinish();
 
+  // run these tests with notification animations enabled
+  const origAnimationsPrefValue = Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
+  Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", true);
+  registerCleanupFunction(() => {
+    Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", origAnimationsPrefValue);
+  });
+
   gBackgroundTab = BrowserTestUtils.addTab(gBrowser);
   gForegroundTab = BrowserTestUtils.addTab(gBrowser);
   gBackgroundBrowser = gBrowser.getBrowserForTab(gBackgroundTab);
   gForegroundBrowser = gBrowser.getBrowserForTab(gForegroundTab);
   gBrowser.selectedTab = gForegroundTab;
 
   // We must wait until a page has completed loading before
   // starting tests or we get notifications from that
--- a/browser/base/content/test/performance/browser_tabclose_grow_reflows.js
+++ b/browser/base/content/test/performance/browser_tabclose_grow_reflows.js
@@ -10,16 +10,23 @@
  * for tips on how to do that.
  */
 const EXPECTED_REFLOWS = [
   /**
    * Nothing here! Please don't add anything new!
    */
 ];
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when closing a tab that will
  * cause the existing tabs to grow bigger.
  */
 add_task(async function() {
   await ensureNoPreloadedBrowser();
 
--- a/browser/base/content/test/performance/browser_tabclose_reflows.js
+++ b/browser/base/content/test/performance/browser_tabclose_reflows.js
@@ -10,16 +10,23 @@
  * for tips on how to do that.
  */
 const EXPECTED_REFLOWS = [
   /**
    * Nothing here! Please don't add anything new!
    */
 ];
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when closing new tabs.
  */
 add_task(async function() {
   await ensureNoPreloadedBrowser();
 
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
--- a/browser/base/content/test/performance/browser_tabopen_reflows.js
+++ b/browser/base/content/test/performance/browser_tabopen_reflows.js
@@ -15,16 +15,23 @@
 const EXPECTED_REFLOWS = [
   // selection change notification may cause querying the focused editor content
   // by IME and that will cause reflow.
   [
     "select@chrome://global/content/bindings/textbox.xml",
   ],
 ];
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when opening new tabs.
  */
 add_task(async function() {
   await ensureNoPreloadedBrowser();
 
   // Add a reflow observer and open a new tab.
--- a/browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
+++ b/browser/base/content/test/performance/browser_tabopen_squeeze_reflows.js
@@ -12,16 +12,23 @@
 const EXPECTED_REFLOWS = [
   [
     "select@chrome://global/content/bindings/textbox.xml",
     "focusAndSelectUrlBar@chrome://browser/content/browser.js",
     "_adjustFocusAfterTabSwitch@chrome://browser/content/tabbrowser.xml",
   ],
 ];
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 /*
  * This test ensures that there are no unexpected
  * uninterruptible reflows when opening a new tab that will
  * cause the existing tabs to squeeze smaller.
  */
 add_task(async function() {
   await ensureNoPreloadedBrowser();
 
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -63,21 +63,26 @@ function promiseTabLoadEvent(tab, url) {
 }
 
 const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notification_enable_delay");
 
 // Tests that call setup() should have a `tests` array defined for the actual
 // tests to be run.
 /* global tests */
 function setup() {
+  // run these tests with notification animations enabled
+  const origAnimationsPrefValue = Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled");
+  Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", true);
+
   BrowserTestUtils.openNewForegroundTab(gBrowser, "http://example.com/")
                   .then(goNext);
   registerCleanupFunction(() => {
     gBrowser.removeTab(gBrowser.selectedTab);
     PopupNotifications.buttonDelay = PREF_SECURITY_DELAY_INITIAL;
+    Services.prefs.setBoolPref("toolkit.cosmeticAnimations.enabled", origAnimationsPrefValue);
   });
 }
 
 function goNext() {
   executeSoon(() => executeSoon(runNextTest));
 }
 
 async function runNextTest() {
--- a/browser/base/content/test/siteIdentity/browser_bug902156.js
+++ b/browser/base/content/test/siteIdentity/browser_bug902156.js
@@ -18,27 +18,30 @@
  *    - Load a different html page which has mixed content
  *    - Control Center button to disable protection should appear again because
  *      we navigated away from html page where we disabled the protection.
  *
  * Note, for all tests we set gHttpTestRoot to use 'https'.
  */
 
 const PREF_ACTIVE = "security.mixed_content.block_active_content";
+const ANIMATIONS_ENABLED = "toolkit.cosmeticAnimations.enabled";
 
 // We alternate for even and odd test cases to simulate different hosts
 const HTTPS_TEST_ROOT_1 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test1.example.com");
 const HTTPS_TEST_ROOT_2 = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://test2.example.com");
 
 var origBlockActive;
+var origAnimationsPrefValue;
 var gTestBrowser = null;
 
 registerCleanupFunction(function() {
   // Set preferences back to their original values
   Services.prefs.setBoolPref(PREF_ACTIVE, origBlockActive);
+  Services.prefs.setBoolPref(ANIMATIONS_ENABLED, origAnimationsPrefValue);
 });
 
 function cleanUpAfterTests() {
   gBrowser.removeCurrentTab();
   window.focus();
   finish();
 }
 
@@ -153,18 +156,21 @@ function test3A() {
 // ------------------------------------------------------
 
 function test() {
   // Performing async calls, e.g. 'onload', we have to wait till all of them finished
   waitForExplicitFinish();
 
   // Store original preferences so we can restore settings after testing
   origBlockActive = Services.prefs.getBoolPref(PREF_ACTIVE);
+  origAnimationsPrefValue = Services.prefs.getBoolPref(ANIMATIONS_ENABLED);
 
-  Services.prefs.setBoolPref(PREF_ACTIVE, true);
+Services.prefs.setBoolPref(PREF_ACTIVE, true);
+  // run these tests with animations enabled
+  Services.prefs.setBoolPref(ANIMATIONS_ENABLED, true);
 
   // Not really sure what this is doing
   var newTab = BrowserTestUtils.addTab(gBrowser);
   gBrowser.selectedTab = newTab;
   gTestBrowser = gBrowser.selectedBrowser;
   newTab.linkedBrowser.stop()
 
   // Starting Test Number 1:
--- a/browser/base/content/test/tabcrashed/browser_noPermanentKey.js
+++ b/browser/base/content/test/tabcrashed/browser_noPermanentKey.js
@@ -1,12 +1,19 @@
 "use strict";
 
 const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 add_task(async function setup() {
   await setupLocalCrashReportServer();
 });
 
 /**
  * Tests tab crash page when a browser that somehow doesn't have a permanentKey
  * crashes.
  */
--- a/browser/base/content/test/tabcrashed/browser_withoutDump.js
+++ b/browser/base/content/test/tabcrashed/browser_withoutDump.js
@@ -1,17 +1,22 @@
 "use strict";
 
 const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
 
 /**
  * Monkey patches TabCrashHandler.getDumpID to return null in order to test
  * about:tabcrashed when a dump is not available.
+ * Set pref to ensure these tests are run with notification animations enabled
  */
 add_task(async function setup() {
+  // run these tests with animations enabled
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
   let originalGetDumpID = TabCrashHandler.getDumpID;
   TabCrashHandler.getDumpID = function(browser) { return null; };
   registerCleanupFunction(() => {
     TabCrashHandler.getDumpID = originalGetDumpID;
   });
 });
 
 /**
--- a/browser/base/content/test/tabs/browser_tabCloseProbes.js
+++ b/browser/base/content/test/tabs/browser_tabCloseProbes.js
@@ -22,18 +22,22 @@ function assertCount(snapshot, expectedC
   // snapshot.count entries
   Assert.equal(snapshot.counts.reduce((a, b) => a + b), expectedCount,
                `Should only be ${expectedCount} collected value.`);
 }
 
 add_task(async function setup() {
   // These probes are opt-in, meaning we only capture them if extended
   // Telemetry recording is enabled.
+  // Run these tests with animations enabled
   await SpecialPowers.pushPrefEnv({
-    set: [["toolkit.telemetry.enabled", true]]
+    set: [
+      ["toolkit.telemetry.enabled", true],
+      ["toolkit.cosmeticAnimations.enabled", true]
+    ]
   });
 
   let oldCanRecord = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
   registerCleanupFunction(() => {
     Services.telemetry.canRecordExtended = oldCanRecord;
   });
 });
--- a/browser/base/content/test/urlbar/browser_page_action_menu.js
+++ b/browser/base/content/test/urlbar/browser_page_action_menu.js
@@ -10,16 +10,23 @@ registerCleanupFunction(function() {
 Cu.import("resource://services-sync/UIState.jsm");
 
 const mockRemoteClients = [
   { id: "0", name: "foo", type: "mobile" },
   { id: "1", name: "bar", type: "desktop" },
   { id: "2", name: "baz", type: "mobile" },
 ];
 
+// run these tests with animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 add_task(async function bookmark() {
   // Open a unique page.
   let url = "http://example.com/browser_page_action_menu";
   await BrowserTestUtils.withNewTab(url, async () => {
     // Open the panel.
     await promisePageActionPanelOpen();
 
     // The bookmark button should read "Bookmark This Page" and not be starred.
--- a/browser/components/extensions/test/browser/browser_ext_popup_select.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_select.js
@@ -1,12 +1,19 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
+// run these tests with animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]],
+  });
+});
+
 add_task(async function testPopupSelectPopup() {
   let extension = ExtensionTestUtils.loadExtension({
     background() {
       browser.tabs.query({active: true, currentWindow: true}, tabs => {
         browser.pageAction.show(tabs[0].id);
       });
     },
 
--- a/browser/components/migration/tests/browser/browser_undo_notification.js
+++ b/browser/components/migration/tests/browser/browser_undo_notification.js
@@ -1,21 +1,29 @@
 "use strict";
 
 let scope = {};
 Cu.import("resource:///modules/AutoMigrate.jsm", scope);
 let oldCanUndo = scope.AutoMigrate.canUndo;
 let oldUndo = scope.AutoMigrate.undo;
+
 registerCleanupFunction(function() {
   scope.AutoMigrate.canUndo = oldCanUndo;
   scope.AutoMigrate.undo = oldUndo;
 });
 
 const kExpectedNotificationId = "automigration-undo";
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 add_task(async function autoMigrationUndoNotificationShows() {
   let getNotification = browser =>
     gBrowser.getNotificationBox(browser).getNotificationWithValue(kExpectedNotificationId);
 
   scope.AutoMigrate.canUndo = () => true;
   let undoCalled;
   scope.AutoMigrate.undo = () => { undoCalled = true };
 
--- a/browser/modules/test/browser/browser_ProcessHangNotifications.js
+++ b/browser/modules/test/browser/browser_ProcessHangNotifications.js
@@ -21,16 +21,23 @@ function promiseReportCallMade(aValue) {
     gTestHangReport.testCallback = function(val) {
       gTestHangReport.testCallback = old;
       is(aValue, val, "was the correct method call made on the hang report object?");
       resolve();
     };
   });
 }
 
+// run these tests with notification animations enabled
+add_task(async function setup() {
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+});
+
 function pushPrefs(...aPrefs) {
   return SpecialPowers.pushPrefEnv({"set": aPrefs});
 }
 
 function popPrefs() {
   return SpecialPowers.popPrefEnv();
 }
 
--- a/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
+++ b/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
@@ -167,16 +167,21 @@ function waitForIgnoredReports(reportIDs
     promises.push(OS.File.exists(file.path));
   }
   return Promise.all(promises);
 }
 
 let gNotificationBox;
 
 add_task(async function setup() {
+  // run these tests with notification animations enabled
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+
   // Pending crash reports are stored in the UAppData folder,
   // which exists outside of the profile folder. In order to
   // not overwrite / clear pending crash reports for the poor
   // soul who runs this test, we use AppData.jsm to point to
   // a special made-up directory inside the profile
   // directory.
   await makeFakeAppDir();
   // We'll assume that the notifications will be shown in the current
--- a/dom/html/test/test_fullscreen-api-race.html
+++ b/dom/html/test/test_fullscreen-api-race.html
@@ -17,16 +17,24 @@ function Deferred() {
 
 function checkIsChromeFullscreen(win, inFullscreen) {
   return SimpleTest.promiseWaitForCondition(
     () => win.fullScreen == inFullscreen,
     "The window should exit fullscreen state");
 }
 
 SimpleTest.waitForExplicitFinish();
+
+// run these tests with animations enabled
+const origAnimationsPrefValue = SpecialPowers.getBoolPref("toolkit.cosmeticAnimations.enabled");
+SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", true);
+SimpleTest.registerCleanupFunction(() => {
+  SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", origAnimationsPrefValue);
+});
+
 // XXX This actually exposes a true race condition, but it could rarely
 // happen in real world, because it only happens when requestFullscreen
 // is called immediately after exiting fullscreen in certain condition,
 // and in real life, requestFullscreen can only be called inside a user
 // event handler. But we want to fix this race condition at some point,
 // via queuing all exiting request as well as entering request together
 // which we may eventually need to do for bug 1188256.
 SimpleTest.requestFlakyTimeout(
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -255,16 +255,19 @@ user_pref("toolkit.telemetry.server", "h
 // might wait on the pingsender to finish and slow down tests.
 user_pref("toolkit.telemetry.newProfilePing.enabled", false);
 
 // A couple of preferences with default values to test that telemetry preference
 // watching is working.
 user_pref("toolkit.telemetry.test.pref1", true);
 user_pref("toolkit.telemetry.test.pref2", false);
 
+// Disable cosmetic-only UI animations and transitions
+user_pref("toolkit.cosmeticAnimations.enabled", false);
+
 // We don't want to hit the real Firefox Accounts server for tests.  We don't
 // actually need a functioning FxA server, so just set it to something that
 // resolves and accepts requests, even if they all fail.
 user_pref("identity.fxaccounts.auth.uri", "https://%(server)s/fxa-dummy/");
 
 // Ditto for all the other Firefox accounts URIs used for about:accounts et al.:
 user_pref("identity.fxaccounts.remote.signup.uri", "https://%(server)s/fxa-signup");
 user_pref("identity.fxaccounts.remote.force_auth.uri", "https://%(server)s/fxa-force-auth");
--- a/toolkit/content/tests/chrome/test_arrowpanel.xul
+++ b/toolkit/content/tests/chrome/test_arrowpanel.xul
@@ -189,26 +189,33 @@ function* nextTest()
         ok(!animatedPopupShown, "popupshown not fired yet")
       } else {
         is($("animatepanel").state, "open", "state is open after transitionend");
         ok(animatedPopupShown, "popupshown now fired")
         SimpleTest.executeSoon(() => runNextTest.next());
       }
     }
 
+    // Run this check with animations enabled
+    let origPrefValue = SpecialPowers.getBoolPref("toolkit.cosmeticAnimations.enabled");
+    SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", true);
+
     // Check that the transition occurs for an arrow panel with animate="true"
     window.addEventListener("transitionend", transitionEnded, false);
     $("animatepanel").openPopup($("topleft"), "after_start", 0, 0, false, false, null, "start");
     is($("animatepanel").state, "showing", "state is showing");
     yield;
     window.removeEventListener("transitionend", transitionEnded, false);
 
     synthesizeKey("VK_ESCAPE", { });
     ok(!animatedPopupHidden, "animated popup not hidden yet");
     yield;
+
+    // restore the pref value
+    SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", origPrefValue);
   }
 
   SimpleTest.finish()
 }
 
 function setScale(win, scale)
 {
   var wn = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
--- a/toolkit/content/tests/chrome/test_bug457632.xul
+++ b/toolkit/content/tests/chrome/test_bug457632.xul
@@ -1,17 +1,17 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
 <!--
   XUL Widget Test for bug 457632
   -->
 <window title="Bug 457632" width="500" height="600"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>  
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <notificationbox id="nb"/>
 
   <!-- test results are displayed in the html:body -->
   <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"
         onload="test()"/>
 
   <!-- test code goes here -->
@@ -23,18 +23,24 @@ function completeAnimation(nextTest) {
   if (!gNotificationBox._animating) {
     nextTest();
     return;
   }
 
   setTimeout(completeAnimation, 50, nextTest);
 }
 
-function test() {
+async function test() {
   SimpleTest.waitForExplicitFinish();
+
+  // run these tests with notification animations enabled
+  await SpecialPowers.pushPrefEnv({
+    "set": [["toolkit.cosmeticAnimations.enabled", true]]
+  });
+
   gNotificationBox = document.getElementById("nb");
 
   is(gNotificationBox.allNotifications.length, 0, "There should be no initial notifications");
   gNotificationBox.appendNotification("Test notification",
                                       "notification1", null,
                                       gNotificationBox.PRIORITY_INFO_LOW,
                                       null);
   is(gNotificationBox.allNotifications.length, 1, "Notification exists while animating in");
--- a/toolkit/content/tests/mochitest/test_mousecapture.xhtml
+++ b/toolkit/content/tests/mochitest/test_mousecapture.xhtml
@@ -20,16 +20,23 @@ SimpleTest.waitForExplicitFinish();
 
 const TEST_PATH = location.href.replace("test_mousecapture.xhtml", "");
 
 var captureRetargetMode = false;
 var cachedMouseDown = null;
 var previousWidth = 0, originalWidth = 0;
 var loadInWindow = false;
 
+  // run these tests with animations enabled
+const origAnimationsPrefValue = SpecialPowers.getBoolPref("toolkit.cosmeticAnimations.enabled");
+SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", true);
+SimpleTest.registerCleanupFunction(() => {
+  SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", origAnimationsPrefValue);
+})
+
 function splitterCallback(adjustment) {
   var newWidth = Number($("leftbox").width); // getBoundingClientRect().width;
   var expectedWidth = previousWidth + adjustment;
   if (expectedWidth > $("splitterbox").getBoundingClientRect().width)
     expectedWidth = $("splitterbox").getBoundingClientRect().width - $("splitter").getBoundingClientRect().width;
   is(newWidth, expectedWidth, "splitter left box size (" + adjustment + ")");
   previousWidth = newWidth;
 }
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -397,16 +397,17 @@
         </xul:box>
         <xul:box class="panel-arrowcontent" xbl:inherits="side,align,dir,orient,pack" flex="1">
           <children/>
         </xul:box>
       </xul:vbox>
     </content>
     <implementation>
       <field name="_fadeTimer">null</field>
+      <field name="_previousAnimateAttrValue">null</field>
       <method name="sizeTo">
         <parameter name="aWidth"/>
         <parameter name="aHeight"/>
         <body>
         <![CDATA[
           this.popupBoxObject.sizeTo(aWidth, aHeight);
           if (this.state == "open") {
             this.adjustArrowPosition();
@@ -482,16 +483,26 @@
         }
         ]]>
         </body>
       </method>
     </implementation>
     <handlers>
       <handler event="popupshowing" phase="target">
       <![CDATA[
+        let prefsService = Components.classes["@mozilla.org/preferences-service;1"]
+                              .getService(Components.interfaces.nsIPrefBranch);
+        let animationsEnabled = prefsService.getBoolPref("toolkit.cosmeticAnimations.enabled");
+        if (!animationsEnabled) {
+          this._previousAnimateAttrValue = this.getAttribute("animate");
+          this.setAttribute("animate", "false");
+        } else {
+          this._previousAnimateAttrValue = null;
+        }
+
         var arrow = document.getAnonymousElementByAttribute(this, "anonid", "arrow");
         arrow.hidden = this.anchorNode == null;
         document.getAnonymousElementByAttribute(this, "anonid", "arrowbox")
                 .style.removeProperty("transform");
 
         this.adjustArrowPosition();
 
         if (this.getAttribute("animate") != "false") {
@@ -524,17 +535,20 @@
           this.setAttribute("animate", "cancel");
         }
       </handler>
       <handler event="popupshown" phase="target">
         this.setAttribute("panelopen", "true");
       </handler>
       <handler event="popuphidden" phase="target">
         this.removeAttribute("panelopen");
-        if (this.getAttribute("animate") != "false") {
+
+        if (this._previousAnimateAttrValue == "false") {
+          this.setAttribute("animate", this._previousAnimateAttrValue);
+        } else {
           this.removeAttribute("animate");
         }
       </handler>
       <handler event="popuppositioned" phase="target">
         this.adjustArrowPosition();
       </handler>
     </handlers>
   </binding>
--- a/toolkit/themes/osx/mochitests/test_bug510426.xul
+++ b/toolkit/themes/osx/mochitests/test_bug510426.xul
@@ -32,23 +32,19 @@ function openNotification() {
   var nb = document.getElementById("nb");
   var n = nb.appendNotification("Notification", "", null,
                                 nb.PRIORITY_WARNING_LOW, [{
                                   label: "Button",
                                   accesskey: "u",
                                   callback: null,
                                   popup: null
                                 }]);
-  n.addEventListener("transitionend", function (event) {
-    if (event.propertyName == "margin-top") {
-      setTimeout(function () {
-        is(n.getBoundingClientRect().height, 27, "notification bar has wrong height");
-        SimpleTest.finish();
-      }, 0);
-    }
-  }, false);
+  setTimeout(function () {
+    is(n.getBoundingClientRect().height, 27, "notification bar has wrong height");
+    SimpleTest.finish();
+  }, 0);
 }
 
 window.onload = openNotification;
 
 ]]>
 </script>
 </window>