Bug 1377433 - Should not do the sliding-up tour notification transition, r=mossop
MozReview-Commit-ID: L4aDUF1s9OI
--- a/browser/base/content/test/general/browser_aboutHome.js
+++ b/browser/base/content/test/general/browser_aboutHome.js
@@ -19,16 +19,24 @@ registerCleanupFunction(function() {
// Ensure we don't pollute prefs for next tests.
Services.prefs.clearUserPref("network.cookies.cookieBehavior");
Services.prefs.clearUserPref("network.cookie.lifetimePolicy");
Services.prefs.clearUserPref("browser.rights.override");
Services.prefs.clearUserPref("browser.rights." + gRightsVersion + ".shown");
});
add_task(async function() {
+ // The onboarding tour's notification would affect tests
+ // and it isn't out test target so make sure disabling it
+ // before any tests start.
+ await promiseDisableOnboardingTours();
+ is(false, Services.prefs.getBoolPref("browser.onboarding.enabled"), "Should disable the onboarding tours");
+});
+
+add_task(async function() {
info("Check that clearing cookies does not clear storage");
await withSnippetsMap(
() => {
Cc["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService)
.notifyObservers(null, "cookie-changed", "cleared");
},
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -824,8 +824,12 @@ function getCertExceptionDialog(aLocatio
if (childDoc.location.href == aLocation) {
return childDoc;
}
}
}
return undefined;
}
+
+function promiseDisableOnboardingTours() {
+ return SpecialPowers.pushPrefEnv({set: [["browser.onboarding.enabled", false]]});
+}
--- a/browser/base/content/test/newtab/browser_newtab_focus.js
+++ b/browser/base/content/test/newtab/browser_newtab_focus.js
@@ -59,17 +59,17 @@ function countFocus(aExpectedCount) {
/**
* Wait for the onboarding tour notification opens
*/
function promiseTourNotificationOpened(browser) {
let condition = () => {
return ContentTask.spawn(browser, {}, function() {
return new Promise(resolve => {
let bar = content.document.querySelector("#onboarding-notification-bar");
- if (bar && bar.classList.contains("onboarding-opened") && bar.dataset.cssTransition == "end") {
+ if (bar && bar.classList.contains("onboarding-opened")) {
resolve(true);
return;
}
resolve(false);
});
})
};
return BrowserTestUtils.waitForCondition(
--- a/browser/extensions/onboarding/content/onboarding.css
+++ b/browser/extensions/onboarding/content/onboarding.css
@@ -347,16 +347,17 @@
min-width: 640px;
background: rgba(255, 255, 255, 0.97);
border-top: 2px solid #e9e9e9;
transition: transform 0.8s;
transform: translateY(122px);
}
#onboarding-notification-bar.onboarding-opened {
+ transition: none;
transform: translateY(0px);
}
#onboarding-notification-icon {
height: 36px;
background: url("img/overlay-icon.svg") no-repeat;
background-size: 36px;
background-position: 34px;
--- a/browser/extensions/onboarding/content/onboarding.js
+++ b/browser/extensions/onboarding/content/onboarding.js
@@ -455,37 +455,27 @@ class Onboarding {
this._notificationBar.dataset.targetTourId = targetTour.id;
let notificationStrings = targetTour.getNotificationStrings(this._bundle);
let actionBtn = this._notificationBar.querySelector("#onboarding-notification-action-btn");
actionBtn.textContent = notificationStrings.button;
let tourTitle = this._notificationBar.querySelector("#onboarding-notification-tour-title");
tourTitle.textContent = notificationStrings.title;
let tourMessage = this._notificationBar.querySelector("#onboarding-notification-tour-message");
tourMessage.textContent = notificationStrings.message;
-
- this._notificationBar.addEventListener("transitionend", () => {
- this._notificationBar.dataset.cssTransition = "end";
- }, { once: true });
- this._window.requestAnimationFrame(() => {
- // Request the 2nd animation frame.
- // This is to make sure the appending operation above and the css operation happen
- // in the different layout tick so as to make sure the transition happens.
- this._window.requestAnimationFrame(() => this._notificationBar.classList.add("onboarding-opened"));
- });
+ this._notificationBar.classList.add("onboarding-opened");
this.sendMessageToChrome("set-prefs", [{
name: "browser.onboarding.notification.lastPrompted",
value: targetTour.id
}]);
}
hideNotification() {
if (this._notificationBar) {
this._notificationBar.classList.remove("onboarding-opened");
- delete this._notificationBar.dataset.cssTransition;
}
}
_renderNotificationBar() {
let div = this._window.document.createElement("div");
div.id = "onboarding-notification-bar";
// We use `innerHTML` for more friendly reading.
// The security should be fine because this is not from an external input.
--- a/browser/extensions/onboarding/test/browser/head.js
+++ b/browser/extensions/onboarding/test/browser/head.js
@@ -82,17 +82,17 @@ function promisePrefUpdated(name, expect
});
}
function promiseTourNotificationOpened(browser) {
let condition = () => {
return ContentTask.spawn(browser, {}, function() {
return new Promise(resolve => {
let bar = content.document.querySelector("#onboarding-notification-bar");
- if (bar && bar.classList.contains("onboarding-opened") && bar.dataset.cssTransition == "end") {
+ if (bar && bar.classList.contains("onboarding-opened")) {
resolve(true);
return;
}
resolve(false);
});
})
};
return BrowserTestUtils.waitForCondition(