зеркало из https://github.com/mozilla/gecko-dev.git
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 --HG-- extra : rebase_source : 577f534d2409da76eecd6c36dfa3db50eca50f40
This commit is contained in:
Родитель
7ae4dbf848
Коммит
fef0cddea2
|
@ -11,6 +11,13 @@ 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);
|
||||
|
|
|
@ -9,6 +9,13 @@ 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);
|
||||
|
|
|
@ -84,9 +84,17 @@ 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);
|
||||
|
|
|
@ -15,6 +15,13 @@ const EXPECTED_REFLOWS = [
|
|||
*/
|
||||
];
|
||||
|
||||
// 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
|
||||
|
|
|
@ -15,6 +15,13 @@ const EXPECTED_REFLOWS = [
|
|||
*/
|
||||
];
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -20,6 +20,13 @@ const EXPECTED_REFLOWS = [
|
|||
],
|
||||
];
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -17,6 +17,13 @@ const EXPECTED_REFLOWS = [
|
|||
],
|
||||
];
|
||||
|
||||
// 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
|
||||
|
|
|
@ -68,11 +68,16 @@ const PREF_SECURITY_DELAY_INITIAL = Services.prefs.getIntPref("security.notifica
|
|||
// 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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -23,17 +23,20 @@
|
|||
*/
|
||||
|
||||
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() {
|
||||
|
@ -158,8 +161,11 @@ function test() {
|
|||
|
||||
// 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);
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
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();
|
||||
});
|
||||
|
|
|
@ -5,8 +5,13 @@ const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20pag
|
|||
/**
|
||||
* 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(() => {
|
||||
|
|
|
@ -27,8 +27,12 @@ function assertCount(snapshot, expectedCount) {
|
|||
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;
|
||||
|
|
|
@ -15,6 +15,13 @@ const mockRemoteClients = [
|
|||
{ 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";
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
/* 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() {
|
||||
|
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
@ -11,6 +12,13 @@ registerCleanupFunction(function() {
|
|||
|
||||
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);
|
||||
|
|
|
@ -26,6 +26,13 @@ function promiseReportCallMade(aValue) {
|
|||
});
|
||||
}
|
||||
|
||||
// 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});
|
||||
}
|
||||
|
|
|
@ -172,6 +172,11 @@ function waitForIgnoredReports(reportIDs) {
|
|||
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
|
||||
|
|
|
@ -22,6 +22,14 @@ function checkIsChromeFullscreen(win, inFullscreen) {
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
|
@ -260,6 +260,9 @@ user_pref("toolkit.telemetry.newProfilePing.enabled", false);
|
|||
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.
|
||||
|
|
|
@ -194,6 +194,10 @@ function* nextTest()
|
|||
}
|
||||
}
|
||||
|
||||
// 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");
|
||||
|
@ -204,6 +208,9 @@ function* nextTest()
|
|||
synthesizeKey("VK_ESCAPE", { });
|
||||
ok(!animatedPopupHidden, "animated popup not hidden yet");
|
||||
yield;
|
||||
|
||||
// restore the pref value
|
||||
SpecialPowers.setBoolPref("toolkit.cosmeticAnimations.enabled", origPrefValue);
|
||||
}
|
||||
|
||||
SimpleTest.finish()
|
||||
|
|
|
@ -28,8 +28,14 @@ function completeAnimation(nextTest) {
|
|||
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");
|
||||
|
|
|
@ -25,6 +25,13 @@ 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;
|
||||
|
|
|
@ -402,6 +402,7 @@
|
|||
</content>
|
||||
<implementation>
|
||||
<field name="_fadeTimer">null</field>
|
||||
<field name="_previousAnimateAttrValue">null</field>
|
||||
<method name="sizeTo">
|
||||
<parameter name="aWidth"/>
|
||||
<parameter name="aHeight"/>
|
||||
|
@ -487,6 +488,16 @@
|
|||
<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")
|
||||
|
@ -529,7 +540,10 @@
|
|||
</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>
|
||||
|
|
|
@ -37,14 +37,10 @@ function openNotification() {
|
|||
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);
|
||||
}
|
||||
|
||||
window.onload = openNotification;
|
||||
|
|
Загрузка…
Ссылка в новой задаче