зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1915606 - Fix ExtensionControlledPopups dialogs SUMO learn more link position. r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D220562
This commit is contained in:
Родитель
1245ebf404
Коммит
7bb3833689
|
@ -316,6 +316,12 @@ export class ExtensionControlledPopup {
|
|||
anchorButton = action || doc.getElementById("PanelUI-menu-button");
|
||||
}
|
||||
let anchor = anchorButton.icon;
|
||||
if (this.learnMoreLink) {
|
||||
const learnMoreURL =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
this.learnMoreLink;
|
||||
popupnotification.setAttribute("learnmoreurl", learnMoreURL);
|
||||
}
|
||||
popupnotification.show();
|
||||
panel.openPopup(anchor);
|
||||
}
|
||||
|
@ -349,11 +355,6 @@ export class ExtensionControlledPopup {
|
|||
lazy.BrowserUIUtils.getLocalizedFragment(doc, message, addonDetails)
|
||||
);
|
||||
}
|
||||
|
||||
let link = doc.createElement("a", { is: "moz-support-link" });
|
||||
link.setAttribute("class", "learnMore");
|
||||
link.setAttribute("support-page", this.learnMoreLink);
|
||||
description.appendChild(link);
|
||||
}
|
||||
|
||||
async _ensureWindowReady(win) {
|
||||
|
|
|
@ -162,14 +162,24 @@ add_task(async function testExtensionControlledPopup() {
|
|||
let description = doc.getElementById("extension-controlled-description");
|
||||
is(
|
||||
description.textContent,
|
||||
"An extension, Ext Controlled, changed the page you see when you open a new tab.Learn more",
|
||||
"An extension, Ext Controlled, changed the page you see when you open a new tab.",
|
||||
"The extension name is in the description"
|
||||
);
|
||||
let link = description.querySelector("a.learnMore");
|
||||
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(
|
||||
panel.querySelector(".popup-notification-learnmore-link")
|
||||
),
|
||||
"Expect the popupnotification learnmore link to be visible"
|
||||
);
|
||||
|
||||
is(
|
||||
link.href,
|
||||
"http://127.0.0.1:8888/support-dummy/extension-controlled",
|
||||
"The link has the href set from learnMoreLink"
|
||||
panel
|
||||
.querySelector(".popup-notification-learnmore-link")
|
||||
.getAttribute("href"),
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"extension-controlled",
|
||||
"learnmore link should have the expected url set"
|
||||
);
|
||||
|
||||
// Force close the popup, as if a user clicked away from it.
|
||||
|
|
|
@ -66,11 +66,12 @@ add_task(async function test_multiple_extensions_overriding_home_page() {
|
|||
function background() {
|
||||
browser.test.onMessage.addListener(async msg => {
|
||||
switch (msg) {
|
||||
case "checkHomepage":
|
||||
case "checkHomepage": {
|
||||
let homepage = await browser.browserSettings.homepageOverride.get({});
|
||||
browser.test.sendMessage("homepage", homepage);
|
||||
break;
|
||||
case "trySet":
|
||||
}
|
||||
case "trySet": {
|
||||
let setResult = await browser.browserSettings.homepageOverride.set({
|
||||
value: "foo",
|
||||
});
|
||||
|
@ -80,7 +81,8 @@ add_task(async function test_multiple_extensions_overriding_home_page() {
|
|||
);
|
||||
browser.test.sendMessage("homepageSet");
|
||||
break;
|
||||
case "tryClear":
|
||||
}
|
||||
case "tryClear": {
|
||||
let clearResult =
|
||||
await browser.browserSettings.homepageOverride.clear({});
|
||||
browser.test.assertFalse(
|
||||
|
@ -89,6 +91,7 @@ add_task(async function test_multiple_extensions_overriding_home_page() {
|
|||
);
|
||||
browser.test.sendMessage("homepageCleared");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -489,10 +492,26 @@ add_task(async function test_doorhanger_new_window() {
|
|||
|
||||
is(
|
||||
description.textContent,
|
||||
"An extension, Ext2, changed what you see when you open your homepage and new windows.Learn more",
|
||||
"An extension, Ext2, changed what you see when you open your homepage and new windows.",
|
||||
"The extension name is in the popup"
|
||||
);
|
||||
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(
|
||||
panel.querySelector(".popup-notification-learnmore-link")
|
||||
),
|
||||
"Expect the popupnotification learnmore link to be visible"
|
||||
);
|
||||
|
||||
is(
|
||||
panel
|
||||
.querySelector(".popup-notification-learnmore-link")
|
||||
.getAttribute("href"),
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"extension-home",
|
||||
"learnmore link should have the expected url set"
|
||||
);
|
||||
|
||||
// Click Manage.
|
||||
let popupHidden = promisePopupHidden(panel);
|
||||
let popupnotification = doc.getElementById("extension-homepage-notification");
|
||||
|
@ -518,7 +537,7 @@ add_task(async function test_doorhanger_new_window() {
|
|||
|
||||
is(
|
||||
description.textContent,
|
||||
"An extension, Ext1, changed what you see when you open your homepage and new windows.Learn more",
|
||||
"An extension, Ext1, changed what you see when you open your homepage and new windows.",
|
||||
"The extension name is in the popup"
|
||||
);
|
||||
|
||||
|
@ -591,7 +610,7 @@ add_task(async function test_overriding_home_page_incognito_not_allowed() {
|
|||
let popupnotification = description.closest("popupnotification");
|
||||
is(
|
||||
description.textContent,
|
||||
"An extension, extension, changed what you see when you open your homepage and new windows.Learn more",
|
||||
"An extension, extension, changed what you see when you open your homepage and new windows.",
|
||||
"The extension name is in the popup"
|
||||
);
|
||||
is(
|
||||
|
|
|
@ -73,6 +73,31 @@ add_task(function test_doorhanger_keep() {
|
|||
"The doorhanger is anchored to the all tabs button"
|
||||
);
|
||||
|
||||
let description = panel.querySelector(
|
||||
"#extension-tab-hide-notification-description"
|
||||
);
|
||||
is(
|
||||
description.textContent,
|
||||
"An extension, Generated extension, is hiding some of your tabs. You can still access all of your tabs from .",
|
||||
"The extension name is in the description"
|
||||
);
|
||||
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(
|
||||
panel.querySelector(".popup-notification-learnmore-link")
|
||||
),
|
||||
"Expect the popupnotification learnmore link to be visible"
|
||||
);
|
||||
|
||||
is(
|
||||
panel
|
||||
.querySelector(".popup-notification-learnmore-link")
|
||||
.getAttribute("href"),
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"extension-hiding-tabs",
|
||||
"learnmore link should have the expected url set"
|
||||
);
|
||||
|
||||
// Click the Keep Tabs Hidden button.
|
||||
let popupnotification = document.getElementById(
|
||||
"extension-tab-hide-notification"
|
||||
|
|
|
@ -258,10 +258,26 @@ add_task(async function test_new_tab_keep_settings() {
|
|||
is(
|
||||
panel.querySelector("#extension-new-tab-notification-description")
|
||||
.textContent,
|
||||
"An extension, New Tab Add-on, changed the page you see when you open a new tab.Learn more",
|
||||
"An extension, New Tab Add-on, changed the page you see when you open a new tab.",
|
||||
"The description includes the add-on name"
|
||||
);
|
||||
|
||||
ok(
|
||||
BrowserTestUtils.isVisible(
|
||||
panel.querySelector(".popup-notification-learnmore-link")
|
||||
),
|
||||
"Expect the popupnotification learnmore link to be visible"
|
||||
);
|
||||
|
||||
is(
|
||||
panel
|
||||
.querySelector(".popup-notification-learnmore-link")
|
||||
.getAttribute("href"),
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"extension-home",
|
||||
"learnmore link should have the expected url set"
|
||||
);
|
||||
|
||||
// Click the Keep Changes button.
|
||||
let confirmationSaved = TestUtils.waitForCondition(() => {
|
||||
return ExtensionSettingsStore.getSetting(
|
||||
|
|
Загрузка…
Ссылка в новой задаче