Bug 1814414 - Replace constructed xul label with moz-support-link in ExtensionControlledPopup.jsm r=extension-reviewers,robwu

Differential Revision: https://phabricator.services.mozilla.com/D179835
This commit is contained in:
ganna 2023-06-07 14:27:39 +00:00
Родитель 8cece1119e
Коммит 72e33df199
5 изменённых файлов: 5 добавлений и 16 удалений

Просмотреть файл

@ -82,9 +82,6 @@ export class ExtensionControlledPopup {
* function is passed doc, message and addonDetails (the
* add-on's icon and name). If not provided, then the add-on's
* icon and name are added to the description.
* @param {string} opts.learnMoreMessageId
* The message id to be used for the text of a "learn more" link which
* will be placed after the description.
* @param {string} opts.learnMoreLink
* The name of the SUMO page to link to, this is added to
* app.support.baseURL.
@ -118,7 +115,6 @@ export class ExtensionControlledPopup {
this.descriptionId = opts.descriptionId;
this.descriptionMessageId = opts.descriptionMessageId;
this.getLocalizedDescription = opts.getLocalizedDescription;
this.learnMoreMessageId = opts.learnMoreMessageId;
this.learnMoreLink = opts.learnMoreLink;
this.preferencesLocation = opts.preferencesLocation;
this.preferencesEntrypoint = opts.preferencesEntrypoint;
@ -244,6 +240,8 @@ export class ExtensionControlledPopup {
return;
}
win.ownerGlobal.ensureCustomElements("moz-support-link");
// Find the elements we need.
let doc = win.document;
let panel = ExtensionControlledPopup._getAndMaybeCreatePanel(doc);
@ -359,14 +357,9 @@ export class ExtensionControlledPopup {
);
}
let link = doc.createXULElement("label", { is: "text-link" });
let link = doc.createElement("a", { is: "moz-support-link" });
link.setAttribute("class", "learnMore");
link.href =
Services.urlFormatter.formatURLPref("app.support.baseURL") +
this.learnMoreLink;
link.textContent = lazy.strBundle.GetStringFromName(
this.learnMoreMessageId
);
link.setAttribute("support-page", this.learnMoreLink);
description.appendChild(link);
}

Просмотреть файл

@ -46,7 +46,6 @@ XPCOMUtils.defineLazyGetter(this, "homepagePopup", () => {
settingKey: HOMEPAGE_SETTING_NAME,
descriptionId: "extension-homepage-notification-description",
descriptionMessageId: "homepageControlled.message",
learnMoreMessageId: "homepageControlled.learnMore",
learnMoreLink: "extension-home",
preferencesLocation: "home-homeOverride",
preferencesEntrypoint: "addon-manage-home-override",

Просмотреть файл

@ -49,7 +49,6 @@ XPCOMUtils.defineLazyGetter(this, "tabHidePopup", () => {
image
);
},
learnMoreMessageId: "tabHideControlled.learnMore",
learnMoreLink: "extension-hiding-tabs",
});
});

Просмотреть файл

@ -35,7 +35,6 @@ XPCOMUtils.defineLazyGetter(this, "newTabPopup", () => {
settingKey: NEW_TAB_SETTING_NAME,
descriptionId: "extension-new-tab-notification-description",
descriptionMessageId: "newTabControlled.message2",
learnMoreMessageId: "newTabControlled.learnMore",
learnMoreLink: "extension-home",
preferencesLocation: "home-newtabOverride",
preferencesEntrypoint: "addon-manage-newtab-override",

Просмотреть файл

@ -83,7 +83,6 @@ add_task(async function testExtensionControlledPopup() {
settingKey,
descriptionId: "extension-controlled-description",
descriptionMessageId: "newTabControlled.message2",
learnMoreMessageId: "newTabControlled.learnMore",
learnMoreLink: "extension-controlled",
onObserverAdded,
onObserverRemoved,
@ -162,7 +161,7 @@ add_task(async function testExtensionControlledPopup() {
"An extension, Ext Controlled, changed the page you see when you open a new tab.Learn more",
"The extension name is in the description"
);
let link = description.querySelector("label");
let link = description.querySelector("a.learnMore");
is(
link.href,
"http://127.0.0.1:8888/support-dummy/extension-controlled",