зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1702330 - Graduate infobars to main proton pref r=jaws,marionette-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D110638
This commit is contained in:
Родитель
d402b2c2f4
Коммит
909ff1f4d9
|
@ -125,7 +125,7 @@ add_task(async () => {
|
|||
// 5. Accessibility announcements dialog (#a11y-announcement)
|
||||
// 6. Tab notification deck (#tab-notification-deck) (proton only)
|
||||
let baseRootChildCount = Services.prefs.getBoolPref(
|
||||
"browser.proton.infobars.enabled",
|
||||
"browser.proton.enabled",
|
||||
false
|
||||
)
|
||||
? 6
|
||||
|
|
|
@ -34,8 +34,8 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"PROTON_INFOBARS_ENABLED",
|
||||
"browser.proton.infobars.enabled",
|
||||
"PROTON_ENABLED",
|
||||
"browser.proton.enabled",
|
||||
false
|
||||
);
|
||||
|
||||
|
@ -162,7 +162,7 @@ var DefaultBrowserNotification = {
|
|||
|
||||
let iconPixels = win.devicePixelRatio > 1 ? "64" : "32";
|
||||
let iconURL = "chrome://branding/content/icon" + iconPixels + ".png";
|
||||
const priority = PROTON_INFOBARS_ENABLED
|
||||
const priority = PROTON_ENABLED
|
||||
? win.gNotificationBox.PRIORITY_SYSTEM
|
||||
: win.gNotificationBox.PRIORITY_INFO_MEDIUM;
|
||||
let callback = this._onNotificationEvent.bind(this);
|
||||
|
|
|
@ -397,7 +397,7 @@ XPCOMUtils.defineLazyGetter(this, "gHighPriorityNotificationBox", () => {
|
|||
return new MozElements.NotificationBox(element => {
|
||||
element.classList.add("global-notificationbox");
|
||||
element.setAttribute("notificationside", "top");
|
||||
if (gProtonInfobarsEnabled) {
|
||||
if (gProton) {
|
||||
// With Proton enabled all notification boxes are at the top, built into the browser chrome.
|
||||
let tabNotifications = document.getElementById("tab-notification-deck");
|
||||
gNavToolbox.insertBefore(element, tabNotifications);
|
||||
|
@ -409,7 +409,7 @@ XPCOMUtils.defineLazyGetter(this, "gHighPriorityNotificationBox", () => {
|
|||
|
||||
// Regular notification bars shown at the bottom of the window.
|
||||
XPCOMUtils.defineLazyGetter(this, "gNotificationBox", () => {
|
||||
return gProtonInfobarsEnabled
|
||||
return gProton
|
||||
? gHighPriorityNotificationBox
|
||||
: new MozElements.NotificationBox(element => {
|
||||
element.classList.add("global-notificationbox");
|
||||
|
@ -558,14 +558,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
}
|
||||
);
|
||||
|
||||
/* Temporary pref while the Proton infobars work stabilizes. */
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"gProtonInfobarsEnabled",
|
||||
"browser.proton.infobars.enabled",
|
||||
false
|
||||
);
|
||||
|
||||
/* Temporary pref while the dust settles around the updated tooltip design
|
||||
for tabs and bookmarks toolbar. This will eventually be removed and
|
||||
browser.proton.enabled will be used instead. */
|
||||
|
|
|
@ -826,7 +826,7 @@
|
|||
if (!browser._notificationBox) {
|
||||
browser._notificationBox = new MozElements.NotificationBox(element => {
|
||||
element.setAttribute("notificationside", "top");
|
||||
if (gProtonInfobarsEnabled) {
|
||||
if (gProton) {
|
||||
element.setAttribute(
|
||||
"name",
|
||||
`tab-notification-box-${this._nextNotificationBoxId++}`
|
||||
|
@ -1112,7 +1112,7 @@
|
|||
|
||||
this._appendStatusPanel();
|
||||
|
||||
if (gProtonInfobarsEnabled) {
|
||||
if (gProton) {
|
||||
this._updateVisibleNotificationBox(newBrowser);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ function openAboutPrefPromise(win) {
|
|||
for (let protonEnabled of [true, false]) {
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.proton.infobars.enabled", protonEnabled]],
|
||||
set: [["browser.proton.enabled", protonEnabled]],
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewWindowWithFlushedXULCacheForMozSupports();
|
||||
// Open a new tab to keep the window open.
|
||||
|
|
|
@ -38,7 +38,7 @@ function createNotification({ browser, label, value, priority }) {
|
|||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.proton.infobars.enabled", true]],
|
||||
set: [["browser.proton.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -94,14 +94,9 @@ async function test_decoder_doctor_notification(
|
|||
}
|
||||
ok(notification, "Got decoder-doctor-notification notification");
|
||||
|
||||
const protonInfobarsEnabled = Services.prefs.getBoolPref(
|
||||
"browser.proton.infobars.enabled",
|
||||
false
|
||||
);
|
||||
is(
|
||||
notification.messageText.textContent,
|
||||
notificationMessage +
|
||||
(protonInfobarsEnabled && isLink && label ? " " : ""),
|
||||
notificationMessage + (gProton && isLink && label ? " " : ""),
|
||||
"notification message should match expectation"
|
||||
);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class TestSafeBrowsingNotificationBar(WindowManagerMixin, MarionetteTestCase):
|
|||
|
||||
def check_get_me_out_of_here_button(self):
|
||||
with self.marionette.using_context("chrome"):
|
||||
if self.marionette.get_pref("browser.proton.infobars.enabled"):
|
||||
if self.marionette.get_pref("browser.proton.enabled"):
|
||||
notification_box = self.marionette.find_element(
|
||||
By.CSS_SELECTOR, 'vbox.notificationbox-stack[slot="selected"]'
|
||||
)
|
||||
|
@ -125,7 +125,7 @@ class TestSafeBrowsingNotificationBar(WindowManagerMixin, MarionetteTestCase):
|
|||
|
||||
def check_x_button(self):
|
||||
with self.marionette.using_context("chrome"):
|
||||
if self.marionette.get_pref("browser.proton.infobars.enabled"):
|
||||
if self.marionette.get_pref("browser.proton.enabled"):
|
||||
notification_box = self.marionette.find_element(
|
||||
By.CSS_SELECTOR, 'vbox.notificationbox-stack[slot="selected"]'
|
||||
)
|
||||
|
|
|
@ -220,9 +220,7 @@ var Heartbeat = class {
|
|||
this.ratingContainer.appendChild(ratingElement);
|
||||
}
|
||||
|
||||
if (
|
||||
Services.prefs.getBoolPref("browser.proton.infobars.enabled", false)
|
||||
) {
|
||||
if (Services.prefs.getBoolPref("browser.proton.enabled")) {
|
||||
// This will append if there aren't any .text-link elements.
|
||||
this.notice.buttonContainer.append(this.ratingContainer);
|
||||
} else {
|
||||
|
|
|
@ -88,7 +88,7 @@ function getStars(notice, protonEnabled) {
|
|||
for (let protonEnabled of [true, false]) {
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["browser.proton.infobars.enabled", protonEnabled]],
|
||||
set: [["browser.proton.enabled", protonEnabled]],
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewWindowWithFlushedXULCacheForMozSupports();
|
||||
// Open a new tab to keep the window open.
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const PROTON_INFOBARS_ENABLED = Services.prefs.getBoolPref("browser.proton.infobars.enabled", false);
|
||||
const NOTIFICATION_LOCAL_NAME = PROTON_INFOBARS_ENABLED ? "notification-message" : "notification";
|
||||
const PROTON_ENABLED = Services.prefs.getBoolPref("browser.proton.enabled", false);
|
||||
const NOTIFICATION_LOCAL_NAME = PROTON_ENABLED ? "notification-message" : "notification";
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var testtag_notificationbox_buttons = [
|
||||
|
@ -336,7 +336,7 @@ var tests =
|
|||
result(nb, ntf) {
|
||||
testtag_notificationbox_State(nb, "append link with callback", ntf, 1);
|
||||
|
||||
let buttonContainer = PROTON_INFOBARS_ENABLED ? ntf.buttonContainer : ntf.messageDetails;
|
||||
let buttonContainer = PROTON_ENABLED ? ntf.buttonContainer : ntf.messageDetails;
|
||||
let button = buttonContainer.lastElementChild;
|
||||
SimpleTest.is(button.localName, "button", "button is a button");
|
||||
SimpleTest.ok(!button.href, "button href is not set");
|
||||
|
@ -385,7 +385,7 @@ var tests =
|
|||
result(nb, ntf) {
|
||||
testtag_notificationbox_State(nb, "append link with callback", ntf, 1);
|
||||
|
||||
let link = PROTON_INFOBARS_ENABLED
|
||||
let link = PROTON_ENABLED
|
||||
? ntf.messageText.lastElementChild.previousSibling.previousSibling
|
||||
: ntf.messageText.lastElementChild.previousSibling;
|
||||
SimpleTest.is(link.localName, "label", "link 1 is a label");
|
||||
|
@ -541,7 +541,7 @@ function testtag_notification_State(nb, ntf, testid, label, value, image, priori
|
|||
|
||||
is(ntf.getAttribute("type"), type, testid + " notification type");
|
||||
|
||||
if (PROTON_INFOBARS_ENABLED) {
|
||||
if (PROTON_ENABLED) {
|
||||
let icons = {
|
||||
info: "chrome://global/skin/icons/info.svg",
|
||||
warning: "chrome://global/skin/icons/warning.svg",
|
||||
|
@ -562,7 +562,7 @@ function checkPopupTest(nb, ntf)
|
|||
var evt = new Event("");
|
||||
ntf.dispatchEvent(evt);
|
||||
evt.target.buttonInfo = testtag_notificationbox_buttons[0];
|
||||
if (PROTON_INFOBARS_ENABLED) {
|
||||
if (PROTON_ENABLED) {
|
||||
ntf.handleEvent(evt);
|
||||
} else {
|
||||
ntf._doButtonCommand(evt);
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@media (-moz-proton-infobars) {
|
||||
@media (-moz-proton) {
|
||||
@media not (prefers-contrast) {
|
||||
.container.infobar {
|
||||
box-shadow: 0 1px 2px rgba(58, 57, 68, 0.1);
|
||||
|
@ -276,7 +276,7 @@ strong {
|
|||
}
|
||||
}
|
||||
|
||||
@media not (-moz-proton-infobars) {
|
||||
@media not (-moz-proton) {
|
||||
:host {
|
||||
/* Colors used by default, and for [type=generic] message bars.*/
|
||||
background-color: var(--in-content-box-info-background);
|
||||
|
|
|
@ -29,12 +29,10 @@
|
|||
get stack() {
|
||||
if (!this._stack) {
|
||||
let stack;
|
||||
stack = document.createXULElement(
|
||||
this.protonInfobarsEnabled ? "vbox" : "legacy-stack"
|
||||
);
|
||||
stack = document.createXULElement(gProton ? "vbox" : "legacy-stack");
|
||||
stack._notificationBox = this;
|
||||
stack.className = "notificationbox-stack";
|
||||
if (!this.protonInfobarsEnabled) {
|
||||
if (!gProton) {
|
||||
stack.appendChild(document.createXULElement("spacer"));
|
||||
}
|
||||
stack.addEventListener("transitionend", event => {
|
||||
|
@ -170,7 +168,7 @@
|
|||
|
||||
// Create the Custom Element and connect it to the document immediately.
|
||||
var newitem;
|
||||
if (this.protonInfobarsEnabled && !aNotificationIs) {
|
||||
if (gProton && !aNotificationIs) {
|
||||
if (!customElements.get("notification-message")) {
|
||||
// There's some weird timing stuff when this element is created at
|
||||
// script load time, we don't need it until now anyway so be lazy.
|
||||
|
@ -202,7 +200,7 @@
|
|||
}
|
||||
newitem.setAttribute("value", aValue);
|
||||
|
||||
if (aImage && !this.protonInfobarsEnabled) {
|
||||
if (aImage && !gProton) {
|
||||
newitem.messageImage.setAttribute("src", aImage);
|
||||
}
|
||||
newitem.eventCallback = aEventCallback;
|
||||
|
@ -243,7 +241,7 @@
|
|||
if (!aItem.parentNode) {
|
||||
return;
|
||||
}
|
||||
if (this.protonInfobarsEnabled) {
|
||||
if (gProton) {
|
||||
this.currentNotification = aItem;
|
||||
this.removeCurrentNotification(aSkipAnimation);
|
||||
} else if (aItem == this.currentNotification) {
|
||||
|
@ -358,13 +356,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
get protonInfobarsEnabled() {
|
||||
return Services.prefs.getBoolPref(
|
||||
"browser.proton.infobars.enabled",
|
||||
false
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// These are defined on the instance prototype for backwards compatibility.
|
||||
|
@ -542,13 +533,6 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
get protonInfobarsEnabled() {
|
||||
return Services.prefs.getBoolPref(
|
||||
"browser.proton.infobars.enabled",
|
||||
false
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
customElements.define("notification", MozElements.Notification);
|
||||
|
|
|
@ -191,7 +191,7 @@ notification[type="critical"] > hbox > .messageImage {
|
|||
background-color: var(--notification-primary-button-background-active);
|
||||
}
|
||||
|
||||
@media (-moz-proton-infobars) {
|
||||
@media (-moz-proton) {
|
||||
.notificationbox-stack {
|
||||
background-color: var(--toolbar-bgcolor);
|
||||
width: 100%;
|
||||
|
|
Загрузка…
Ссылка в новой задаче