Bug 1703173 - Remove ftl adding support from notification-message r=jaws

It turns out the shadow document doesn't need its own FTL imports, the parent can
include them instead. This moves the requirement back onto the caller to ensure
that any FTL files it needs are already imported when creating a notification-message.

Depends on D111189

Differential Revision: https://phabricator.services.mozilla.com/D111190
This commit is contained in:
Mark Striemer 2021-04-09 15:58:15 +00:00
parent aa959736cf
commit 243a572397
6 changed files with 10 additions and 39 deletions

View File

@ -174,9 +174,7 @@ var DefaultBrowserNotification = {
iconURL,
priority,
buttons,
callback,
null,
["browser/defaultBrowserNotification.ftl"]
callback
);
},

View File

@ -1046,10 +1046,7 @@ const gStoragePressureObserver = {
NOTIFICATION_VALUE,
null,
gHighPriorityNotificationBox.PRIORITY_WARNING_HIGH,
buttons,
null,
null,
["branding/brand.ftl", "browser/preferences/preferences.ftl"]
buttons
);
// This seems to be necessary to get the buttons to display correctly

View File

@ -695,10 +695,7 @@ var AboutLogins = {
id,
iconURL,
notificationBox[priority],
buttons,
null,
null,
["browser/aboutLogins.ftl"]
buttons
);
}
},

View File

@ -13,11 +13,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
Services: "resource://gre/modules/Services.jsm",
});
const FTL_PATHS = [
"browser/newtab/asrouter.ftl",
"browser/defaultBrowserNotification.ftl",
];
class InfoBarNotification {
constructor(message, dispatch) {
this._dispatch = dispatch;
@ -50,9 +45,7 @@ class InfoBarNotification {
content.icon || "chrome://branding/content/icon64.png",
notificationContainer.PRIORITY_INFO_MEDIUM,
content.buttons.map(b => this.formatButtonConfig(b)),
this.infobarCallback,
null,
FTL_PATHS
this.infobarCallback
);
this.addImpression();
@ -138,9 +131,10 @@ const InfoBar = {
},
maybeInsertFTL(win) {
for (let filepath of FTL_PATHS) {
win.MozXULElement.insertFTLIfNeeded(filepath);
}
win.MozXULElement.insertFTLIfNeeded("browser/newtab/asrouter.ftl");
win.MozXULElement.insertFTLIfNeeded(
"browser/defaultBrowserNotification.ftl"
);
},
showInfoBarMessage(browser, message, dispatch) {

View File

@ -461,9 +461,7 @@ var TabCrashHandler = {
closeAllNotifications();
}
},
null,
"browser/browser.ftl"
}
);
let existingItem = this.notificationsMap.get(childID);

View File

@ -146,8 +146,7 @@
aPriority,
aButtons,
aEventCallback,
aNotificationIs,
aFtlFilePaths
aNotificationIs
) {
if (
aPriority < this.PRIORITY_SYSTEM ||
@ -179,9 +178,6 @@
}
newitem = document.createElement("notification-message");
newitem.setAttribute("message-bar-type", "infobar");
if (aFtlFilePaths) {
newitem.addFtl(aFtlFilePaths);
}
} else {
newitem = document.createXULElement(
"notification",
@ -607,15 +603,6 @@
this.control.removeNotification(this);
}
addFtl(filepaths) {
for (let filepath of filepaths) {
let link = document.createElement("link");
link.setAttribute("rel", "localization");
link.href = filepath;
this.shadowRoot.append(link);
}
}
handleEvent(e) {
if ("buttonInfo" in e.target) {
let { buttonInfo } = e.target;