зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to autoland.
--HG-- rename : gfx/wr/wrench/reftests/filters/filter-flood-ref.yaml => gfx/wr/wrench/reftests/filters/svg-filter-flood-ref.yaml rename : gfx/wr/wrench/reftests/filters/filter-flood.yaml => gfx/wr/wrench/reftests/filters/svg-filter-flood.yaml
This commit is contained in:
Коммит
60a8cce828
|
@ -29,5 +29,4 @@ skip-if = !e10s
|
|||
[browser_permissions_unsigned.js]
|
||||
skip-if = require_signing
|
||||
[browser_update_checkForUpdates.js]
|
||||
[browser_update_findUpdates.js]
|
||||
[browser_update_interactive_noprompt.js]
|
||||
|
|
|
@ -38,72 +38,36 @@ function promiseEvent(eventEmitter, event) {
|
|||
});
|
||||
}
|
||||
|
||||
async function getAddonElement(managerWindow, addonId) {
|
||||
if (managerWindow.useHtmlViews) {
|
||||
// about:addons is using the new HTML page.
|
||||
const { contentDocument: doc } = managerWindow.document.getElementById(
|
||||
"html-view-browser"
|
||||
);
|
||||
const card = await BrowserTestUtils.waitForCondition(
|
||||
() => doc.querySelector(`addon-card[addon-id="${addonId}"]`),
|
||||
`Found entry for sideload extension addon "${addonId}" in HTML about:addons`
|
||||
);
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
// about:addons is using the XUL-based views.
|
||||
let list = managerWindow.document.getElementById("addon-list");
|
||||
// Make sure XBL bindings are applied
|
||||
list.clientHeight;
|
||||
const item = Array.from(list.children).find(_item => _item.value == addonId);
|
||||
ok(item, "Found entry for sideloaded extension in about:addons");
|
||||
|
||||
return item;
|
||||
function getAddonElement(managerWindow, addonId) {
|
||||
const { contentDocument: doc } = managerWindow.document.getElementById(
|
||||
"html-view-browser"
|
||||
);
|
||||
return BrowserTestUtils.waitForCondition(
|
||||
() => doc.querySelector(`addon-card[addon-id="${addonId}"]`),
|
||||
`Found entry for sideload extension addon "${addonId}" in HTML about:addons`
|
||||
);
|
||||
}
|
||||
|
||||
function assertDisabledSideloadedAddonElement(managerWindow, addonElement) {
|
||||
if (managerWindow.useHtmlViews) {
|
||||
// about:addons is using the new HTML page.
|
||||
const doc = addonElement.ownerDocument;
|
||||
const enableBtn = addonElement.querySelector('[action="toggle-disabled"]');
|
||||
is(
|
||||
doc.l10n.getAttributes(enableBtn).id,
|
||||
"enable-addon-button",
|
||||
"The button has the enable label"
|
||||
);
|
||||
} else {
|
||||
addonElement.scrollIntoView({ behavior: "instant" });
|
||||
ok(
|
||||
BrowserTestUtils.is_visible(addonElement._enableBtn),
|
||||
"Enable button is visible for sideloaded extension"
|
||||
);
|
||||
ok(
|
||||
BrowserTestUtils.is_hidden(addonElement._disableBtn),
|
||||
"Disable button is not visible for sideloaded extension"
|
||||
);
|
||||
}
|
||||
const doc = addonElement.ownerDocument;
|
||||
const enableBtn = addonElement.querySelector('[action="toggle-disabled"]');
|
||||
is(
|
||||
doc.l10n.getAttributes(enableBtn).id,
|
||||
"enable-addon-button",
|
||||
"The button has the enable label"
|
||||
);
|
||||
}
|
||||
|
||||
function clickEnableExtension(managerWindow, addonElement) {
|
||||
if (managerWindow.useHtmlViews) {
|
||||
addonElement.querySelector('[action="toggle-disabled"]').click();
|
||||
} else {
|
||||
BrowserTestUtils.synthesizeMouseAtCenter(
|
||||
addonElement._enableBtn,
|
||||
{},
|
||||
gBrowser.selectedBrowser
|
||||
);
|
||||
}
|
||||
addonElement.querySelector('[action="toggle-disabled"]').click();
|
||||
}
|
||||
|
||||
async function test_sideloading({ useHtmlViews }) {
|
||||
add_task(async function test_sideloading() {
|
||||
const DEFAULT_ICON_URL =
|
||||
"chrome://mozapps/skin/extensions/extensionGeneric.svg";
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", useHtmlViews],
|
||||
["xpinstall.signatures.required", false],
|
||||
["extensions.autoDisableScopes", 15],
|
||||
["extensions.ui.ignoreUnsigned", true],
|
||||
|
@ -436,12 +400,4 @@ async function test_sideloading({ useHtmlViews }) {
|
|||
expectedEventsAddon2.length,
|
||||
"Got the expected number of telemetry events for addon2"
|
||||
);
|
||||
}
|
||||
|
||||
add_task(async function test_xul_aboutaddons_sideloading() {
|
||||
await test_sideloading({ useHtmlViews: false });
|
||||
});
|
||||
|
||||
add_task(async function test_html_aboutaddons_sideloading() {
|
||||
await test_sideloading({ useHtmlViews: true });
|
||||
});
|
||||
|
|
|
@ -13,29 +13,5 @@ function checkAll(win) {
|
|||
}
|
||||
|
||||
// Test "Check for Updates" with both auto-update settings
|
||||
async function test_check_for_updates() {
|
||||
info("Test 'Check for Updates' with auto-update true");
|
||||
await interactiveUpdateTest(true, checkAll);
|
||||
info("Test 'Check for Updates' with auto-update false");
|
||||
await interactiveUpdateTest(false, checkAll);
|
||||
}
|
||||
|
||||
add_task(async function test_xul_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
await test_check_for_updates();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_html_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
await test_check_for_updates();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
add_task(() => interactiveUpdateTest(true, checkAll));
|
||||
add_task(() => interactiveUpdateTest(false, checkAll));
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
// Invoke an invidual extension's "Find Updates" menu item
|
||||
function checkOne(win, addon) {
|
||||
win.gViewController.doCommand("cmd_findItemUpdates", addon);
|
||||
}
|
||||
|
||||
// Test "Find Updates" with both auto-update settings
|
||||
async function test_find_updates() {
|
||||
info("Test 'Find Updates' with auto-update true");
|
||||
await interactiveUpdateTest(true, checkOne);
|
||||
info("Test 'Find Updates' with auto-update false");
|
||||
await interactiveUpdateTest(false, checkOne);
|
||||
}
|
||||
|
||||
add_task(async function test_xul_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
await test_find_updates();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_html_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
await test_find_updates();
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
|
@ -470,29 +470,17 @@ async function interactiveUpdateTest(autoUpdate, checkFn) {
|
|||
if (manualUpdatePromise) {
|
||||
await manualUpdatePromise;
|
||||
|
||||
if (win.useHtmlViews) {
|
||||
// about:addons is using the new HTML views.
|
||||
const availableUpdates = win.document.getElementById(
|
||||
"updates-manualUpdatesFound-btn"
|
||||
);
|
||||
availableUpdates.click();
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
let card = await BrowserTestUtils.waitForCondition(() => {
|
||||
return doc.querySelector(`addon-card[addon-id="${ID}"]`);
|
||||
}, `Wait addon card for "${ID}"`);
|
||||
let updateBtn = card.querySelector(
|
||||
'panel-item[action="install-update"]'
|
||||
);
|
||||
ok(updateBtn, `Found update button for "${ID}"`);
|
||||
updateBtn.click();
|
||||
} else {
|
||||
// about:addons is still using the legacy XUL views.
|
||||
let list = win.document.getElementById("addon-list");
|
||||
// Make sure we have XBL bindings
|
||||
list.clientHeight;
|
||||
let item = list.itemChildren.find(_item => _item.value == ID);
|
||||
EventUtils.synthesizeMouseAtCenter(item._updateBtn, {}, win);
|
||||
}
|
||||
const availableUpdates = win.document.getElementById(
|
||||
"updates-manualUpdatesFound-btn"
|
||||
);
|
||||
availableUpdates.click();
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
let card = await BrowserTestUtils.waitForCondition(() => {
|
||||
return doc.querySelector(`addon-card[addon-id="${ID}"]`);
|
||||
}, `Wait addon card for "${ID}"`);
|
||||
let updateBtn = card.querySelector('panel-item[action="install-update"]');
|
||||
ok(updateBtn, `Found update button for "${ID}"`);
|
||||
updateBtn.click();
|
||||
}
|
||||
|
||||
return { promise };
|
||||
|
|
|
@ -11,62 +11,38 @@ function restore_prefs() {
|
|||
registerCleanupFunction(restore_prefs);
|
||||
|
||||
async function assert_flash_locked_status(win, locked, expectedLabelText) {
|
||||
if (win.useHtmlViews) {
|
||||
// Tests while running on HTML about:addons page.
|
||||
let addonCard = await BrowserTestUtils.waitForCondition(async () => {
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
await win.htmlBrowserLoaded;
|
||||
return doc.querySelector(`addon-card[addon-id*="Shockwave Flash"]`);
|
||||
}, "Get HTML about:addons card for flash plugin");
|
||||
let addonCard = await BrowserTestUtils.waitForCondition(async () => {
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
await win.htmlBrowserLoaded;
|
||||
return doc.querySelector(`addon-card[addon-id*="Shockwave Flash"]`);
|
||||
}, "Get HTML about:addons card for flash plugin");
|
||||
|
||||
const pluginOptions = addonCard.querySelector("plugin-options");
|
||||
const pluginAction = pluginOptions.querySelector("panel-item[checked]");
|
||||
ok(
|
||||
pluginAction.textContent.includes(expectedLabelText),
|
||||
`Got plugin action "${expectedLabelText}"`
|
||||
);
|
||||
const pluginOptions = addonCard.querySelector("plugin-options");
|
||||
const pluginAction = pluginOptions.querySelector("panel-item[checked]");
|
||||
ok(
|
||||
pluginAction.textContent.includes(expectedLabelText),
|
||||
`Got plugin action "${expectedLabelText}"`
|
||||
);
|
||||
|
||||
// All other buttons (besides the checked one and the expand action)
|
||||
// are expected to be disabled if locked is true.
|
||||
for (const item of pluginOptions.querySelectorAll("panel-item")) {
|
||||
const actionName = item.getAttribute("action");
|
||||
if (actionName.includes("always")) {
|
||||
ok(item.hidden, `Plugin action "${actionName}" should be hidden.`);
|
||||
} else if (
|
||||
!item.hasAttribute("checked") &&
|
||||
actionName !== "expand" &&
|
||||
actionName !== "preferences"
|
||||
) {
|
||||
is(
|
||||
item.shadowRoot.querySelector("button").disabled,
|
||||
locked,
|
||||
`Plugin action "${actionName}" should be ${
|
||||
locked ? "disabled" : "enabled"
|
||||
}`
|
||||
);
|
||||
}
|
||||
// All other buttons (besides the checked one and the expand action)
|
||||
// are expected to be disabled if locked is true.
|
||||
for (const item of pluginOptions.querySelectorAll("panel-item")) {
|
||||
const actionName = item.getAttribute("action");
|
||||
if (actionName.includes("always")) {
|
||||
ok(item.hidden, `Plugin action "${actionName}" should be hidden.`);
|
||||
} else if (
|
||||
!item.hasAttribute("checked") &&
|
||||
actionName !== "expand" &&
|
||||
actionName !== "preferences"
|
||||
) {
|
||||
is(
|
||||
item.shadowRoot.querySelector("button").disabled,
|
||||
locked,
|
||||
`Plugin action "${actionName}" should be ${
|
||||
locked ? "disabled" : "enabled"
|
||||
}`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Tests while running on XUL about:addons page.
|
||||
let list = win.document.getElementById("addon-list");
|
||||
let flashEntry = await BrowserTestUtils.waitForCondition(() => {
|
||||
return list.getElementsByAttribute("name", "Shockwave Flash")[0];
|
||||
}, "Get XUL about:addons entry for flash plugin");
|
||||
let dropDown = win.document.getAnonymousElementByAttribute(
|
||||
flashEntry,
|
||||
"anonid",
|
||||
"state-menulist"
|
||||
);
|
||||
is(
|
||||
dropDown.label,
|
||||
expectedLabelText,
|
||||
"Flash setting text should match the expected value"
|
||||
);
|
||||
is(
|
||||
dropDown.disabled,
|
||||
locked,
|
||||
"Flash controls disabled state should match policy locked state"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,13 +70,10 @@ add_task(async function test_enabled() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: false,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: false,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
@ -115,13 +88,10 @@ add_task(async function test_enabled_locked() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: true,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: true,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
@ -135,13 +105,10 @@ add_task(async function test_disabled() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextNeverActivate,
|
||||
locked: false,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextNeverActivate,
|
||||
locked: false,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
@ -156,13 +123,10 @@ add_task(async function test_disabled_locked() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextNeverActivate,
|
||||
locked: true,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextNeverActivate,
|
||||
locked: true,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
@ -174,13 +138,10 @@ add_task(async function test_ask() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: false,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: false,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
@ -194,13 +155,10 @@ add_task(async function test_ask_locked() {
|
|||
},
|
||||
});
|
||||
|
||||
const testCase = () =>
|
||||
test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: true,
|
||||
});
|
||||
await testOnAboutAddonsType("XUL", testCase);
|
||||
await testOnAboutAddonsType("HTML", testCase);
|
||||
await test_flash_status({
|
||||
expectedLabelText: labelTextAskToActivate,
|
||||
locked: true,
|
||||
});
|
||||
|
||||
restore_prefs();
|
||||
});
|
||||
|
|
|
@ -7,50 +7,17 @@ const BASE_URL =
|
|||
"http://mochi.test:8888/browser/browser/components/enterprisepolicies/tests/browser";
|
||||
|
||||
async function isExtensionLocked(win, addonID) {
|
||||
if (win.useHtmlViews) {
|
||||
// Test on HTML about:addons page.
|
||||
let addonCard = await BrowserTestUtils.waitForCondition(async () => {
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
await win.htmlBrowserLoaded;
|
||||
return doc.querySelector(`addon-card[addon-id="${addonID}"]`);
|
||||
}, `Get addon-card for "${addonID}"`);
|
||||
let disableBtn = addonCard.querySelector(
|
||||
'panel-item[action="toggle-disabled"]'
|
||||
);
|
||||
let removeBtn = addonCard.querySelector('panel-item[action="remove"]');
|
||||
ok(removeBtn.hidden, "Remove button should be hidden");
|
||||
ok(disableBtn.hidden, "Disable button should be hidden");
|
||||
} else {
|
||||
// Test on XUL about:addons page.
|
||||
const doc = win.document;
|
||||
let list = doc.getElementById("addon-list");
|
||||
let addonEntry = await BrowserTestUtils.waitForCondition(
|
||||
() => list.getElementsByAttribute("value", addonID)[0],
|
||||
`Get addon entry for "${addonID}"`
|
||||
);
|
||||
let disableBtn = doc.getAnonymousElementByAttribute(
|
||||
addonEntry,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
let removeBtn = doc.getAnonymousElementByAttribute(
|
||||
addonEntry,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
ok(removeBtn.hidden, "Remove button should be hidden");
|
||||
ok(disableBtn.hidden, "Disable button should be hidden");
|
||||
}
|
||||
}
|
||||
|
||||
// This test case will run on both the XUL and HTML about:addons views.
|
||||
async function test_addon_locked() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||
const win = await BrowserOpenAddonsMgr("addons://list/extension");
|
||||
|
||||
await isExtensionLocked(win, ADDON_ID);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
let addonCard = await BrowserTestUtils.waitForCondition(async () => {
|
||||
let doc = win.getHtmlBrowser().contentDocument;
|
||||
await win.htmlBrowserLoaded;
|
||||
return doc.querySelector(`addon-card[addon-id="${addonID}"]`);
|
||||
}, `Get addon-card for "${addonID}"`);
|
||||
let disableBtn = addonCard.querySelector(
|
||||
'panel-item[action="toggle-disabled"]'
|
||||
);
|
||||
let removeBtn = addonCard.querySelector('panel-item[action="remove"]');
|
||||
ok(removeBtn.hidden, "Remove button should be hidden");
|
||||
ok(disableBtn.hidden, "Disable button should be hidden");
|
||||
}
|
||||
|
||||
add_task(async function test_addon_install() {
|
||||
|
@ -75,12 +42,13 @@ add_task(async function test_addon_install() {
|
|||
);
|
||||
});
|
||||
|
||||
add_task(async function test_XUL_aboutaddons_addon_locked() {
|
||||
await testOnAboutAddonsType("XUL", test_addon_locked);
|
||||
});
|
||||
add_task(async function test_addon_locked() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
|
||||
const win = await BrowserOpenAddonsMgr("addons://list/extension");
|
||||
|
||||
add_task(async function test_HTML_aboutaddons_addon_locked() {
|
||||
await testOnAboutAddonsType("HTML", test_addon_locked);
|
||||
await isExtensionLocked(win, ADDON_ID);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_addon_reinstall() {
|
||||
|
|
|
@ -83,23 +83,3 @@ registerCleanupFunction(async function policies_headjs_finishWithCleanSlate() {
|
|||
EnterprisePolicyTesting.resetRunOnceState();
|
||||
PoliciesPrefTracker.stop();
|
||||
});
|
||||
|
||||
async function testOnAboutAddonsType(type, fn) {
|
||||
let useHtmlAboutAddons;
|
||||
switch (type) {
|
||||
case "XUL":
|
||||
useHtmlAboutAddons = false;
|
||||
break;
|
||||
case "HTML":
|
||||
useHtmlAboutAddons = true;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown about:addons type ${type}`);
|
||||
}
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", useHtmlAboutAddons]],
|
||||
});
|
||||
info(`Run tests on ${type} about:addons`);
|
||||
await fn();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
|
|
|
@ -12,12 +12,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
"extensions.abuseReport.enabled",
|
||||
false
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"HTML_ABOUTADDONS_ENABLED",
|
||||
"extensions.htmlaboutaddons.enabled",
|
||||
false
|
||||
);
|
||||
|
||||
let extData = {
|
||||
manifest: {
|
||||
|
@ -208,7 +202,7 @@ add_task(async function browseraction_contextmenu_manage_extension() {
|
|||
);
|
||||
is(
|
||||
reportExtension.hidden,
|
||||
!ABUSE_REPORT_ENABLED || !HTML_ABOUTADDONS_ENABLED || !visible,
|
||||
!ABUSE_REPORT_ENABLED || !visible,
|
||||
`Report Extension should be ${expected}`
|
||||
);
|
||||
is(
|
||||
|
@ -234,21 +228,16 @@ add_task(async function browseraction_contextmenu_manage_extension() {
|
|||
);
|
||||
await closeChromeContextMenu(menuId, manageExtension, win);
|
||||
let managerWindow = (await addonManagerPromise).linkedBrowser.contentWindow;
|
||||
if (managerWindow.useHtmlViews) {
|
||||
// Check the UI to make sure that the correct view is loaded.
|
||||
is(
|
||||
managerWindow.gViewController.currentViewId,
|
||||
`addons://detail/${encodeURIComponent(id)}`,
|
||||
"Expected extension details view in about:addons"
|
||||
);
|
||||
// In HTML about:addons, the default view does not show the inline
|
||||
// options browser, so we should not receive an "options-loaded" event.
|
||||
// (if we do, the test will fail due to the unexpected message).
|
||||
} else {
|
||||
info("Waiting for inline options page in XUL about:addons");
|
||||
// In XUL about:addons, the inline options page is shown by default.
|
||||
await extension.awaitMessage("options-loaded");
|
||||
}
|
||||
|
||||
// Check the UI to make sure that the correct view is loaded.
|
||||
is(
|
||||
managerWindow.gViewController.currentViewId,
|
||||
`addons://detail/${encodeURIComponent(id)}`,
|
||||
"Expected extension details view in about:addons"
|
||||
);
|
||||
// In HTML about:addons, the default view does not show the inline
|
||||
// options browser, so we should not receive an "options-loaded" event.
|
||||
// (if we do, the test will fail due to the unexpected message).
|
||||
|
||||
info(
|
||||
`Remove the opened tab, and await customize mode to be restored if necessary`
|
||||
|
@ -575,10 +564,7 @@ add_task(async function browseraction_contextmenu_remove_extension() {
|
|||
// mode enabled).
|
||||
add_task(async function browseraction_contextmenu_report_extension() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.abuseReport.enabled", true],
|
||||
],
|
||||
set: [["extensions.abuseReport.enabled", true]],
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
let id = "addon_id@example.com";
|
||||
|
|
|
@ -62,7 +62,7 @@ async function loadExtension(options) {
|
|||
return extension;
|
||||
}
|
||||
|
||||
async function run_test_inline_options() {
|
||||
add_task(async function run_test_inline_options() {
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
"http://example.com/"
|
||||
|
@ -256,19 +256,6 @@ async function run_test_inline_options() {
|
|||
await extension.unload();
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
}
|
||||
|
||||
add_task(async function test_inline_options() {
|
||||
for (let htmlEnabled of [false, true]) {
|
||||
info(
|
||||
`Test options opened inline ${htmlEnabled ? "HTML" : "XUL"} about:addons`
|
||||
);
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", htmlEnabled]],
|
||||
});
|
||||
await run_test_inline_options();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_tab_options() {
|
||||
|
|
|
@ -25,6 +25,7 @@ const { ActorClassWithSpec } = require("devtools/shared/protocol");
|
|||
const {
|
||||
webExtensionTargetSpec,
|
||||
} = require("devtools/shared/specs/targets/webextension");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -318,11 +319,17 @@ webExtensionTargetPrototype.isExtensionWindowDescendent = function(window) {
|
|||
webExtensionTargetPrototype._allowSource = function(source) {
|
||||
// Use the source.element to detect the allowed source, if any.
|
||||
if (source.element) {
|
||||
const domEl = unwrapDebuggerObjectGlobal(source.element);
|
||||
return (
|
||||
this.isExtensionWindow(domEl.ownerGlobal) ||
|
||||
this.isExtensionWindowDescendent(domEl.ownerGlobal)
|
||||
);
|
||||
try {
|
||||
const domEl = unwrapDebuggerObjectGlobal(source.element);
|
||||
return (
|
||||
this.isExtensionWindow(domEl.ownerGlobal) ||
|
||||
this.isExtensionWindowDescendent(domEl.ownerGlobal)
|
||||
);
|
||||
} catch (e) {
|
||||
// If the source's window is dead then the above will throw.
|
||||
DevToolsUtils.reportException("WebExtensionTarget.allowSource", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to check the uri if there is no source.element associated to the source.
|
||||
|
|
|
@ -242,6 +242,22 @@ TabSources.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Return whether a source represents an inline script.
|
||||
*/
|
||||
isInlineScript(source) {
|
||||
// Assume the source is inline if the element that introduced it is a
|
||||
// script element and does not have a src attribute.
|
||||
try {
|
||||
const e = source.element ? source.element.unsafeDereference() : null;
|
||||
return e && e.tagName === "SCRIPT" && !e.hasAttribute("src");
|
||||
} catch (e) {
|
||||
// If we are debugging a dead window then the above can throw.
|
||||
DevToolsUtils.reportException("TabSources.isInlineScript", e);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a source actor representing this source.
|
||||
*
|
||||
|
@ -266,14 +282,7 @@ TabSources.prototype = {
|
|||
// sources. Otherwise, use the `originalUrl` property to treat it
|
||||
// as an HTML source that manages multiple inline sources.
|
||||
|
||||
// Assume the source is inline if the element that introduced it is a
|
||||
// script element and does not have a src attribute.
|
||||
const element = source.element ? source.element.unsafeDereference() : null;
|
||||
if (
|
||||
element &&
|
||||
element.tagName === "SCRIPT" &&
|
||||
!element.hasAttribute("src")
|
||||
) {
|
||||
if (this.isInlineScript(source)) {
|
||||
if (source.introductionScript) {
|
||||
// As for other evaluated sources, script elements which were
|
||||
// dynamically generated when another script ran should have
|
||||
|
|
|
@ -2335,11 +2335,6 @@ void RecordCompositionPayloadsPresented(
|
|||
mozilla::Telemetry::KEYPRESS_PRESENT_LATENCY, payload.mTimeStamp,
|
||||
presented);
|
||||
}
|
||||
if (payload.mType == CompositionPayloadType::eAPZScroll) {
|
||||
Telemetry::AccumulateTimeDelta(
|
||||
mozilla::Telemetry::SCROLL_PRESENT_LATENCY, payload.mTimeStamp,
|
||||
presented);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,8 +97,6 @@ class APZSampler {
|
|||
const LayerMetricsWrapper& aLayer);
|
||||
AsyncTransformComponentMatrix GetCurrentAsyncTransformWithOverscroll(
|
||||
const LayerMetricsWrapper& aLayer);
|
||||
nsTArray<CompositionPayload> NotifyScrollSampling(
|
||||
const LayerMetricsWrapper& aLayer);
|
||||
|
||||
void MarkAsyncTransformAppliedToContent(const LayerMetricsWrapper& aLayer);
|
||||
bool HasUnusedAsyncTransform(const LayerMetricsWrapper& aLayer);
|
||||
|
|
|
@ -2350,8 +2350,7 @@ static bool TransformDisplacement(APZCTreeManager* aTreeManager,
|
|||
void APZCTreeManager::DispatchScroll(
|
||||
AsyncPanZoomController* aPrev, ParentLayerPoint& aStartPoint,
|
||||
ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp) {
|
||||
OverscrollHandoffState& aOverscrollHandoffState) {
|
||||
const OverscrollHandoffChain& overscrollHandoffChain =
|
||||
aOverscrollHandoffState.mChain;
|
||||
uint32_t overscrollHandoffChainIndex = aOverscrollHandoffState.mChainIndex;
|
||||
|
@ -2377,8 +2376,7 @@ void APZCTreeManager::DispatchScroll(
|
|||
|
||||
// Scroll |next|. If this causes overscroll, it will call DispatchScroll()
|
||||
// again with an incremented index.
|
||||
if (!next->AttemptScroll(aStartPoint, aEndPoint, aOverscrollHandoffState,
|
||||
aTimeStamp)) {
|
||||
if (!next->AttemptScroll(aStartPoint, aEndPoint, aOverscrollHandoffState)) {
|
||||
// Transform |aStartPoint| and |aEndPoint| (which now represent the
|
||||
// portion of the displacement that wasn't consumed by APZCs later
|
||||
// in the handoff chain) back into |aPrev|'s coordinate space. This
|
||||
|
|
|
@ -431,8 +431,7 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
|
|||
void DispatchScroll(AsyncPanZoomController* aApzc,
|
||||
ParentLayerPoint& aStartPoint,
|
||||
ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp);
|
||||
OverscrollHandoffState& aOverscrollHandoffState);
|
||||
|
||||
/**
|
||||
* This is a callback for AsyncPanZoomController to call when it wants to
|
||||
|
|
|
@ -162,14 +162,6 @@ AsyncTransform APZSampler::GetCurrentAsyncTransform(
|
|||
AsyncPanZoomController::eForCompositing, aComponents);
|
||||
}
|
||||
|
||||
nsTArray<CompositionPayload> APZSampler::NotifyScrollSampling(
|
||||
const LayerMetricsWrapper& aLayer) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
AssertOnSamplerThread();
|
||||
MOZ_ASSERT(aLayer.GetApzc());
|
||||
return aLayer.GetApzc()->NotifyScrollSampling();
|
||||
}
|
||||
|
||||
AsyncTransform APZSampler::GetCurrentAsyncTransformForFixedAdjustment(
|
||||
const LayerMetricsWrapper& aLayer) {
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
|
|
|
@ -2029,8 +2029,8 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) {
|
|||
OverscrollHandoffState handoffState(
|
||||
*mInputQueue->GetCurrentKeyboardBlock()->GetOverscrollHandoffChain(),
|
||||
distance, ScrollSource::Keyboard);
|
||||
TimeStamp eventTimeStamp = aEvent.mTimeStamp;
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState, eventTimeStamp);
|
||||
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState);
|
||||
|
||||
SetState(NOTHING);
|
||||
|
||||
|
@ -2387,8 +2387,7 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(
|
|||
distance, ScrollSource::Wheel);
|
||||
ParentLayerPoint startPoint = aEvent.mLocalOrigin;
|
||||
ParentLayerPoint endPoint = aEvent.mLocalOrigin - delta;
|
||||
TimeStamp eventTimeStamp = aEvent.mTimeStamp;
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState, eventTimeStamp);
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState);
|
||||
|
||||
SetState(NOTHING);
|
||||
|
||||
|
@ -2631,8 +2630,7 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent,
|
|||
ParentLayerPoint startPoint = aEvent.mLocalPanStartPoint;
|
||||
ParentLayerPoint endPoint =
|
||||
aEvent.mLocalPanStartPoint - logicalPanDisplacement;
|
||||
TimeStamp eventTimeStamp = aEvent.mTimeStamp;
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState, eventTimeStamp);
|
||||
CallDispatchScroll(startPoint, endPoint, handoffState);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -3141,38 +3139,9 @@ void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(
|
|||
mY.UpdateWithTouchAtDevicePoint(point.y, aEvent.mTime);
|
||||
}
|
||||
|
||||
nsTArray<CompositionPayload> AsyncPanZoomController::NotifyScrollSampling() {
|
||||
AsyncTransform currTransform =
|
||||
GetCurrentAsyncTransform(AsyncPanZoomController::eForCompositing);
|
||||
if (IsZero(currTransform.mTranslation)) {
|
||||
// The current layer isn't moving, hence the frames don't contribute
|
||||
// to movement of the layer and we clear the vectors.
|
||||
mSampledFrameScrolls.Clear();
|
||||
mIncomingFrameScrolls.Clear();
|
||||
mPrevFrameScrolls.Clear();
|
||||
return nsTArray<CompositionPayload>();
|
||||
}
|
||||
|
||||
if (StaticPrefs::apz_frame_delay_enabled()) {
|
||||
// If frame.delay enabled, we pass along the scroll events from
|
||||
// frame before since they were what moved the items on the layer
|
||||
mSampledFrameScrolls = std::move(mPrevFrameScrolls);
|
||||
mPrevFrameScrolls = std::move(mIncomingFrameScrolls);
|
||||
} else {
|
||||
// If frame.delay disabled, the triggering events are those
|
||||
// from the most recent frame
|
||||
mSampledFrameScrolls = std::move(mIncomingFrameScrolls);
|
||||
}
|
||||
// Clear frame to record scroll events for the next frame
|
||||
mIncomingFrameScrolls.Clear();
|
||||
|
||||
return std::move(mSampledFrameScrolls);
|
||||
}
|
||||
|
||||
bool AsyncPanZoomController::AttemptScroll(
|
||||
ParentLayerPoint& aStartPoint, ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp) {
|
||||
OverscrollHandoffState& aOverscrollHandoffState) {
|
||||
// "start - end" rather than "end - start" because e.g. moving your finger
|
||||
// down (*positive* direction along y axis) causes the vertical scroll offset
|
||||
// to *decrease* as the page follows your finger.
|
||||
|
@ -3214,8 +3183,6 @@ bool AsyncPanZoomController::AttemptScroll(
|
|||
}
|
||||
|
||||
if (!IsZero(adjustedDisplacement)) {
|
||||
mIncomingFrameScrolls.AppendElement(
|
||||
CompositionPayload{CompositionPayloadType::eAPZScroll, aTimeStamp});
|
||||
ScrollBy(adjustedDisplacement / Metrics().GetZoom());
|
||||
if (InputBlockState* block = GetCurrentInputBlock()) {
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
@ -3274,8 +3241,7 @@ bool AsyncPanZoomController::AttemptScroll(
|
|||
// Note: "+ overscroll" rather than "- overscroll" because "overscroll"
|
||||
// is what's left of "displacement", and "displacement" is "start - end".
|
||||
++aOverscrollHandoffState.mChainIndex;
|
||||
CallDispatchScroll(aStartPoint, aEndPoint, aOverscrollHandoffState,
|
||||
aTimeStamp);
|
||||
CallDispatchScroll(aStartPoint, aEndPoint, aOverscrollHandoffState);
|
||||
|
||||
overscroll = aStartPoint - aEndPoint;
|
||||
if (IsZero(overscroll)) {
|
||||
|
@ -3509,8 +3475,7 @@ void AsyncPanZoomController::StartOverscrollAnimation(
|
|||
|
||||
void AsyncPanZoomController::CallDispatchScroll(
|
||||
ParentLayerPoint& aStartPoint, ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp) {
|
||||
OverscrollHandoffState& aOverscrollHandoffState) {
|
||||
// Make a local copy of the tree manager pointer and check if it's not
|
||||
// null before calling DispatchScroll(). This is necessary because
|
||||
// Destroy(), which nulls out mTreeManager, could be called concurrently.
|
||||
|
@ -3536,7 +3501,7 @@ void AsyncPanZoomController::CallDispatchScroll(
|
|||
}
|
||||
|
||||
treeManagerLocal->DispatchScroll(this, aStartPoint, endPoint,
|
||||
aOverscrollHandoffState, aTimeStamp);
|
||||
aOverscrollHandoffState);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
||||
|
@ -3553,9 +3518,7 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
|||
OverscrollHandoffState handoffState(
|
||||
*GetCurrentTouchBlock()->GetOverscrollHandoffChain(), panVector,
|
||||
ScrollSource::Touch);
|
||||
TimeStamp eventTimeStamp = aEvent.mTimeStamp;
|
||||
CallDispatchScroll(prevTouchPoint, touchPoint, handoffState,
|
||||
eventTimeStamp);
|
||||
CallDispatchScroll(prevTouchPoint, touchPoint, handoffState);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1043,15 +1043,9 @@ class AsyncPanZoomController {
|
|||
// Position on screen where user first put their finger down.
|
||||
ExternalPoint mStartTouch;
|
||||
|
||||
nsTArray<CompositionPayload> mPrevFrameScrolls;
|
||||
nsTArray<CompositionPayload> mIncomingFrameScrolls;
|
||||
nsTArray<CompositionPayload> mSampledFrameScrolls;
|
||||
|
||||
friend class Axis;
|
||||
|
||||
public:
|
||||
nsTArray<CompositionPayload> NotifyScrollSampling();
|
||||
|
||||
/**
|
||||
* Invoke |callable|, passing |mLastContentPaintMetrics| as argument,
|
||||
* while holding the APZC lock required to access |mLastContentPaintMetrics|.
|
||||
|
@ -1464,8 +1458,7 @@ class AsyncPanZoomController {
|
|||
* scroll gesture was consumed by APZCs in the handoff chain.
|
||||
*/
|
||||
bool AttemptScroll(ParentLayerPoint& aStartPoint, ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp);
|
||||
OverscrollHandoffState& aOverscrollHandoffState);
|
||||
|
||||
void FlushRepaintForOverscrollHandoff();
|
||||
|
||||
|
@ -1504,8 +1497,7 @@ class AsyncPanZoomController {
|
|||
*/
|
||||
void CallDispatchScroll(ParentLayerPoint& aStartPoint,
|
||||
ParentLayerPoint& aEndPoint,
|
||||
OverscrollHandoffState& aOverscrollHandoffState,
|
||||
const TimeStamp& aTimeStamp);
|
||||
OverscrollHandoffState& aOverscrollHandoffState);
|
||||
|
||||
/**
|
||||
* A helper function for overscrolling during panning. This is a wrapper
|
||||
|
|
|
@ -1029,18 +1029,10 @@ bool AsyncCompositionManager::ApplyAsyncContentTransformToTree(
|
|||
sampler->GetGuid(*zoomedMetrics) == sampler->GetGuid(wrapper))
|
||||
? AsyncTransformComponents{AsyncTransformComponent::eLayout}
|
||||
: LayoutAndVisual;
|
||||
|
||||
AsyncTransform asyncTransformWithoutOverscroll =
|
||||
sampler->GetCurrentAsyncTransform(wrapper,
|
||||
asyncTransformComponents);
|
||||
nsTArray<CompositionPayload> payloads =
|
||||
sampler->NotifyScrollSampling(wrapper);
|
||||
// The scroll latency should be measured between composition and the
|
||||
// first scrolling event. Otherwise we observe metrics with <16ms
|
||||
// latency even when frame.delay is enabled.
|
||||
if (!payloads.IsEmpty()) {
|
||||
mLayerManager->RegisterPayload(payloads.ElementAt(0));
|
||||
}
|
||||
|
||||
AsyncTransformComponentMatrix overscrollTransform =
|
||||
sampler->GetOverscrollTransform(wrapper);
|
||||
AsyncTransformComponentMatrix asyncTransform =
|
||||
|
|
|
@ -1461,7 +1461,7 @@ bool GCRuntime::setParameter(JSGCParamKey key, uint32_t value,
|
|||
return false;
|
||||
}
|
||||
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
|
||||
zone->updateAllGCThresholds(*this, lock);
|
||||
zone->updateAllGCThresholds(*this, GC_NORMAL, lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1720,7 +1720,7 @@ void GCRuntime::resetParameter(JSGCParamKey key, AutoLockGC& lock) {
|
|||
default:
|
||||
tunables.resetParameter(key, lock);
|
||||
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
|
||||
zone->updateAllGCThresholds(*this, lock);
|
||||
zone->updateAllGCThresholds(*this, GC_NORMAL, lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2167,19 +2167,16 @@ void ZoneHeapThreshold::updateForRemovedArena(
|
|||
}
|
||||
|
||||
/* static */
|
||||
size_t ZoneMallocThreshold::computeZoneTriggerBytes(
|
||||
float growthFactor, size_t lastBytes, const GCSchedulingTunables& tunables,
|
||||
const AutoLockGC& lock) {
|
||||
size_t base = Max(lastBytes, tunables.maxMallocBytes());
|
||||
float trigger = float(base) * growthFactor;
|
||||
return size_t(trigger);
|
||||
size_t ZoneMallocThreshold::computeZoneTriggerBytes(float growthFactor,
|
||||
size_t lastBytes,
|
||||
size_t baseBytes,
|
||||
const AutoLockGC& lock) {
|
||||
return size_t(float(Max(lastBytes, baseBytes)) * growthFactor);
|
||||
}
|
||||
|
||||
void ZoneMallocThreshold::updateAfterGC(size_t lastBytes,
|
||||
const GCSchedulingTunables& tunables,
|
||||
const GCSchedulingState& state,
|
||||
void ZoneMallocThreshold::updateAfterGC(size_t lastBytes, size_t baseBytes,
|
||||
const AutoLockGC& lock) {
|
||||
gcTriggerBytes_ = computeZoneTriggerBytes(2.0, lastBytes, tunables, lock);
|
||||
gcTriggerBytes_ = computeZoneTriggerBytes(2.0, lastBytes, baseBytes, lock);
|
||||
}
|
||||
|
||||
MemoryCounter::MemoryCounter()
|
||||
|
@ -5991,7 +5988,7 @@ IncrementalProgress GCRuntime::endSweepingSweepGroup(FreeOp* fop,
|
|||
for (SweepGroupZonesIter zone(rt); !zone.done(); zone.next()) {
|
||||
AutoLockGC lock(rt);
|
||||
zone->changeGCState(Zone::Sweep, Zone::Finished);
|
||||
zone->updateAllGCThresholds(*this, lock);
|
||||
zone->updateAllGCThresholds(*this, invocationKind, lock);
|
||||
zone->updateAllGCMallocCountersOnGCEnd(lock);
|
||||
zone->arenas.unmarkPreMarkedFreeCells();
|
||||
}
|
||||
|
|
|
@ -714,12 +714,12 @@ class ZoneHeapThreshold : public ZoneThreshold {
|
|||
// GC based on malloc data.
|
||||
class ZoneMallocThreshold : public ZoneThreshold {
|
||||
public:
|
||||
void updateAfterGC(size_t lastBytes, const GCSchedulingTunables& tunables,
|
||||
const GCSchedulingState& state, const AutoLockGC& lock);
|
||||
void updateAfterGC(size_t lastBytes, size_t baseBytes,
|
||||
const AutoLockGC& lock);
|
||||
|
||||
private:
|
||||
static size_t computeZoneTriggerBytes(float growthFactor, size_t lastBytes,
|
||||
const GCSchedulingTunables& tunables,
|
||||
size_t baseBytes,
|
||||
const AutoLockGC& lock);
|
||||
};
|
||||
|
||||
|
@ -727,9 +727,9 @@ class ZoneMallocThreshold : public ZoneThreshold {
|
|||
|
||||
// Counts memory associated with GC things in a zone.
|
||||
//
|
||||
// In debug builds, this records details of the cell the memory allocations is
|
||||
// associated with to check the correctness of the information provided. In opt
|
||||
// builds it's just a counter.
|
||||
// This records details of the cell the memory allocations is associated with to
|
||||
// check the correctness of the information provided. This is not present in opt
|
||||
// builds.
|
||||
class MemoryTracker {
|
||||
public:
|
||||
MemoryTracker();
|
||||
|
|
|
@ -36,10 +36,7 @@ ZoneAllocator::ZoneAllocator(JSRuntime* rt)
|
|||
zoneSize(&rt->gc.heapSize),
|
||||
gcMallocBytes(nullptr) {
|
||||
AutoLockGC lock(rt);
|
||||
threshold.updateAfterGC(8192, GC_NORMAL, rt->gc.tunables,
|
||||
rt->gc.schedulingState, lock);
|
||||
gcMallocThreshold.updateAfterGC(8192, rt->gc.tunables, rt->gc.schedulingState,
|
||||
lock);
|
||||
updateAllGCThresholds(rt->gc, GC_NORMAL, lock);
|
||||
setGCMaxMallocBytes(rt->gc.tunables.maxMallocBytes(), lock);
|
||||
jitCodeCounter.setMax(jit::MaxCodeBytesPerProcess * 0.8, lock);
|
||||
}
|
||||
|
@ -73,11 +70,12 @@ void js::ZoneAllocator::updateAllGCMallocCountersOnGCEnd(
|
|||
}
|
||||
|
||||
void js::ZoneAllocator::updateAllGCThresholds(GCRuntime& gc,
|
||||
JSGCInvocationKind invocationKind,
|
||||
const js::AutoLockGC& lock) {
|
||||
threshold.updateAfterGC(zoneSize.gcBytes(), GC_NORMAL, gc.tunables,
|
||||
threshold.updateAfterGC(zoneSize.gcBytes(), invocationKind, gc.tunables,
|
||||
gc.schedulingState, lock);
|
||||
gcMallocThreshold.updateAfterGC(gcMallocBytes.gcBytes(), gc.tunables,
|
||||
gc.schedulingState, lock);
|
||||
gcMallocThreshold.updateAfterGC(gcMallocBytes.gcBytes(),
|
||||
gc.tunables.maxMallocBytes(), lock);
|
||||
}
|
||||
|
||||
js::gc::TriggerKind js::ZoneAllocator::shouldTriggerGCForTooMuchMalloc() {
|
||||
|
|
|
@ -65,7 +65,9 @@ class ZoneAllocator : public JS::shadow::Zone,
|
|||
|
||||
void updateAllGCMallocCountersOnGCStart();
|
||||
void updateAllGCMallocCountersOnGCEnd(const js::AutoLockGC& lock);
|
||||
void updateAllGCThresholds(gc::GCRuntime& gc, const js::AutoLockGC& lock);
|
||||
void updateAllGCThresholds(gc::GCRuntime& gc,
|
||||
JSGCInvocationKind invocationKind,
|
||||
const js::AutoLockGC& lock);
|
||||
js::gc::TriggerKind shouldTriggerGCForTooMuchMalloc();
|
||||
|
||||
// Memory accounting APIs for malloc memory owned by GC cells.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
[scroll-to-top.html]
|
||||
[Fragment Navigation: When fragid is TOP scroll to the top of the document]
|
||||
disabled:
|
||||
if os == "android" and debug: Unstable on GeckoView (Bug 1548023)
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
[send-after-setting-document-domain.htm]
|
||||
disabled:
|
||||
if (os == "android") and debug: https://bugzilla.mozilla.org/show_bug.cgi?id=1550758
|
||||
|
||||
expected:
|
||||
if (os == "android") and not debug and e10s: TIMEOUT
|
||||
[All tests ran]
|
||||
expected:
|
||||
if (os == "android") and not debug and e10s: TIMEOUT
|
||||
|
|
@ -1562,17 +1562,6 @@
|
|||
"description": "Time between receiving a keypress event on the event loop and compositing its result onto the screen (ms)",
|
||||
"bug_numbers": [ 1506537 ]
|
||||
},
|
||||
"SCROLL_PRESENT_LATENCY": {
|
||||
"record_in_processes": [ "all" ],
|
||||
"alert_emails": [ "perfteam@mozilla.com", "vchin@mozilla.com" ],
|
||||
"expires_in_version": "never",
|
||||
"kind": "exponential",
|
||||
"low": 1,
|
||||
"high": 20000,
|
||||
"n_buckets": 100,
|
||||
"description": "Time between receiving a scroll event on the event loop and compositing its result onto the screen (ms)",
|
||||
"bug_numbers": [ 1500465 ]
|
||||
},
|
||||
"CANVAS_2D_USED": {
|
||||
"record_in_processes": ["main", "content"],
|
||||
"expires_in_version": "never",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/* globals MozXULElement, Services, useHtmlViews, getHtmlBrowser, htmlBrowserLoaded */
|
||||
/* globals MozXULElement, Services, getHtmlBrowser, htmlBrowserLoaded */
|
||||
|
||||
{
|
||||
const ABUSE_REPORT_ENABLED = Services.prefs.getBoolPref(
|
||||
|
@ -270,7 +270,7 @@
|
|||
// If the html about:addons and the abuse report are both enabled, register
|
||||
// the custom XUL WebComponent and append it to the XUL stack element
|
||||
// (if not registered the element will be just a dummy hidden box)
|
||||
if (useHtmlViews && ABUSE_REPORT_ENABLED) {
|
||||
if (ABUSE_REPORT_ENABLED) {
|
||||
customElements.define(
|
||||
"addon-abuse-report-xulframe",
|
||||
AddonAbuseReportsXULFrame
|
||||
|
|
|
@ -18,125 +18,15 @@ xhtml|link {
|
|||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.addon[status="installed"] {
|
||||
-moz-box-orient: vertical;
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-generic");
|
||||
}
|
||||
|
||||
.addon[status="installing"] {
|
||||
-moz-box-orient: vertical;
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-installing");
|
||||
}
|
||||
|
||||
.addon[pending="uninstall"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#addon-uninstalled");
|
||||
}
|
||||
|
||||
.creator {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#creator-link");
|
||||
}
|
||||
|
||||
.meta-rating {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#rating");
|
||||
}
|
||||
|
||||
.download-progress, .download-progress[mode="undetermined"] {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#download-progress");
|
||||
}
|
||||
|
||||
.install-status {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#install-status");
|
||||
}
|
||||
|
||||
.detail-row {
|
||||
-moz-binding: url("chrome://mozapps/content/extensions/extensions.xml#detail-row");
|
||||
}
|
||||
|
||||
.text-list {
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
row[unsupported="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#addonitem-popup > menuitem[disabled="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#addonitem-popup[addontype="theme"] > #menuitem_enableItem,
|
||||
#addonitem-popup[addontype="theme"] > #menuitem_disableItem,
|
||||
#addonitem-popup:not([addontype="theme"]) > #menuitem_enableTheme,
|
||||
#addonitem-popup:not([addontype="theme"]) > #menuitem_disableTheme {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#show-disabled-unsigned-extensions .button-text {
|
||||
margin-inline-start: 3px !important;
|
||||
margin-inline-end: 2px !important;
|
||||
}
|
||||
|
||||
#header-searching:not([active]) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#detail-view {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.addon:not([notification="warning"]) .warning,
|
||||
.addon:not([notification="error"]) .error,
|
||||
.addon:not([notification="info"]) .info,
|
||||
.addon:not([pending]) .pending,
|
||||
.addon:not([upgrade="true"]) .update-postfix,
|
||||
.addon[active="true"] .disabled-postfix,
|
||||
.addon[pending="install"] .update-postfix,
|
||||
.addon[pending="install"] .disabled-postfix,
|
||||
.addon[legacy="false"] .legacy-warning,
|
||||
#detail-view:not([notification="warning"]) .warning,
|
||||
#detail-view:not([notification="error"]) .error,
|
||||
#detail-view:not([notification="info"]) .info,
|
||||
#detail-view:not([pending]) .pending,
|
||||
#detail-view:not([upgrade="true"]) .update-postfix,
|
||||
#detail-view[active="true"] .disabled-postfix,
|
||||
#detail-view[legacy="false"] .legacy-warning,
|
||||
#detail-view[loading] .detail-view-container,
|
||||
#detail-view:not([loading]) .alert-container,
|
||||
.detail-row:not([value]),
|
||||
#legacy-list .addon .disabled-postfix {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.addon .privateBrowsing-notice {
|
||||
display: none;
|
||||
}
|
||||
.addon[privateBrowsing="true"] .privateBrowsing-notice-container {
|
||||
/* 40px is width and margin of .icon-container */
|
||||
margin-inline-start: 40px;
|
||||
}
|
||||
.addon[privateBrowsing="true"] .privateBrowsing-notice {
|
||||
margin: 4px 0 0;
|
||||
display: inline-block;
|
||||
}
|
||||
.addon[active="false"] .privateBrowsing-notice {
|
||||
background-color: var(--purple-70-a40);
|
||||
}
|
||||
|
||||
#addons-page:not([warning]) #list-view > .global-warning-container {
|
||||
display: none;
|
||||
}
|
||||
#addon-list .date-updated,
|
||||
#legacy-list .date-updated {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.view-pane:not(#updates-view) .addon .relnotes-toggle,
|
||||
.view-pane:not(#updates-view) .addon .include-update,
|
||||
#updates-view:not([updatetype="available"]) .addon .include-update,
|
||||
#updates-view[updatetype="available"] .addon .update-available-notice {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#addons-page:not([warning]) .global-warning,
|
||||
#addons-page:not([warning="safemode"]) .global-warning-safemode,
|
||||
#addons-page:not([warning="checkcompatibility"]) .global-warning-checkcompatibility,
|
||||
|
@ -155,15 +45,6 @@ row[unsupported="true"] {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.list-view-notice {
|
||||
margin-inline-start: 28px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.list-view-notice > .message-bar {
|
||||
width: 664px;
|
||||
}
|
||||
|
||||
.html-alert-container > .message-bar {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
@ -172,26 +53,6 @@ row[unsupported="true"] {
|
|||
margin-inline: 0;
|
||||
}
|
||||
|
||||
.addon .relnotes {
|
||||
-moz-user-select: text;
|
||||
}
|
||||
#detail-name, #detail-desc, #detail-fulldesc {
|
||||
-moz-user-select: text;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#detail-name-container {
|
||||
/* Set a max-width on this so the labels inside of this will wrap instead of
|
||||
growing the card horizontally with long names. */
|
||||
max-width: 580px;
|
||||
}
|
||||
|
||||
/* Make sure we're not animating hidden images. See bug 623739. */
|
||||
#view-port:not([selectedIndex="0"]) #discover-view .loading,
|
||||
#discover-view:not([selectedIndex="0"]) .loading {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Elements in unselected richlistitems cannot be focused */
|
||||
richlistitem:not([selected]) * {
|
||||
-moz-user-focus: ignore;
|
||||
|
@ -201,14 +62,6 @@ richlistitem:not([selected]) * {
|
|||
width: 22em;
|
||||
}
|
||||
|
||||
.discover-button[disabled="true"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.view-pane:not(#legacy-view) .addon-control.replacement {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#pluginFlashBlockingCheckbox .checkbox-label-box {
|
||||
display: none; /*see bug 1508724*/
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -36,32 +36,6 @@
|
|||
<script src="chrome://mozapps/content/extensions/abuse-report-frame.js"/>
|
||||
|
||||
<popupset>
|
||||
<!-- menu for an addon item -->
|
||||
<menupopup id="addonitem-popup">
|
||||
<menuitem id="menuitem_showDetails" command="cmd_showItemDetails"
|
||||
default="true" data-l10n-id="cmd-show-details"/>
|
||||
<menuitem id="menuitem_enableItem" command="cmd_enableItem"
|
||||
label="&cmd.enableAddon.label;"
|
||||
accesskey="&cmd.enableAddon.accesskey;"/>
|
||||
<menuitem id="menuitem_disableItem" command="cmd_disableItem"
|
||||
label="&cmd.disableAddon.label;"
|
||||
accesskey="&cmd.disableAddon.accesskey;"/>
|
||||
<menuitem id="menuitem_enableTheme" command="cmd_enableItem"
|
||||
data-l10n-id="cmd-enable-theme"/>
|
||||
<menuitem id="menuitem_disableTheme" command="cmd_disableItem"
|
||||
data-l10n-id="cmd-disable-theme"/>
|
||||
<menuitem id="menuitem_installItem" command="cmd_installItem"
|
||||
data-l10n-id="cmd-install-addon"/>
|
||||
<menuitem id="menuitem_uninstallItem" command="cmd_uninstallItem"
|
||||
label="&cmd.uninstallAddon.label;"
|
||||
accesskey="&cmd.uninstallAddon.accesskey;"/>
|
||||
<menuseparator id="addonitem-menuseparator" />
|
||||
<menuitem id="menuitem_preferences" command="cmd_showItemPreferences"
|
||||
data-l10n-id="cmd-preferences"/>
|
||||
<menuitem id="menuitem_findUpdates" command="cmd_findItemUpdates"
|
||||
data-l10n-id="cmd-find-updates"/>
|
||||
</menupopup>
|
||||
|
||||
<menulist popuponly="true" id="ContentSelectDropdown" hidden="true">
|
||||
<menupopup rolluponmousewheel="true"
|
||||
activateontab="true" position="after_start"
|
||||
|
@ -80,8 +54,6 @@
|
|||
norolluponanchor="true"
|
||||
nomaxresults="true" />
|
||||
|
||||
<tooltip id="addonitem-tooltip"/>
|
||||
|
||||
<menupopup id="contentAreaContextMenu"
|
||||
onpopupshowing="Cu.reportError('This dummy menupopup is not supposed to be shown');
|
||||
return false">
|
||||
|
@ -96,7 +68,6 @@
|
|||
<!-- XXXsw remove useless oncommand attribute once bug 371900 is fixed -->
|
||||
<command id="cmd_focusSearch" oncommand=";"/>
|
||||
<command id="cmd_findAllUpdates"/>
|
||||
<command id="cmd_restartApp"/>
|
||||
<command id="cmd_goToDiscoverPane"/>
|
||||
<command id="cmd_goToRecentUpdates"/>
|
||||
<command id="cmd_goToAvailableUpdates"/>
|
||||
|
@ -108,29 +79,9 @@
|
|||
<command id="cmd_enableUpdateSecurity"/>
|
||||
<command id="cmd_toggleAutoUpdateDefault"/>
|
||||
<command id="cmd_resetAddonAutoUpdate"/>
|
||||
<command id="cmd_showUnsignedExtensions"/>
|
||||
<command id="cmd_showAllExtensions"/>
|
||||
<command id="cmd_showShortcuts"/>
|
||||
</commandset>
|
||||
|
||||
<!-- view commands - these act on the selected addon -->
|
||||
<commandset id="viewCommandSet"
|
||||
events="richlistbox-select" commandupdater="true">
|
||||
<command id="cmd_showItemDetails"/>
|
||||
<command id="cmd_findItemUpdates"/>
|
||||
<command id="cmd_showItemPreferences"/>
|
||||
<command id="cmd_enableItem"/>
|
||||
<command id="cmd_disableItem"/>
|
||||
<command id="cmd_installItem"/>
|
||||
<command id="cmd_uninstallItem"/>
|
||||
<command id="cmd_cancelUninstallItem"/>
|
||||
<command id="cmd_cancelOperation"/>
|
||||
<command id="cmd_contribute"/>
|
||||
<command id="cmd_askToActivateItem"/>
|
||||
<command id="cmd_alwaysActivateItem"/>
|
||||
<command id="cmd_neverActivateItem"/>
|
||||
</commandset>
|
||||
|
||||
<keyset>
|
||||
<key id="focusSearch" data-l10n-id="search-header-shortcut"
|
||||
modifiers="accel" command="cmd_focusSearch"/>
|
||||
|
@ -146,9 +97,6 @@
|
|||
data-l10n-id="extensions-view-discopane"
|
||||
data-l10n-attrs="name"
|
||||
priority="1000"/>
|
||||
<richlistitem id="category-legacy" value="addons://legacy/"
|
||||
class="category" priority="20000"
|
||||
hidden="true"/>
|
||||
<richlistitem id="category-availableUpdates" value="addons://updates/available"
|
||||
class="category"
|
||||
data-l10n-id="extensions-view-available-updates"
|
||||
|
@ -221,14 +169,7 @@
|
|||
<vbox id="headered-views" flex="1">
|
||||
<!-- main header -->
|
||||
<hbox id="header">
|
||||
<hbox id="header-inner" align="center">
|
||||
<button id="show-all-extensions" hidden="true"
|
||||
data-l10n-id="show-all-extensions-button"
|
||||
command="cmd_showAllExtensions"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="show-disabled-unsigned-extensions" hidden="true"
|
||||
class="warning" data-l10n-id="show-unsigned-extensions-button"
|
||||
command="cmd_showUnsignedExtensions"/>
|
||||
<hbox id="header-inner" align="center" pack="end">
|
||||
<label id="search-label" control="header-search"/>
|
||||
<textbox id="header-search" is="search-textbox" searchbutton="true"
|
||||
data-l10n-id="search-header"
|
||||
|
@ -258,9 +199,6 @@
|
|||
data-l10n-id="extensions-updates-installed"/>
|
||||
<label id="updates-downloaded" hidden="true"
|
||||
data-l10n-id="extensions-updates-downloaded"/>
|
||||
<button id="updates-restart-btn" class="button-link" hidden="true"
|
||||
data-l10n-id="extensions-updates-restart"
|
||||
command="cmd_restartApp"/>
|
||||
</hbox>
|
||||
|
||||
<button id="header-utils-btn" type="menu" data-l10n-id="tools-menu">
|
||||
|
@ -299,379 +237,9 @@
|
|||
</hbox>
|
||||
|
||||
<deck id="headered-views-content" flex="1" selectedIndex="0">
|
||||
<!-- list view -->
|
||||
<vbox id="list-view" flex="1" class="view-pane" align="stretch">
|
||||
<!-- info UI for add-ons that have been disabled for being unsigned -->
|
||||
<vbox id="disabled-unsigned-addons-info" class="alert-container" hidden="true">
|
||||
<label id="disabled-unsigned-addons-heading" data-l10n-id="disabled-unsigned-heading"/>
|
||||
<description data-l10n-id="disabled-unsigned-description">
|
||||
<label class="plain" id="find-alternative-addons" data-l10n-name="find-addons" is="text-link"/>
|
||||
</description>
|
||||
<hbox pack="start"><label id="signing-learn-more" data-l10n-id="disabled-unsigned-learn-more" is="text-link"></label></hbox>
|
||||
<description id="signing-dev-info" data-l10n-id="disabled-unsigned-devinfo">
|
||||
<label class="plain" id="signing-dev-manual-link" data-l10n-name="learn-more" is="text-link"/>
|
||||
</description>
|
||||
</vbox>
|
||||
<vbox id="legacy-extensions-notice" class="alert-container" hidden="true">
|
||||
<vbox class="alert">
|
||||
<description id="legacy-extensions-description">
|
||||
<label class="plain" id="legacy-extensions-learnmore-link" data-l10n-id="legacy-warning-show-legacy" is="text-link"/>
|
||||
</description>
|
||||
</vbox>
|
||||
</vbox>
|
||||
<vbox id="private-browsing-notice" class="alert-container" hidden="true" align="start">
|
||||
<hbox class="message-bar" align="start">
|
||||
<image class="message-bar-icon"/>
|
||||
<vbox class="message-container">
|
||||
<description class="message-bar-description" data-l10n-id="private-browsing-description2">
|
||||
<label class="plain" id="private-browsing-learnmore-link" data-l10n-name="private-browsing-learn-more" is="text-link"/>
|
||||
</description>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="plugindeprecation-notice" class="list-view-notice" align="start">
|
||||
<hbox class="message-bar">
|
||||
<image class="message-bar-icon"/>
|
||||
<description class="message-bar-description" data-l10n-id="plugin-deprecation-description">
|
||||
<label class="plain" id="plugindeprecation-learnmore-link" data-l10n-name="learn-more" is="text-link"></label>
|
||||
</description>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<hbox class="view-header global-warning-container">
|
||||
<!-- global warnings -->
|
||||
<hbox class="global-warning" flex="1">
|
||||
<hbox class="global-warning-safemode" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-safe-mode-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-safe-mode-label"/>
|
||||
</hbox>
|
||||
<hbox class="global-warning-checkcompatibility" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-check-compatibility-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-check-compatibility-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-checkcompatibility"
|
||||
data-l10n-id="extensions-warning-check-compatibility-enable"
|
||||
command="cmd_enableCheckCompatibility"/>
|
||||
<hbox class="global-warning-updatesecurity" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-update-security-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-update-security-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-updatesecurity"
|
||||
data-l10n-id="extensions-warning-update-security-enable"
|
||||
command="cmd_enableUpdateSecurity"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
</hbox>
|
||||
<vbox id="addon-list-empty" class="alert-container"
|
||||
flex="1" hidden="true">
|
||||
<spacer class="alert-spacer-before"/>
|
||||
<vbox class="alert">
|
||||
<label data-l10n-id="list-empty-installed"/>
|
||||
<button class="discover-button"
|
||||
id="discover-button-install"
|
||||
data-l10n-id="list-empty-button"
|
||||
command="cmd_goToDiscoverPane"/>
|
||||
</vbox>
|
||||
<spacer class="alert-spacer-after"/>
|
||||
</vbox>
|
||||
<richlistbox id="addon-list" class="list" flex="1"/>
|
||||
</vbox>
|
||||
|
||||
<!-- extension shortcuts view -->
|
||||
<browser id="shortcuts-view" type="content" flex="1" disablehistory="true"/>
|
||||
|
||||
<!-- legacy extensions view -->
|
||||
<vbox id="legacy-view" flex="1" class="view-pane" align="stretch">
|
||||
<vbox id="legacy-extensions-info">
|
||||
<label id="legacy-extensions-heading" data-l10n-id="legacy-extensions"/>
|
||||
<description data-l10n-id="legacy-extensions-description">
|
||||
<label class="plain" id="legacy-learnmore" data-l10n-name="legacy-learn-more" is="text-link"></label>
|
||||
</description>
|
||||
</vbox>
|
||||
<richlistbox id="legacy-list" class="list" flex="1"/>
|
||||
</vbox>
|
||||
|
||||
<!-- updates view -->
|
||||
<vbox id="updates-view" flex="1" class="view-pane">
|
||||
<hbox class="view-header global-warning-container" align="center">
|
||||
<!-- global warnings -->
|
||||
<hbox class="global-warning" flex="1">
|
||||
<hbox class="global-warning-safemode" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-safe-mode-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-safe-mode-label"/>
|
||||
</hbox>
|
||||
<hbox class="global-warning-checkcompatibility" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-check-compatibility-label">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-check-compatibility-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-checkcompatibility"
|
||||
data-l10n-id="extensions-warning-check-compatibility-enable"
|
||||
command="cmd_enableCheckCompatibility"/>
|
||||
<hbox class="global-warning-updatesecurity" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-update-security-label">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-update-security-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-updatesecurity"
|
||||
data-l10n-id="extensions-warning-update-security-enable"
|
||||
command="cmd_enableUpdateSecurity"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
</hbox>
|
||||
<vbox id="updates-list-empty" class="alert-container"
|
||||
flex="1" hidden="true">
|
||||
<spacer class="alert-spacer-before"/>
|
||||
<vbox class="alert">
|
||||
<label id="empty-availableUpdates-msg" data-l10n-id="list-empty-available-updates"/>
|
||||
<label id="empty-recentUpdates-msg" data-l10n-id="list-empty-recent-updates"/>
|
||||
<button data-l10n-id="list-empty-find-updates"
|
||||
command="cmd_findAllUpdates"/>
|
||||
</vbox>
|
||||
<spacer class="alert-spacer-after"/>
|
||||
</vbox>
|
||||
<hbox id="update-actions" pack="center">
|
||||
<button id="update-selected-btn" hidden="true"
|
||||
data-l10n-id="extensions-updates-update-selected"/>
|
||||
</hbox>
|
||||
<richlistbox id="updates-list" class="list" flex="1"/>
|
||||
</vbox>
|
||||
|
||||
<!-- detail view -->
|
||||
<scrollbox id="detail-view" class="view-pane addon-view" orient="vertical" tabindex="0"
|
||||
role="document">
|
||||
<!-- global warnings -->
|
||||
<hbox class="global-warning-container global-warning">
|
||||
<hbox class="global-warning-safemode" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-safe-mode-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-safe-mode-label"/>
|
||||
</hbox>
|
||||
<hbox class="global-warning-checkcompatibility" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-check-compatibility-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-check-compatibility-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-checkcompatibility"
|
||||
data-l10n-id="extensions-warning-check-compatibility-enable"
|
||||
command="cmd_enableCheckCompatibility"/>
|
||||
<hbox class="global-warning-updatesecurity" flex="1" align="center"
|
||||
data-l10n-id="extensions-warning-update-security-container">
|
||||
<image class="warning-icon"/>
|
||||
<label class="global-warning-text" flex="1" crop="end"
|
||||
data-l10n-id="extensions-warning-update-security-label"/>
|
||||
</hbox>
|
||||
<button class="button-link global-warning-updatesecurity"
|
||||
data-l10n-id="extensions-warning-update-security-label"
|
||||
command="cmd_enableUpdateSecurity"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
<hbox class="detail-view-wrapper">
|
||||
<!-- "loading" splash screen -->
|
||||
<vbox class="alert-container">
|
||||
<spacer class="alert-spacer-before"/>
|
||||
<hbox class="alert loading">
|
||||
<image/>
|
||||
<label data-l10n-id="loading-label"/>
|
||||
</hbox>
|
||||
<spacer class="alert-spacer-after"/>
|
||||
</vbox>
|
||||
<!-- actual detail view -->
|
||||
<vbox class="detail-view-container" contextmenu="addonitem-popup">
|
||||
<vbox id="detail-notifications">
|
||||
<hbox id="warning-container" align="center" class="warning">
|
||||
<image class="warning-icon"/>
|
||||
<label id="detail-warning" flex="1"/>
|
||||
<label id="detail-warning-link" is="text-link"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
<hbox id="error-container" align="center" class="error">
|
||||
<image class="error-icon"/>
|
||||
<label id="detail-error" flex="1"/>
|
||||
<label id="detail-error-link" is="text-link"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
<hbox id="pending-container" align="center" class="pending">
|
||||
<image class="pending-icon"/>
|
||||
<label id="detail-pending" flex="1"/>
|
||||
<button id="detail-restart-btn" class="button-link"
|
||||
data-l10n-id="addon-restart-now"
|
||||
command="cmd_restartApp"/>
|
||||
<button id="detail-undo-btn" class="button-link"
|
||||
label="&addon.undoAction.label;"
|
||||
tooltipText="&addon.undoAction.tooltip;"
|
||||
command="cmd_cancelOperation"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the message to wrap -->
|
||||
</hbox>
|
||||
</vbox>
|
||||
<hbox class="card addon-detail" align="start">
|
||||
<vbox flex="1">
|
||||
<image class="card-heading-image theme-screenshot"/>
|
||||
<hbox align="start">
|
||||
<vbox id="detail-icon-container" align="end">
|
||||
<image id="detail-icon" class="icon"/>
|
||||
</vbox>
|
||||
<vbox id="detail-summary">
|
||||
<hbox id="detail-name-container" class="name-container"
|
||||
align="start">
|
||||
<label id="detail-name" flex="1"/>
|
||||
<label id="detail-legacy-warning" class="legacy-warning" value="&addon.legacy.label;" is="text-link"/>
|
||||
<label class="disabled-postfix" value="&addon.disabled.postfix;"/>
|
||||
<label class="update-postfix" value="&addon.update.postfix;"/>
|
||||
<spacer flex="5000"/> <!-- Necessary to allow the name to wrap -->
|
||||
</hbox>
|
||||
<label id="detail-creator" class="creator"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<vbox id="detail-desc-container" align="start" flex="1">
|
||||
<description id="detail-desc"/>
|
||||
<description id="detail-fulldesc"/>
|
||||
</vbox>
|
||||
<vbox id="detail-contributions">
|
||||
<description id="detail-contrib-description" data-l10n-id="detail-contributions-description"/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<button id="detail-contrib-btn"
|
||||
data-l10n-id="cmd-contribute"
|
||||
command="cmd_contribute"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<grid id="detail-grid">
|
||||
<columns>
|
||||
<column flex="1"/>
|
||||
<column flex="2"/>
|
||||
</columns>
|
||||
<rows id="detail-rows">
|
||||
<row class="detail-row-complex detail-privateBrowsing" id="detail-privateBrowsing-row">
|
||||
<label class="detail-row-label" data-l10n-id="detail-private-browsing-label"/>
|
||||
<hbox align="center">
|
||||
<radiogroup id="detail-privateBrowsing" orient="horizontal">
|
||||
<radio data-l10n-id="detail-private-browsing-on"
|
||||
value="1"/>
|
||||
<radio data-l10n-id="detail-private-browsing-off"
|
||||
value="0"/>
|
||||
</radiogroup>
|
||||
</hbox>
|
||||
</row>
|
||||
<hbox class="detail-row-footer detail-privateBrowsing" id="detail-privateBrowsing-row-footer">
|
||||
<description class="indent preferences-description" data-l10n-id="detail-private-browsing-description2">
|
||||
<label class="learnMore private-learnmore" data-l10n-name="detail-private-browsing-learn-more" is="text-link"/>
|
||||
</description>
|
||||
</hbox>
|
||||
<row class="detail-row-complex detail-privateBrowsing" id="detail-privateBrowsing-required">
|
||||
<label class="detail-row-label" data-l10n-id="detail-private-required-label"/>
|
||||
</row>
|
||||
<hbox class="detail-row-footer detail-privateBrowsing" id="detail-privateBrowsing-required-footer">
|
||||
<description class="indent preferences-description" data-l10n-id="detail-private-required-description">
|
||||
<label class="learnMore private-learnmore" data-l10n-name="detail-private-browsing-learn-more" is="text-link"/>
|
||||
</description>
|
||||
</hbox>
|
||||
<row class="detail-row-complex detail-privateBrowsing" id="detail-privateBrowsing-disallowed">
|
||||
<label class="detail-row-label" data-l10n-id="detail-private-disallowed-label"/>
|
||||
</row>
|
||||
<hbox class="detail-row-footer detail-privateBrowsing" id="detail-privateBrowsing-disallowed-footer">
|
||||
<description class="indent preferences-description" data-l10n-id="detail-private-disallowed-description">
|
||||
<label class="learnMore private-learnmore" data-l10n-name="detail-private-browsing-learn-more" is="text-link"/>
|
||||
</description>
|
||||
</hbox>
|
||||
<row class="detail-row-complex" id="detail-updates-row">
|
||||
<label class="detail-row-label" data-l10n-id="detail-update-type"/>
|
||||
<hbox align="center">
|
||||
<radiogroup id="detail-autoUpdate" orient="horizontal">
|
||||
<!-- The values here need to match the values of
|
||||
AddonManager.AUTOUPDATE_* -->
|
||||
<radio data-l10n-id="detail-update-default"
|
||||
value="1"/>
|
||||
<radio data-l10n-id="detail-update-automatic"
|
||||
value="2"/>
|
||||
<radio data-l10n-id="detail-update-manual"
|
||||
value="0"/>
|
||||
</radiogroup>
|
||||
<button id="detail-findUpdates-btn" class="button-link"
|
||||
data-l10n-id="detail-check-for-updates"
|
||||
command="cmd_findItemUpdates"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="detail-row" id="detail-version" data-l10n-id="detail-version"/>
|
||||
<row class="detail-row" id="detail-dateUpdated" data-l10n-id="detail-last-updated"/>
|
||||
<row class="detail-row-complex" id="detail-homepage-row" data-l10n-id="detail-home">
|
||||
<label class="detail-row-label" data-l10n-id="detail-home-value"/>
|
||||
<label id="detail-homepage" class="detail-row-value" crop="end" is="text-link"/>
|
||||
</row>
|
||||
<row class="detail-row-complex" id="detail-repository-row" data-l10n-id="detail-repository">
|
||||
<label class="detail-row-label" data-l10n-id="detail-repository-value"/>
|
||||
<label id="detail-repository" class="detail-row-value" is="text-link"/>
|
||||
</row>
|
||||
<row class="detail-row-complex" id="detail-rating-row">
|
||||
<label class="detail-row-label" data-l10n-id="detail-rating"/>
|
||||
<hbox>
|
||||
<label id="detail-rating" class="meta-value meta-rating"
|
||||
showrating="average"/>
|
||||
<label id="detail-reviews" is="text-link"/>
|
||||
</hbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<hbox id="detail-controls">
|
||||
<button id="detail-prefs-btn" class="addon-control preferences"
|
||||
data-l10n-id="detail-show-preferences"
|
||||
command="cmd_showItemPreferences"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="detail-enable-btn" class="addon-control enable"
|
||||
label="&cmd.enableAddon.label;"
|
||||
accesskey="&cmd.enableAddon.accesskey;"
|
||||
command="cmd_enableItem"/>
|
||||
<button id="detail-disable-btn" class="addon-control disable"
|
||||
label="&cmd.disableAddon.label;"
|
||||
accesskey="&cmd.disableAddon.accesskey;"
|
||||
command="cmd_disableItem"/>
|
||||
<button id="detail-uninstall-btn" class="addon-control remove"
|
||||
label="&cmd.uninstallAddon.label;"
|
||||
accesskey="&cmd.uninstallAddon.accesskey;"
|
||||
command="cmd_uninstallItem"/>
|
||||
<button id="detail-install-btn" class="addon-control install"
|
||||
data-l10n-id="cmd-install-addon"
|
||||
command="cmd_installItem"/>
|
||||
<menulist id="detail-state-menulist"
|
||||
crop="none" sizetopopup="always"
|
||||
tooltiptext="&cmd.stateMenu.tooltip;">
|
||||
<menupopup>
|
||||
<menuitem id="detail-ask-to-activate-menuitem"
|
||||
class="addon-control"
|
||||
label="&cmd.askToActivate.label;"
|
||||
tooltiptext="&cmd.askToActivate.tooltip;"
|
||||
command="cmd_askToActivateItem"/>
|
||||
<menuitem id="detail-always-activate-menuitem"
|
||||
class="addon-control"
|
||||
label="&cmd.alwaysActivate.label;"
|
||||
tooltiptext="&cmd.alwaysActivate.tooltip;"
|
||||
command="cmd_alwaysActivateItem"/>
|
||||
<menuitem id="detail-never-activate-menuitem"
|
||||
class="addon-control"
|
||||
label="&cmd.neverActivate.label;"
|
||||
tooltiptext="&cmd.neverActivate.tooltip;"
|
||||
command="cmd_neverActivateItem"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<spacer flex="1"/>
|
||||
</hbox>
|
||||
</scrollbox>
|
||||
|
||||
<vbox id="html-view" flex="1">
|
||||
<vbox class="alert-container html-alert-container" align="start">
|
||||
<hbox class="global-warning-safemode message-bar"
|
||||
|
|
|
@ -11,7 +11,7 @@ toolkit.jar:
|
|||
* content/mozapps/extensions/extensions.xul (content/extensions.xul)
|
||||
content/mozapps/extensions/extensions.css (content/extensions.css)
|
||||
content/mozapps/extensions/extensions.js (content/extensions.js)
|
||||
* content/mozapps/extensions/extensions.xml (content/extensions.xml)
|
||||
content/mozapps/extensions/extensions.xml (content/extensions.xml)
|
||||
content/mozapps/extensions/blocklist.xul (content/blocklist.xul)
|
||||
content/mozapps/extensions/blocklist.js (content/blocklist.js)
|
||||
content/mozapps/extensions/pluginPrefs.xul (content/pluginPrefs.xul)
|
||||
|
|
|
@ -46,10 +46,6 @@ generated-files =
|
|||
tags = blocklist
|
||||
[browser_about_debugging_link.js]
|
||||
[browser_bug523784.js]
|
||||
[browser_bug562890.js]
|
||||
skip-if = os == 'win' && !debug # Disabled on Windows opt/PGO builds due to intermittent failures (bug 1135866)
|
||||
[browser_bug562899.js]
|
||||
[browser_bug562992.js]
|
||||
[browser_bug567127.js]
|
||||
skip-if = (!debug && os == 'win') #Bug 1489496
|
||||
[browser_bug567137.js]
|
||||
|
@ -57,26 +53,18 @@ skip-if = (!debug && os == 'win') #Bug 1489496
|
|||
skip-if = verify
|
||||
[browser_bug572561.js]
|
||||
[browser_bug577990.js]
|
||||
[browser_bug580298.js]
|
||||
[browser_bug586574.js]
|
||||
[browser_bug587970.js]
|
||||
[browser_bug591465.js]
|
||||
skip-if = os == "linux" && !debug # Bug 1395539 - fails on multi-core
|
||||
[browser_bug591663.js]
|
||||
[browser_bug618502.js]
|
||||
[browser_bug679604.js]
|
||||
[browser_bug590347.js]
|
||||
[browser_checkAddonCompatibility.js]
|
||||
[browser_details.js]
|
||||
[browser_discovery.js]
|
||||
[browser_discovery_clientid.js]
|
||||
[browser_dragdrop.js]
|
||||
[browser_extension_sideloading_permission.js]
|
||||
[browser_file_xpi_no_process_switch.js]
|
||||
skip-if = true # Bug 1449071 - Frequent failures
|
||||
[browser_globalwarnings.js]
|
||||
[browser_gmpProvider.js]
|
||||
skip-if = os == 'linux' && !debug # Bug 1398766
|
||||
[browser_history_navigation.js]
|
||||
[browser_html_abuse_report.js]
|
||||
skip-if = os == 'win' # Bug 1562792
|
||||
|
@ -96,30 +84,15 @@ skip-if = (os == 'win' && processor == 'aarch64') # aarch64 has no plugin suppor
|
|||
[browser_html_recommendations.js]
|
||||
[browser_html_updates.js]
|
||||
[browser_html_warning_messages.js]
|
||||
[browser_inlinesettings_browser.js]
|
||||
skip-if = os == 'mac' || os == 'linux' # Bug 1483347
|
||||
[browser_installssl.js]
|
||||
skip-if = verify
|
||||
[browser_interaction_telemetry.js]
|
||||
[browser_langpack_signing.js]
|
||||
[browser_legacy.js]
|
||||
[browser_legacy_pre57.js]
|
||||
[browser_list.js]
|
||||
[browser_manage_shortcuts.js]
|
||||
[browser_manage_shortcuts_hidden.js]
|
||||
[browser_manualupdates.js]
|
||||
[browser_pluginprefs.js]
|
||||
[browser_pluginprefs_is_not_disabled.js]
|
||||
[browser_plugin_enabled_state_locked.js]
|
||||
[browser_recentupdates.js]
|
||||
[browser_reinstall.js]
|
||||
[browser_sorting.js]
|
||||
[browser_sorting_plugins.js]
|
||||
[browser_tabsettings.js]
|
||||
[browser_task_next_test.js]
|
||||
[browser_theme_previews.js]
|
||||
[browser_types.js]
|
||||
[browser_uninstalling.js]
|
||||
[browser_updateid.js]
|
||||
[browser_updatessl.js]
|
||||
[browser_webapi.js]
|
||||
|
@ -133,8 +106,3 @@ skip-if = verify
|
|||
[browser_webext_icon.js]
|
||||
[browser_webext_incognito.js]
|
||||
[browser_webext_incognito_doorhanger_telemetry.js]
|
||||
[browser_webext_options.js]
|
||||
tags = webextensions
|
||||
skip-if = os == 'linux' || (os == 'mac' && debug) # bug 1483347
|
||||
[browser_webext_options_addon_reload.js]
|
||||
tags = webextensions
|
||||
|
|
|
@ -56,124 +56,14 @@ function resetBlocklist() {
|
|||
Services.prefs.setCharPref("extensions.blocklist.url", _originalBlocklistURL);
|
||||
}
|
||||
|
||||
function getXULPluginUI(plugin, anonid) {
|
||||
if (
|
||||
plugin.openOrClosedShadowRoot &&
|
||||
plugin.openOrClosedShadowRoot.isUAWidget()
|
||||
) {
|
||||
return plugin.openOrClosedShadowRoot.getElementById(anonid);
|
||||
}
|
||||
return plugin.ownerDocument.getAnonymousElementByAttribute(
|
||||
plugin,
|
||||
"anonid",
|
||||
anonid
|
||||
);
|
||||
}
|
||||
|
||||
function assertPluginActiveState({
|
||||
managerWindow,
|
||||
pluginId,
|
||||
expectedActivateState,
|
||||
}) {
|
||||
let pluginEl = get_addon_element(managerWindow, pluginId);
|
||||
ok(pluginEl, `Got the about:addon entry for "${pluginId}"`);
|
||||
|
||||
if (managerWindow.useHtmlViews) {
|
||||
const pluginOptions = pluginEl.querySelector("plugin-options");
|
||||
const pluginCheckedItem = pluginOptions.querySelector(
|
||||
"panel-item[checked]"
|
||||
);
|
||||
is(
|
||||
pluginCheckedItem.getAttribute("action"),
|
||||
expectedActivateState,
|
||||
`plugin should have ${expectedActivateState} state selected`
|
||||
);
|
||||
} else {
|
||||
// Assertions for the XUL about:addons views.
|
||||
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
|
||||
let enableButton = getXULPluginUI(pluginEl, "enable-btn");
|
||||
let disableButton = getXULPluginUI(pluginEl, "disable-btn");
|
||||
is_element_hidden(enableButton, "enable button should be hidden");
|
||||
is_element_hidden(disableButton, "disable button should be hidden");
|
||||
let menu = getXULPluginUI(pluginEl, "state-menulist");
|
||||
is_element_visible(menu, "state menu should be visible");
|
||||
let activateItem = getXULPluginUI(
|
||||
pluginEl,
|
||||
`${expectedActivateState}-menuitem`
|
||||
);
|
||||
ok(
|
||||
activateItem,
|
||||
`Got a menu item for the ${expectedActivateState} plugin activate state`
|
||||
);
|
||||
is(
|
||||
menu.selectedItem,
|
||||
activateItem,
|
||||
`state menu should have '${expectedActivateState}' selected`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function setPluginActivateState({ managerWindow, pluginId, activateState }) {
|
||||
let pluginEl = get_addon_element(managerWindow, pluginId);
|
||||
ok(pluginEl, `Got the about:addon entry for "${pluginId}"`);
|
||||
|
||||
if (managerWindow.useHtmlViews) {
|
||||
// Activate plugin on the HTML about:addons views.
|
||||
let activateAction = pluginEl.querySelector(`[action="${activateState}"]`);
|
||||
ok(activateAction, `Got element for ${activateState} plugin action`);
|
||||
activateAction.click();
|
||||
} else {
|
||||
// Activate plugin on the XUL about:addons views.
|
||||
let activateItem = getXULPluginUI(pluginEl, `${activateState}-menuitem`);
|
||||
ok(
|
||||
activateItem,
|
||||
`Got a menu item for the ${activateState} plugin activate state`
|
||||
);
|
||||
let menu = getXULPluginUI(pluginEl, "state-menulist");
|
||||
menu.selectedItem = activateItem;
|
||||
activateItem.doCommand();
|
||||
}
|
||||
}
|
||||
|
||||
async function assertPluginAppDisabled({ managerWindow, pluginId }) {
|
||||
const pluginEl = get_addon_element(managerWindow, pluginId);
|
||||
ok(pluginEl, `Got the about:addon entry for "${pluginId}"`);
|
||||
|
||||
if (managerWindow.useHtmlViews) {
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = pluginEl.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
// tests all buttons disabled (besides the checked one and the expand action)
|
||||
// are expected to be disabled if locked is true.
|
||||
for (const item of pluginOptions.querySelectorAll(
|
||||
"panel-item:not([hidden])"
|
||||
)) {
|
||||
const actionName = item.getAttribute("action");
|
||||
if (
|
||||
!item.hasAttribute("checked") &&
|
||||
actionName !== "expand" &&
|
||||
actionName !== "preferences"
|
||||
) {
|
||||
ok(
|
||||
item.shadowRoot.querySelector("button").disabled,
|
||||
`Plugin action "${actionName}" should be disabled`
|
||||
);
|
||||
}
|
||||
}
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
// Assertions for the XUL about:addons views.
|
||||
let menu = getXULPluginUI(pluginEl, "state-menulist");
|
||||
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
|
||||
menu = getXULPluginUI(pluginEl, "state-menulist");
|
||||
is(menu.disabled, true, "state menu should be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(pluginEl, {}, managerWindow);
|
||||
await BrowserTestUtils.waitForEvent(managerWindow.document, "ViewChanged");
|
||||
|
||||
menu = managerWindow.document.getElementById("detail-state-menulist");
|
||||
is(menu.disabled, true, "detail state menu should be disabled");
|
||||
}
|
||||
// Activate plugin on the HTML about:addons views.
|
||||
let activateAction = pluginEl.querySelector(`[action="${activateState}"]`);
|
||||
ok(activateAction, `Got element for ${activateState} plugin action`);
|
||||
activateAction.click();
|
||||
}
|
||||
|
||||
async function getTestPluginAddon() {
|
||||
|
@ -188,7 +78,7 @@ async function getTestPluginAddon() {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
async function test_CTP_plugins(aboutAddonsType) {
|
||||
add_task(async function test_CTP_plugins() {
|
||||
let pluginTag = getTestPluginTag();
|
||||
pluginTag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
|
||||
let managerWindow = await open_manager("addons://list/plugin");
|
||||
|
@ -202,11 +92,14 @@ async function test_CTP_plugins(aboutAddonsType) {
|
|||
ok(pluginEl, `Got the about:addon entry for "${testPluginId}"`);
|
||||
|
||||
info("part3: test plugin add-on actions status");
|
||||
assertPluginActiveState({
|
||||
managerWindow,
|
||||
pluginId: testPluginId,
|
||||
expectedActivateState: "ask-to-activate",
|
||||
});
|
||||
|
||||
let pluginOptions = pluginEl.querySelector("plugin-options");
|
||||
let pluginCheckedItem = pluginOptions.querySelector("panel-item[checked]");
|
||||
is(
|
||||
pluginCheckedItem.getAttribute("action"),
|
||||
"ask-to-activate",
|
||||
"plugin should have ask-to-activate state selected"
|
||||
);
|
||||
|
||||
let pluginTab = await BrowserTestUtils.openNewForegroundTab(
|
||||
gBrowser,
|
||||
|
@ -274,11 +167,15 @@ async function test_CTP_plugins(aboutAddonsType) {
|
|||
BrowserTestUtils.removeTab(pluginTab);
|
||||
|
||||
info("part8: test plugin state is never-activate");
|
||||
assertPluginActiveState({
|
||||
managerWindow,
|
||||
pluginId: testPluginId,
|
||||
expectedActivateState: "never-activate",
|
||||
});
|
||||
pluginEl = get_addon_element(managerWindow, testPluginId);
|
||||
|
||||
pluginOptions = pluginEl.querySelector("plugin-options");
|
||||
const pluginCheckItem = pluginOptions.querySelector("panel-item[checked]");
|
||||
is(
|
||||
pluginCheckItem.getAttribute("action"),
|
||||
"never-activate",
|
||||
"plugin should have never-activate state selected"
|
||||
);
|
||||
|
||||
info("part9: set plugin state to always-activate");
|
||||
setPluginActivateState({
|
||||
|
@ -330,23 +227,6 @@ async function test_CTP_plugins(aboutAddonsType) {
|
|||
|
||||
BrowserTestUtils.removeTab(pluginTab);
|
||||
await close_manager(managerWindow);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
}
|
||||
|
||||
add_task(async function test_CTP_plugins_XUL_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await test_CTP_plugins("XUL");
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_CTP_plugins_HTML_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await test_CTP_plugins("HTML");
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_blocklisted_plugin_disabled() {
|
||||
|
@ -392,21 +272,33 @@ async function checkPlugins() {
|
|||
isnot(testPluginAddon, null, "Test Plug-in should exist");
|
||||
let testPluginId = testPluginAddon.id;
|
||||
|
||||
let managerWindow;
|
||||
let managerWindow = await open_manager("addons://list/plugin");
|
||||
|
||||
info("Test blocklisted plugin actions disabled in XUL about:addons");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
managerWindow = await open_manager("addons://list/plugin");
|
||||
await assertPluginAppDisabled({ managerWindow, pluginId: testPluginId });
|
||||
await close_manager(managerWindow);
|
||||
let pluginEl = get_addon_element(managerWindow, testPluginId);
|
||||
ok(pluginEl, `Got about:addons entry for ${testPluginId}`);
|
||||
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = pluginEl.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
|
||||
// tests all buttons disabled (besides the checked one and the expand action)
|
||||
// are expected to be disabled if locked is true.
|
||||
for (const item of pluginOptions.querySelectorAll(
|
||||
"panel-item:not([hidden])"
|
||||
)) {
|
||||
const actionName = item.getAttribute("action");
|
||||
if (
|
||||
!item.hasAttribute("checked") &&
|
||||
actionName !== "expand" &&
|
||||
actionName !== "preferences"
|
||||
) {
|
||||
ok(
|
||||
item.shadowRoot.querySelector("button").disabled,
|
||||
`Plugin action "${actionName}" should be disabled`
|
||||
);
|
||||
}
|
||||
}
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
|
||||
info("Test blocklisted plugin actions disabled in HTML about:addons");
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
managerWindow = await open_manager("addons://list/plugin");
|
||||
await assertPluginAppDisabled({ managerWindow, pluginId: testPluginId });
|
||||
await close_manager(managerWindow);
|
||||
}
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests the Preferences button for addons in list view
|
||||
*/
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
requestLongerTimeout(2);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
var addonPrefsURI = CHROMEROOT + "addon_prefs.xul";
|
||||
|
||||
var gProvider = new MockProvider();
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Test add-on 1",
|
||||
description: "foo",
|
||||
},
|
||||
{
|
||||
id: "test2@tests.mozilla.org",
|
||||
name: "Test add-on 2",
|
||||
description: "bar",
|
||||
optionsURL: addonPrefsURI,
|
||||
},
|
||||
]);
|
||||
|
||||
let aManager = await open_manager("addons://list/extension");
|
||||
var addonList = aManager.document.getElementById("addon-list");
|
||||
for (var addonItem of addonList.childNodes) {
|
||||
if (
|
||||
addonItem.hasAttribute("name") &&
|
||||
addonItem.getAttribute("name") == "Test add-on 1"
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
var prefsBtn = aManager.document.getAnonymousElementByAttribute(
|
||||
addonItem,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is(
|
||||
prefsBtn.hidden,
|
||||
true,
|
||||
"Prefs button should be hidden for addon with no optionsURL set"
|
||||
);
|
||||
|
||||
for (addonItem of addonList.childNodes) {
|
||||
if (
|
||||
addonItem.hasAttribute("name") &&
|
||||
addonItem.getAttribute("name") == "Test add-on 2"
|
||||
) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
prefsBtn = aManager.document.getAnonymousElementByAttribute(
|
||||
addonItem,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is(
|
||||
prefsBtn.hidden,
|
||||
true,
|
||||
"Prefs button should not be shown for addon with just an optionsURL set"
|
||||
);
|
||||
|
||||
close_manager(aManager, finish);
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Simulates quickly switching between different list views to verify that only
|
||||
// the last selected is displayed
|
||||
|
||||
const { PromiseTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/PromiseTestUtils.jsm"
|
||||
);
|
||||
|
||||
PromiseTestUtils.whitelistRejectionsGlobally(/this\._errorLink/);
|
||||
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files and these test cases should be added in Bug 1552170).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let aWindow = await open_manager(null);
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
// Tests that loading a second view before the first has not finished loading
|
||||
// does not merge the results
|
||||
add_test(async function() {
|
||||
var themeCount = null;
|
||||
var pluginCount = null;
|
||||
var themeItem = gCategoryUtilities.get("theme");
|
||||
var pluginItem = gCategoryUtilities.get("plugin");
|
||||
var list = gManagerWindow.document.getElementById("addon-list");
|
||||
|
||||
await gCategoryUtilities.open(themeItem);
|
||||
themeCount = list.childNodes.length;
|
||||
ok(themeCount > 0, "Test is useless if there are no themes");
|
||||
|
||||
await gCategoryUtilities.open(pluginItem);
|
||||
pluginCount = list.childNodes.length;
|
||||
ok(pluginCount > 0, "Test is useless if there are no plugins");
|
||||
|
||||
gCategoryUtilities.open(themeItem);
|
||||
|
||||
await gCategoryUtilities.open(pluginItem);
|
||||
is(list.childNodes.length, pluginCount, "Should only see the plugins");
|
||||
|
||||
var item = list.firstChild;
|
||||
while (item) {
|
||||
is(item.getAttribute("type"), "plugin", "All items should be plugins");
|
||||
item = item.nextSibling;
|
||||
}
|
||||
|
||||
// Tests that switching to, from, to the same pane in quick succession
|
||||
// still only shows the right number of results
|
||||
|
||||
gCategoryUtilities.open(themeItem);
|
||||
gCategoryUtilities.open(pluginItem);
|
||||
await gCategoryUtilities.open(themeItem);
|
||||
is(list.childNodes.length, themeCount, "Should only see the theme");
|
||||
|
||||
item = list.firstChild;
|
||||
while (item) {
|
||||
is(item.getAttribute("type"), "theme", "All items should be theme");
|
||||
item = item.nextSibling;
|
||||
}
|
||||
|
||||
run_next_test();
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* This test ensures that when the extension manager UI is open and a
|
||||
* restartless extension is installed from the web, its correct name appears
|
||||
* when the download and installation complete. See bug 562992.
|
||||
*/
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
var gInstall;
|
||||
|
||||
const EXTENSION_NAME = "Wunderbar";
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
// Create a MockInstall with a MockAddon payload and add it to the provider,
|
||||
// causing the onNewInstall event to fire, which in turn will cause a new
|
||||
// "installing" item to appear in the list of extensions.
|
||||
add_test(function() {
|
||||
let addon = new MockAddon(undefined, EXTENSION_NAME, "extension", true);
|
||||
gInstall = new MockInstall(undefined, undefined, addon);
|
||||
gInstall.addTestListener({
|
||||
onNewInstall: run_next_test,
|
||||
});
|
||||
gProvider.addInstall(gInstall);
|
||||
});
|
||||
|
||||
// Finish the install, which will cause the "installing" item to be converted
|
||||
// to an "installed" item, which should have the correct add-on name.
|
||||
add_test(function() {
|
||||
gInstall.addTestListener({
|
||||
onInstallEnded() {
|
||||
let list = gManagerWindow.document.getElementById("addon-list");
|
||||
|
||||
// To help prevent future breakage, don't assume the item is the only one
|
||||
// in the list, or that it's first in the list. Find it by name.
|
||||
for (let i = 0; i < list.itemCount; i++) {
|
||||
let item = list.getItemAtIndex(i);
|
||||
if (item.getAttribute("name") === EXTENSION_NAME) {
|
||||
ok(true, "Item with correct name found");
|
||||
run_next_test();
|
||||
return;
|
||||
}
|
||||
}
|
||||
ok(false, "Item with correct name was not found");
|
||||
run_next_test();
|
||||
},
|
||||
});
|
||||
gInstall.install();
|
||||
});
|
|
@ -1,111 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that certain types of addons do not have their version number
|
||||
// displayed. This currently only includes lightweight themes.
|
||||
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI (and the HTML about:addons
|
||||
// actually shows the version also on themes).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
add_task(async function test() {
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "extension@tests.mozilla.org",
|
||||
name: "Extension 1",
|
||||
type: "extension",
|
||||
version: "123",
|
||||
},
|
||||
{
|
||||
id: "theme@tests.mozilla.org",
|
||||
name: "Theme 2",
|
||||
type: "theme",
|
||||
version: "456",
|
||||
},
|
||||
{
|
||||
id: "lwtheme@personas.mozilla.org",
|
||||
name: "Persona 3",
|
||||
type: "theme",
|
||||
version: "789",
|
||||
},
|
||||
]);
|
||||
|
||||
gManagerWindow = await open_manager();
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
});
|
||||
|
||||
function get(aId) {
|
||||
return gManagerWindow.document.getElementById(aId);
|
||||
}
|
||||
|
||||
function get_node(parent, anonid) {
|
||||
return parent.ownerDocument.getAnonymousElementByAttribute(
|
||||
parent,
|
||||
"anonid",
|
||||
anonid
|
||||
);
|
||||
}
|
||||
|
||||
function open_details(aList, aItem, aCallback) {
|
||||
aList.ensureElementIsVisible(aItem);
|
||||
EventUtils.synthesizeMouseAtCenter(aItem, {}, gManagerWindow);
|
||||
return new Promise(resolve => wait_for_view_load(gManagerWindow, resolve));
|
||||
}
|
||||
|
||||
var check_addon_has_version = async function(aList, aName, aVersion) {
|
||||
for (let i = 0; i < aList.itemCount; i++) {
|
||||
let item = aList.getItemAtIndex(i);
|
||||
if (get_node(item, "name").textContent === aName) {
|
||||
ok(true, "Item with correct name found");
|
||||
let { version } = await get_tooltip_info(item);
|
||||
is(version, aVersion, "Item has correct version");
|
||||
return item;
|
||||
}
|
||||
}
|
||||
ok(false, "Item with correct name was not found");
|
||||
return null;
|
||||
};
|
||||
|
||||
add_task(async function() {
|
||||
await gCategoryUtilities.openType("extension");
|
||||
info("Extension");
|
||||
let list = gManagerWindow.document.getElementById("addon-list");
|
||||
let item = await check_addon_has_version(list, "Extension 1", "123");
|
||||
await open_details(list, item);
|
||||
is_element_visible(get("detail-version"), "Details view has version visible");
|
||||
is(get("detail-version").value, "123", "Details view has correct version");
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await gCategoryUtilities.openType("theme");
|
||||
info("Normal theme");
|
||||
let list = gManagerWindow.document.getElementById("addon-list");
|
||||
let item = await check_addon_has_version(list, "Theme 2", "456");
|
||||
await open_details(list, item);
|
||||
is_element_visible(get("detail-version"), "Details view has version visible");
|
||||
is(get("detail-version").value, "456", "Details view has correct version");
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await gCategoryUtilities.openType("theme");
|
||||
info("Lightweight theme");
|
||||
let list = gManagerWindow.document.getElementById("addon-list");
|
||||
// See that the version isn't displayed
|
||||
let item = await check_addon_has_version(list, "Persona 3", undefined);
|
||||
await open_details(list, item);
|
||||
is_element_hidden(get("detail-version"), "Details view has version hidden");
|
||||
// If the version element is hidden then we don't care about its value
|
||||
});
|
||||
|
||||
add_task(function end_test() {
|
||||
close_manager(gManagerWindow, finish);
|
||||
});
|
|
@ -1,294 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
|
||||
// Bug 587970 - Provide ability "Update all now" within 'Available Updates' screen
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases, "Update all now" has been deprecated
|
||||
// and not supported in HTML about:addons).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "addon1@tests.mozilla.org",
|
||||
name: "addon 1",
|
||||
version: "1.0",
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "addon2@tests.mozilla.org",
|
||||
name: "addon 2",
|
||||
version: "2.0",
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "addon3@tests.mozilla.org",
|
||||
name: "addon 3",
|
||||
version: "3.0",
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager("addons://updates/available");
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
close_manager(gManagerWindow, finish);
|
||||
}
|
||||
|
||||
add_test(function() {
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
is(list.childNodes.length, 0, "Available updates list should be empty");
|
||||
|
||||
var emptyNotice = gManagerWindow.document.getElementById(
|
||||
"empty-availableUpdates-msg"
|
||||
);
|
||||
is_element_visible(emptyNotice, "Empty notice should be visible");
|
||||
|
||||
var updateSelected = gManagerWindow.document.getElementById(
|
||||
"update-selected-btn"
|
||||
);
|
||||
is_element_hidden(updateSelected, "Update Selected button should be hidden");
|
||||
|
||||
info("Adding updates");
|
||||
gProvider.createInstalls([
|
||||
{
|
||||
name: "addon 1",
|
||||
version: "1.1",
|
||||
existingAddon: gProvider.addons[0],
|
||||
},
|
||||
{
|
||||
name: "addon 2",
|
||||
version: "2.1",
|
||||
existingAddon: gProvider.addons[1],
|
||||
},
|
||||
{
|
||||
name: "addon 3",
|
||||
version: "3.1",
|
||||
existingAddon: gProvider.addons[2],
|
||||
},
|
||||
]);
|
||||
|
||||
function wait_for_refresh() {
|
||||
if (
|
||||
list.childNodes.length == 3 &&
|
||||
list.childNodes[0].mManualUpdate &&
|
||||
list.childNodes[1].mManualUpdate &&
|
||||
list.childNodes[2].mManualUpdate
|
||||
) {
|
||||
run_next_test();
|
||||
} else {
|
||||
info("Waiting for pane to refresh");
|
||||
setTimeout(wait_for_refresh, 10);
|
||||
}
|
||||
}
|
||||
info("Waiting for pane to refresh");
|
||||
setTimeout(wait_for_refresh, 10);
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
is(list.childNodes.length, 3, "Available updates list should have 2 items");
|
||||
|
||||
var item1 = get_addon_element(gManagerWindow, "addon1@tests.mozilla.org");
|
||||
isnot(item1, null, "Item for addon1@tests.mozilla.org should be in list");
|
||||
var item2 = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
|
||||
isnot(item2, null, "Item for addon2@tests.mozilla.org should be in list");
|
||||
var item3 = get_addon_element(gManagerWindow, "addon3@tests.mozilla.org");
|
||||
isnot(item3, null, "Item for addon3@tests.mozilla.org should be in list");
|
||||
|
||||
var emptyNotice = gManagerWindow.document.getElementById(
|
||||
"empty-availableUpdates-msg"
|
||||
);
|
||||
is_element_hidden(emptyNotice, "Empty notice should be hidden");
|
||||
|
||||
var updateSelected = gManagerWindow.document.getElementById(
|
||||
"update-selected-btn"
|
||||
);
|
||||
is_element_visible(
|
||||
updateSelected,
|
||||
"Update Selected button should be visible"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should be enabled by default"
|
||||
);
|
||||
|
||||
is(
|
||||
item1._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should be checked by default for addon1"
|
||||
);
|
||||
is(
|
||||
item2._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should be checked by default for addon2"
|
||||
);
|
||||
is(
|
||||
item3._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should be checked by default for addon3"
|
||||
);
|
||||
|
||||
info("Unchecking Include Update checkbox for addon1");
|
||||
EventUtils.synthesizeMouse(item1._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item1._includeUpdate.checked,
|
||||
false,
|
||||
"Include Update checkbox should now be be unchecked for addon1"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should still be enabled"
|
||||
);
|
||||
|
||||
info("Unchecking Include Update checkbox for addon2");
|
||||
EventUtils.synthesizeMouse(item2._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item2._includeUpdate.checked,
|
||||
false,
|
||||
"Include Update checkbox should now be be unchecked for addon2"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should still be enabled"
|
||||
);
|
||||
|
||||
info("Unchecking Include Update checkbox for addon3");
|
||||
EventUtils.synthesizeMouse(item3._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item3._includeUpdate.checked,
|
||||
false,
|
||||
"Include Update checkbox should now be be unchecked for addon3"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
true,
|
||||
"Update Selected button should now be disabled"
|
||||
);
|
||||
|
||||
info("Checking Include Update checkbox for addon2");
|
||||
EventUtils.synthesizeMouse(item2._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item2._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should now be be checked for addon2"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should now be enabled"
|
||||
);
|
||||
|
||||
info("Checking Include Update checkbox for addon3");
|
||||
EventUtils.synthesizeMouse(item3._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item3._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should now be be checked for addon3"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should now be enabled"
|
||||
);
|
||||
|
||||
var installCount = 0;
|
||||
var listener = {
|
||||
onDownloadStarted(aInstall) {
|
||||
isnot(
|
||||
aInstall.existingAddon.id,
|
||||
"addon1@tests.mozilla.org",
|
||||
"Should not have seen a download start for addon1"
|
||||
);
|
||||
},
|
||||
|
||||
onInstallEnded(aInstall) {
|
||||
if (++installCount < 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
gProvider.installs[0].removeTestListener(listener);
|
||||
gProvider.installs[1].removeTestListener(listener);
|
||||
gProvider.installs[2].removeTestListener(listener);
|
||||
|
||||
// Installs are started synchronously so by the time an executeSoon is
|
||||
// executed all installs that are going to start will have started
|
||||
executeSoon(function() {
|
||||
is(
|
||||
gProvider.installs[0].state,
|
||||
AddonManager.STATE_AVAILABLE,
|
||||
"addon1 should not have been upgraded"
|
||||
);
|
||||
is(
|
||||
gProvider.installs[1].state,
|
||||
AddonManager.STATE_INSTALLED,
|
||||
"addon2 should have been upgraded"
|
||||
);
|
||||
is(
|
||||
gProvider.installs[2].state,
|
||||
AddonManager.STATE_INSTALLED,
|
||||
"addon3 should have been upgraded"
|
||||
);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
},
|
||||
};
|
||||
gProvider.installs[0].addTestListener(listener);
|
||||
gProvider.installs[1].addTestListener(listener);
|
||||
gProvider.installs[2].addTestListener(listener);
|
||||
info("Clicking Update Selected button");
|
||||
EventUtils.synthesizeMouseAtCenter(updateSelected, {}, gManagerWindow);
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
var updateSelected = gManagerWindow.document.getElementById(
|
||||
"update-selected-btn"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
true,
|
||||
"Update Selected button should be disabled"
|
||||
);
|
||||
|
||||
var item1 = get_addon_element(gManagerWindow, "addon1@tests.mozilla.org");
|
||||
isnot(item1, null, "Item for addon1@tests.mozilla.org should be in list");
|
||||
is(
|
||||
item1._includeUpdate.checked,
|
||||
false,
|
||||
"Include Update checkbox should not have changed"
|
||||
);
|
||||
|
||||
info("Checking Include Update checkbox for addon1");
|
||||
EventUtils.synthesizeMouse(item1._includeUpdate, 2, 2, {}, gManagerWindow);
|
||||
is(
|
||||
item1._includeUpdate.checked,
|
||||
true,
|
||||
"Include Update checkbox should now be be checked for addon1"
|
||||
);
|
||||
is(
|
||||
updateSelected.disabled,
|
||||
false,
|
||||
"Update Selected button should now not be disabled"
|
||||
);
|
||||
|
||||
run_next_test();
|
||||
});
|
|
@ -1,152 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Bug 590347
|
||||
// Tests if softblock notifications are exposed in preference to incompatible
|
||||
// notifications when compatibility checking is disabled
|
||||
|
||||
var gProvider;
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
|
||||
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
|
||||
var gVersion = Services.appinfo.version;
|
||||
|
||||
// Tested in browser_html_warning_messages.js for HTML.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
// Opens the details view of an add-on
|
||||
async function open_details(aId, aType, aCallback) {
|
||||
requestLongerTimeout(2);
|
||||
|
||||
await gCategoryUtilities.openType(aType);
|
||||
var list = gManagerWindow.document.getElementById("addon-list");
|
||||
var item = list.firstChild;
|
||||
while (item) {
|
||||
if ("mAddon" in item && item.mAddon.id == aId) {
|
||||
list.ensureElementIsVisible(item);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
item,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
item,
|
||||
{ clickCount: 2 },
|
||||
gManagerWindow
|
||||
);
|
||||
wait_for_view_load(gManagerWindow, aCallback);
|
||||
return;
|
||||
}
|
||||
item = item.nextSibling;
|
||||
}
|
||||
ok(false, "Should have found the add-on in the list");
|
||||
}
|
||||
|
||||
function get_list_view_warning_node() {
|
||||
let item = gManagerWindow.document.getElementById("addon-list").firstChild;
|
||||
let found = false;
|
||||
while (item) {
|
||||
if (item.mAddon.name == "Test add-on") {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
item = item.nextSibling;
|
||||
}
|
||||
ok(found, "Test add-on node should have been found.");
|
||||
return item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning"
|
||||
);
|
||||
}
|
||||
|
||||
function get_detail_view_warning_node(aManagerWindow) {
|
||||
if (aManagerWindow) {
|
||||
return aManagerWindow.document.getElementById("detail-warning");
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "addon1@tests.mozilla.org",
|
||||
name: "Test add-on",
|
||||
description: "A test add-on",
|
||||
isCompatible: false,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager(null);
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
// Check with compatibility checking enabled
|
||||
add_test(async function() {
|
||||
await gCategoryUtilities.openType("extension");
|
||||
Services.prefs.setBoolPref(PREF_CHECK_COMPATIBILITY, true);
|
||||
let warning_node = get_list_view_warning_node();
|
||||
is_element_visible(warning_node, "Warning message should be visible");
|
||||
is(
|
||||
warning_node.textContent,
|
||||
"Test add-on is incompatible with " + gApp + " " + gVersion + ".",
|
||||
"Warning message should be correct"
|
||||
);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
open_details("addon1@tests.mozilla.org", "extension", function() {
|
||||
let warning_node = get_detail_view_warning_node(gManagerWindow);
|
||||
is_element_visible(warning_node, "Warning message should be visible");
|
||||
is(
|
||||
warning_node.textContent,
|
||||
"Test add-on is incompatible with " + gApp + " " + gVersion + ".",
|
||||
"Warning message should be correct"
|
||||
);
|
||||
Services.prefs.setBoolPref(PREF_CHECK_COMPATIBILITY, false);
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
||||
// Check with compatibility checking disabled
|
||||
add_test(async function() {
|
||||
await gCategoryUtilities.openType("extension");
|
||||
let warning_node = get_list_view_warning_node();
|
||||
is_element_visible(warning_node, "Warning message should be visible");
|
||||
is(
|
||||
warning_node.textContent,
|
||||
"Test add-on is known to cause security or stability issues.",
|
||||
"Warning message should be correct"
|
||||
);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
open_details("addon1@tests.mozilla.org", "extension", function() {
|
||||
let warning_node = get_detail_view_warning_node(gManagerWindow);
|
||||
is_element_visible(warning_node, "Warning message should be visible");
|
||||
is(
|
||||
warning_node.textContent,
|
||||
"Test add-on is known to cause security or stability issues.",
|
||||
"Warning message should be correct"
|
||||
);
|
||||
run_next_test();
|
||||
});
|
||||
});
|
|
@ -1,171 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Test that the empty notice in the list view disappears as it should
|
||||
|
||||
// Don't use a standard list view (e.g. "extension") to ensure that the list is
|
||||
// initially empty. Don't need to worry about the list of categories displayed
|
||||
// since only the list view itself is tested.
|
||||
var VIEW_ID = "addons://list/mock-addon";
|
||||
|
||||
var LIST_ID = "addon-list";
|
||||
var EMPTY_ID = "addon-list-empty";
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
var gItem;
|
||||
|
||||
var gInstallProperties = {
|
||||
name: "Bug 591663 Mock Install",
|
||||
type: "mock-addon",
|
||||
};
|
||||
var gAddonProperties = {
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Bug 591663 Mock Add-on",
|
||||
type: "mock-addon",
|
||||
};
|
||||
var gExtensionProperties = {
|
||||
name: "Bug 591663 Extension Install",
|
||||
type: "extension",
|
||||
};
|
||||
|
||||
// Not implemented yet on HTML about:addons (Bug 1550911).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider(true, [
|
||||
{
|
||||
id: "mock-addon",
|
||||
name: "Mock Add-ons",
|
||||
uiPriority: 4500,
|
||||
flags: AddonManager.TYPE_UI_VIEW_LIST,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager(VIEW_ID);
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
close_manager(gManagerWindow, finish);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the list view is as expected
|
||||
*
|
||||
* @param aItem
|
||||
* The expected item in the list, or null if list should be empty
|
||||
*/
|
||||
function check_list(aItem) {
|
||||
// Check state of the empty notice
|
||||
let emptyNotice = gManagerWindow.document.getElementById(EMPTY_ID);
|
||||
ok(emptyNotice != null, "Should have found the empty notice");
|
||||
is(
|
||||
!emptyNotice.hidden,
|
||||
aItem == null,
|
||||
"Empty notice should be showing if list empty"
|
||||
);
|
||||
|
||||
// Check the children of the list
|
||||
let list = gManagerWindow.document.getElementById(LIST_ID);
|
||||
is(
|
||||
list.childNodes.length,
|
||||
aItem ? 1 : 0,
|
||||
"Should get expected number of items in list"
|
||||
);
|
||||
if (aItem != null) {
|
||||
let itemName = list.firstChild.getAttribute("name");
|
||||
is(itemName, aItem.name, "List item should have correct name");
|
||||
}
|
||||
}
|
||||
|
||||
// Test that the empty notice is showing and no items are showing in list
|
||||
add_test(function() {
|
||||
check_list(null);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Test that a new, non-active, install does not affect the list view
|
||||
add_test(function() {
|
||||
gItem = gProvider.createInstalls([gInstallProperties])[0];
|
||||
check_list(null);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Test that onInstallStarted properly hides empty notice and adds install to list
|
||||
add_test(function() {
|
||||
gItem.addTestListener({
|
||||
onDownloadStarted() {
|
||||
// Install type unknown until download complete
|
||||
check_list(null);
|
||||
},
|
||||
onInstallStarted() {
|
||||
check_list(gItem);
|
||||
},
|
||||
onInstallEnded() {
|
||||
check_list(gItem);
|
||||
run_next_test();
|
||||
},
|
||||
});
|
||||
|
||||
gItem.install();
|
||||
});
|
||||
|
||||
// Test that restarting the manager does not change list
|
||||
add_test(async function() {
|
||||
let aManagerWindow = await restart_manager(gManagerWindow, VIEW_ID);
|
||||
gManagerWindow = aManagerWindow;
|
||||
check_list(gItem);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Test that onInstallCancelled removes install and shows empty notice
|
||||
add_test(function() {
|
||||
gItem.cancel();
|
||||
gItem = null;
|
||||
check_list(null);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Test that add-ons of a different type do not show up in the list view
|
||||
add_test(function() {
|
||||
let extension = gProvider.createInstalls([gExtensionProperties])[0];
|
||||
check_list(null);
|
||||
|
||||
extension.addTestListener({
|
||||
onDownloadStarted() {
|
||||
check_list(null);
|
||||
},
|
||||
onInstallStarted() {
|
||||
check_list(null);
|
||||
},
|
||||
onInstallEnded() {
|
||||
check_list(null);
|
||||
extension.cancel();
|
||||
run_next_test();
|
||||
},
|
||||
});
|
||||
|
||||
extension.install();
|
||||
});
|
||||
|
||||
// Test that onExternalInstall properly hides empty notice and adds install to list
|
||||
add_test(function() {
|
||||
gItem = gProvider.createAddons([gAddonProperties])[0];
|
||||
check_list(gItem);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Test that restarting the manager does not change list
|
||||
add_test(async function() {
|
||||
let aManagerWindow = await restart_manager(gManagerWindow, VIEW_ID);
|
||||
gManagerWindow = aManagerWindow;
|
||||
check_list(gItem);
|
||||
run_next_test();
|
||||
});
|
|
@ -1,58 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Bug 608316 - Test that opening the manager to an add-on that doesn't exist
|
||||
// just loads the default view
|
||||
|
||||
var gCategoryUtilities;
|
||||
|
||||
// Not implemented yet on HTML about:addons (Bug 1552184), once supported
|
||||
// this test case will be included in the HTML about:addons test files.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
finish();
|
||||
}
|
||||
|
||||
add_test(async function() {
|
||||
let aManager = await open_manager("addons://detail/foo");
|
||||
gCategoryUtilities = new CategoryUtilities(aManager);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should fall back to the discovery pane"
|
||||
);
|
||||
|
||||
close_manager(aManager, run_next_test);
|
||||
});
|
||||
|
||||
// Also test that opening directly to an add-on that does exist doesn't break
|
||||
// and selects the right category
|
||||
add_test(async function() {
|
||||
new MockProvider().createAddons([
|
||||
{
|
||||
id: "addon1@tests.mozilla.org",
|
||||
name: "addon 1",
|
||||
version: "1.0",
|
||||
},
|
||||
]);
|
||||
|
||||
let aManager = await open_manager("addons://detail/addon1@tests.mozilla.org");
|
||||
gCategoryUtilities = new CategoryUtilities(aManager);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should have selected the right category"
|
||||
);
|
||||
|
||||
close_manager(aManager, run_next_test);
|
||||
});
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -12,12 +12,8 @@ var gProvider;
|
|||
|
||||
var gLoadCompleteCallback = null;
|
||||
|
||||
// This test file is testing the old XUL disco pane.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", false],
|
||||
["extensions.htmlaboutaddons.discover.enabled", false],
|
||||
],
|
||||
set: [["extensions.htmlaboutaddons.discover.enabled", false]],
|
||||
});
|
||||
|
||||
var gProgressListener = {
|
||||
|
@ -653,22 +649,6 @@ async function bug_601442_test_elements(visible) {
|
|||
"Discover category should not be visible"
|
||||
);
|
||||
}
|
||||
|
||||
gManagerWindow.loadView("addons://list/dictionary");
|
||||
let aManager = await wait_for_view_load(gManagerWindow);
|
||||
var button = aManager.document.getElementById("discover-button-install");
|
||||
if (visible) {
|
||||
ok(
|
||||
!BrowserTestUtils.is_hidden(button),
|
||||
"Discover button should be visible!"
|
||||
);
|
||||
} else {
|
||||
ok(
|
||||
BrowserTestUtils.is_hidden(button),
|
||||
"Discover button should not be visible!"
|
||||
);
|
||||
}
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,77 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
const { ClientID } = ChromeUtils.import("resource://gre/modules/ClientID.jsm");
|
||||
|
||||
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons is tested in
|
||||
// browser_html_discover_view_clientid.js).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.discover.enabled", false],
|
||||
["extensions.htmlaboutaddons.enabled", false],
|
||||
],
|
||||
});
|
||||
|
||||
function waitForHeader() {
|
||||
return new Promise(resolve => {
|
||||
let observer = (subject, topic, state) => {
|
||||
let channel = subject.QueryInterface(Ci.nsIHttpChannel);
|
||||
if (channel.URI.spec != MAIN_URL) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
resolve(channel.getRequestHeader("Moz-Client-Id"));
|
||||
} catch (e) {
|
||||
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE) {
|
||||
// The header was not set.
|
||||
resolve(null);
|
||||
}
|
||||
} finally {
|
||||
Services.obs.removeObserver(observer, "http-on-modify-request");
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, "http-on-modify-request");
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
[PREF_DISCOVERURL, MAIN_URL],
|
||||
["datareporting.healthreport.uploadEnabled", true],
|
||||
["browser.discovery.enabled", true],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_no_private_clientid() {
|
||||
let privateWindow = await BrowserTestUtils.openNewBrowserWindow({
|
||||
private: true,
|
||||
});
|
||||
let [header, manager] = await Promise.all([
|
||||
waitForHeader(),
|
||||
open_manager(
|
||||
"addons://discover/",
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
privateWindow
|
||||
),
|
||||
]);
|
||||
ok(PrivateBrowsingUtils.isContentWindowPrivate(manager), "window is private");
|
||||
is(header, null, "header was not set");
|
||||
await close_manager(manager);
|
||||
await BrowserTestUtils.closeWindow(privateWindow);
|
||||
});
|
||||
|
||||
add_task(async function test_clientid() {
|
||||
let clientId = await ClientID.getClientIdHash();
|
||||
ok(!!clientId, "clientId is avialable");
|
||||
let [header, manager] = await Promise.all([
|
||||
waitForHeader(),
|
||||
open_manager("addons://discover/"),
|
||||
]);
|
||||
is(header, clientId, "header was set");
|
||||
await close_manager(manager);
|
||||
});
|
|
@ -75,10 +75,7 @@ async function checkInstallConfirmation(...names) {
|
|||
}
|
||||
|
||||
function getViewContainer(gManagerWindow) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return gManagerWindow.document.getElementById("category-box");
|
||||
}
|
||||
return gManagerWindow.document.getElementById("view-port");
|
||||
return gManagerWindow.document.getElementById("category-box");
|
||||
}
|
||||
|
||||
// Simulates dropping a URL onto the manager
|
||||
|
|
|
@ -14,74 +14,34 @@ AddonTestUtils.initMochitest(this);
|
|||
|
||||
function assertDisabledSideloadedExtensionElement(managerWindow, addonElement) {
|
||||
const doc = addonElement.ownerDocument;
|
||||
if (managerWindow.useHtmlViews) {
|
||||
const toggleDisabled = addonElement.querySelector(
|
||||
'[action="toggle-disabled"]'
|
||||
);
|
||||
is(
|
||||
doc.l10n.getAttributes(toggleDisabled).id,
|
||||
"enable-addon-button",
|
||||
"Addon toggle-disabled action has the enable label"
|
||||
);
|
||||
} else {
|
||||
let el = doc.getAnonymousElementByAttribute(
|
||||
addonElement,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Disable button not visible.");
|
||||
el = doc.getAnonymousElementByAttribute(
|
||||
addonElement,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
is_element_visible(el, "Enable button visible");
|
||||
}
|
||||
const toggleDisabled = addonElement.querySelector(
|
||||
'[action="toggle-disabled"]'
|
||||
);
|
||||
is(
|
||||
doc.l10n.getAttributes(toggleDisabled).id,
|
||||
"enable-addon-button",
|
||||
"Addon toggle-disabled action has the enable label"
|
||||
);
|
||||
}
|
||||
|
||||
function assertEnabledSideloadedExtensionElement(managerWindow, addonElement) {
|
||||
const doc = addonElement.ownerDocument;
|
||||
if (managerWindow.useHtmlViews) {
|
||||
const toggleDisabled = addonElement.querySelector(
|
||||
'[action="toggle-disabled"]'
|
||||
);
|
||||
is(
|
||||
doc.l10n.getAttributes(toggleDisabled).id,
|
||||
"enable-addon-button",
|
||||
"Addon toggle-disabled action has the enable label"
|
||||
);
|
||||
} else {
|
||||
let el = doc.getAnonymousElementByAttribute(
|
||||
addonElement,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Disable button not visible.");
|
||||
el = doc.getAnonymousElementByAttribute(
|
||||
addonElement,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
is_element_visible(el, "Enable button visible");
|
||||
}
|
||||
const toggleDisabled = addonElement.querySelector(
|
||||
'[action="toggle-disabled"]'
|
||||
);
|
||||
is(
|
||||
doc.l10n.getAttributes(toggleDisabled).id,
|
||||
"enable-addon-button",
|
||||
"Addon toggle-disabled action has the enable label"
|
||||
);
|
||||
}
|
||||
|
||||
function clickEnableExtension(managerWindow, addonElement) {
|
||||
if (managerWindow.useHtmlViews) {
|
||||
addonElement.querySelector('[action="toggle-disabled"]').click();
|
||||
} else {
|
||||
const doc = addonElement.ownerDocument;
|
||||
const el = doc.getAnonymousElementByAttribute(
|
||||
addonElement,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(el, { clickCount: 1 }, managerWindow);
|
||||
}
|
||||
addonElement.querySelector('[action="toggle-disabled"]').click();
|
||||
}
|
||||
|
||||
// Loading extension by sideloading method
|
||||
async function test_sideloaded_extension_permissions_prompt() {
|
||||
add_task(async function test_sideloaded_extension_permissions_prompt() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["xpinstall.signatures.required", false],
|
||||
|
@ -164,20 +124,4 @@ async function test_sideloaded_extension_permissions_prompt() {
|
|||
|
||||
await close_manager(manager);
|
||||
await addon.uninstall();
|
||||
}
|
||||
|
||||
add_task(async function test_XUL_aboutaddons_sideloaded_permissions_prompt() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await test_sideloaded_extension_permissions_prompt();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_HTML_aboutaddons_sideloaded_permissions_prompt() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await test_sideloaded_extension_permissions_prompt();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -7,20 +7,15 @@
|
|||
async function loadDetail(aWindow, id) {
|
||||
let loaded = wait_for_view_load(aWindow, undefined, true);
|
||||
// Check the detail view.
|
||||
if (aWindow.useHtmlViews) {
|
||||
let browser = await aWindow.getHtmlBrowser();
|
||||
let card = browser.contentDocument.querySelector(
|
||||
`addon-card[addon-id="${id}"]`
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(card, {}, browser.contentWindow);
|
||||
} else {
|
||||
let card = aWindow.document.querySelector(`.addon.card[value="${id}"]`);
|
||||
EventUtils.synthesizeMouseAtCenter(card, {}, aWindow);
|
||||
}
|
||||
let browser = await aWindow.getHtmlBrowser();
|
||||
let card = browser.contentDocument.querySelector(
|
||||
`addon-card[addon-id="${id}"]`
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(card, {}, browser.contentWindow);
|
||||
await loaded;
|
||||
}
|
||||
|
||||
async function checkCompatibility(hboxSelector, buttonSelector) {
|
||||
add_task(async function checkCompatibility() {
|
||||
info("Testing compatibility checking warning");
|
||||
|
||||
info("Setting checkCompatibility to false");
|
||||
|
@ -34,8 +29,12 @@ async function checkCompatibility(hboxSelector, buttonSelector) {
|
|||
await extension.startup();
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
let hbox = aWindow.document.querySelector(hboxSelector);
|
||||
let button = aWindow.document.querySelector(buttonSelector);
|
||||
let hbox = aWindow.document.querySelector(
|
||||
"#html-view .global-warning-checkcompatibility"
|
||||
);
|
||||
let button = aWindow.document.querySelector(
|
||||
"#html-view .global-warning-checkcompatibility button"
|
||||
);
|
||||
|
||||
function checkMessage(visible) {
|
||||
if (visible) {
|
||||
|
@ -86,9 +85,9 @@ async function checkCompatibility(hboxSelector, buttonSelector) {
|
|||
|
||||
await close_manager(aWindow);
|
||||
await extension.unload();
|
||||
}
|
||||
});
|
||||
|
||||
async function checkSecurity(hboxSelector, buttonSelector) {
|
||||
add_task(async function checkSecurity() {
|
||||
info("Testing update security checking warning");
|
||||
|
||||
var pref = "extensions.checkUpdateSecurity";
|
||||
|
@ -103,8 +102,12 @@ async function checkSecurity(hboxSelector, buttonSelector) {
|
|||
await extension.startup();
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
let hbox = aWindow.document.querySelector(hboxSelector);
|
||||
let button = aWindow.document.querySelector(buttonSelector);
|
||||
let hbox = aWindow.document.querySelector(
|
||||
"#html-view .global-warning-updatesecurity"
|
||||
);
|
||||
let button = aWindow.document.querySelector(
|
||||
"#html-view .global-warning-updatesecurity button"
|
||||
);
|
||||
|
||||
function checkMessage(visible) {
|
||||
if (visible) {
|
||||
|
@ -155,9 +158,9 @@ async function checkSecurity(hboxSelector, buttonSelector) {
|
|||
|
||||
await close_manager(aWindow);
|
||||
await extension.unload();
|
||||
}
|
||||
});
|
||||
|
||||
async function checkSafeMode(hboxSelector) {
|
||||
add_task(async function checkSafeMode() {
|
||||
info("Testing safe mode warning");
|
||||
|
||||
let id = "test-safemode@mochi.test";
|
||||
|
@ -168,7 +171,9 @@ async function checkSafeMode(hboxSelector) {
|
|||
await extension.startup();
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
let hbox = aWindow.document.querySelector(hboxSelector);
|
||||
let hbox = aWindow.document.querySelector(
|
||||
"#html-view .global-warning-safemode"
|
||||
);
|
||||
|
||||
function checkMessage(visible) {
|
||||
if (visible) {
|
||||
|
@ -202,64 +207,4 @@ async function checkSafeMode(hboxSelector) {
|
|||
|
||||
await close_manager(aWindow);
|
||||
await extension.unload();
|
||||
}
|
||||
|
||||
add_task(async function testCompatCheckXUL() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await checkCompatibility(
|
||||
"#list-view hbox.global-warning-checkcompatibility",
|
||||
"#list-view button.global-warning-checkcompatibility"
|
||||
);
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function testCompatCheckHTML() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await checkCompatibility(
|
||||
"#html-view .global-warning-checkcompatibility",
|
||||
"#html-view .global-warning-checkcompatibility button"
|
||||
);
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function testSecurityCheckXUL() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await checkSecurity(
|
||||
"#list-view hbox.global-warning-updatesecurity",
|
||||
"#list-view button.global-warning-updatesecurity"
|
||||
);
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function testSecurityCheckHTML() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await checkSecurity(
|
||||
"#html-view .global-warning-updatesecurity",
|
||||
"#html-view .global-warning-updatesecurity button"
|
||||
);
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function testSafeModeXUL() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await checkSafeMode("#list-view hbox.global-warning-safemode");
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function testSafeModeHTML() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await checkSafeMode("#html-view .global-warning-safemode");
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
|
|
@ -55,19 +55,11 @@ MockGMPInstallManager.prototype = {
|
|||
|
||||
function openDetailsView(aId) {
|
||||
let view = get_current_view(gManagerWindow);
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
Assert.equal(
|
||||
view.id,
|
||||
"html-view",
|
||||
"Should be in the list view to use this function"
|
||||
);
|
||||
} else {
|
||||
Assert.equal(
|
||||
view.id,
|
||||
"list-view",
|
||||
"Should be in the list view to use this function"
|
||||
);
|
||||
}
|
||||
Assert.equal(
|
||||
view.id,
|
||||
"html-view",
|
||||
"Should be in the list view to use this function"
|
||||
);
|
||||
|
||||
let item = get_addon_element(gManagerWindow, aId);
|
||||
Assert.ok(item, "Should have got add-on element.");
|
||||
|
@ -82,11 +74,7 @@ function openDetailsView(aId) {
|
|||
});
|
||||
}
|
||||
|
||||
async function initializeState({ useHtmlViews }) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", useHtmlViews]],
|
||||
});
|
||||
|
||||
async function initializeState() {
|
||||
gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP, true);
|
||||
gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL, 0);
|
||||
|
||||
|
@ -161,68 +149,18 @@ async function testNotInstalledDisabled() {
|
|||
await gCategoryUtilities.openType("plugin");
|
||||
|
||||
for (let addon of gMockAddons) {
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
Assert.ok(item, "Got add-on element:" + addon.id);
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
is(item.parentNode.getAttribute("section"), "1", "Should be disabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const neverActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=never-activate]"
|
||||
);
|
||||
ok(
|
||||
neverActivate.hasAttribute("checked"),
|
||||
"Plugin state should be never-activate"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
item.parentNode.ensureElementIsVisible(item);
|
||||
is(item.getAttribute("active"), "false", "Should be disabled");
|
||||
let addonCard = get_addon_element(gManagerWindow, addon.id);
|
||||
Assert.ok(addonCard, "Got add-on element:" + addon.id);
|
||||
|
||||
let el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning"
|
||||
);
|
||||
is_element_hidden(el, "Warning notification is hidden.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"class",
|
||||
"disabled-postfix"
|
||||
);
|
||||
is_element_visible(el, "disabled-postfix is visible.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Disable button not visible.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Enable button not visible.");
|
||||
let nameEl = addonCard.querySelector(".addon-name");
|
||||
is(
|
||||
addonCard.ownerDocument.l10n.getAttributes(nameEl).id,
|
||||
"addon-name-disabled",
|
||||
"The addon name should include a disabled postfix"
|
||||
);
|
||||
|
||||
let menu = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"state-menulist"
|
||||
);
|
||||
is_element_visible(menu, "State menu should be visible.");
|
||||
|
||||
let neverActivate = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"never-activate-menuitem"
|
||||
);
|
||||
is(
|
||||
menu.selectedItem,
|
||||
neverActivate,
|
||||
"Plugin state should be never-activate."
|
||||
);
|
||||
}
|
||||
let cardMessage = addonCard.querySelector("message-bar.addon-card-message");
|
||||
is_element_hidden(cardMessage, "Warning notification is hidden");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,13 +169,21 @@ async function testNotInstalledDisabledDetails() {
|
|||
await openDetailsView(addon.id);
|
||||
let doc = gManagerWindow.document;
|
||||
|
||||
let el = doc.getElementsByClassName("disabled-postfix")[0];
|
||||
is_element_visible(el, "disabled-postfix is visible.");
|
||||
el = doc.getElementById("detail-findUpdates-btn");
|
||||
is_element_visible(el, "Find updates link is visible.");
|
||||
el = doc.getElementById("detail-warning");
|
||||
is_element_hidden(el, "Warning notification is hidden.");
|
||||
el = doc.getElementsByTagName("setting")[0];
|
||||
let addonCard = get_addon_element(gManagerWindow, addon.id);
|
||||
ok(addonCard, "Got add-on element: " + addon.id);
|
||||
|
||||
let nameEl = addonCard.querySelector(".addon-name");
|
||||
|
||||
is(
|
||||
doc.l10n.getAttributes(nameEl).id,
|
||||
"addon-name-disabled",
|
||||
"The addon name should include a disabled postfix"
|
||||
);
|
||||
|
||||
let updatesBtn = addonCard.querySelector("[action=update-check]");
|
||||
is_element_visible(updatesBtn, "Check for Updates action is visible");
|
||||
let cardMessage = addonCard.querySelector("message-bar.addon-card-message");
|
||||
is_element_hidden(cardMessage, "Warning notification is hidden");
|
||||
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
}
|
||||
|
@ -251,87 +197,42 @@ async function testNotInstalled() {
|
|||
);
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
Assert.ok(item, "Got add-on element:" + addon.id);
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
is(item.parentNode.getAttribute("section"), "0", "Should be enabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const alwaysActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=always-activate]"
|
||||
);
|
||||
ok(
|
||||
alwaysActivate.hasAttribute("checked"),
|
||||
"Plugin state should be always-activate"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
item.parentNode.ensureElementIsVisible(item);
|
||||
is(item.getAttribute("active"), "true");
|
||||
|
||||
let el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning"
|
||||
);
|
||||
is_element_visible(el, "Warning notification is visible.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"class",
|
||||
"disabled-postfix"
|
||||
);
|
||||
is_element_hidden(el, "disabled-postfix is hidden.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Disable button not visible.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Enable button not visible.");
|
||||
let warningMessageBar = await BrowserTestUtils.waitForCondition(() => {
|
||||
return item.querySelector("message-bar.addon-card-message[type=warning]");
|
||||
}, "Wait for the addon card message to be updated");
|
||||
|
||||
let menu = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"state-menulist"
|
||||
);
|
||||
is_element_visible(menu, "State menu should be visible.");
|
||||
is_element_visible(warningMessageBar, "Warning notification is visible");
|
||||
|
||||
let alwaysActivate = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"always-activate-menuitem"
|
||||
);
|
||||
is(
|
||||
menu.selectedItem,
|
||||
alwaysActivate,
|
||||
"Plugin state should be always-activate."
|
||||
);
|
||||
}
|
||||
is(item.parentNode.getAttribute("section"), "0", "Should be enabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const alwaysActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=always-activate]"
|
||||
);
|
||||
ok(
|
||||
alwaysActivate.hasAttribute("checked"),
|
||||
"Plugin state should be always-activate"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function testNotInstalledDetails() {
|
||||
for (let addon of gMockAddons) {
|
||||
await openDetailsView(addon.id);
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
const addonCard = get_addon_element(gManagerWindow, addon.id);
|
||||
let el = addonCard.querySelector("[action=update-check]");
|
||||
is_element_visible(el, "Check for Updates action is visible");
|
||||
// TODO: add assertion for the warning notification once implemented
|
||||
// as part of Bug 1544950.
|
||||
} else {
|
||||
let doc = gManagerWindow.document;
|
||||
let el = doc.getElementsByClassName("disabled-postfix")[0];
|
||||
is_element_hidden(el, "disabled-postfix is hidden.");
|
||||
el = doc.getElementById("detail-findUpdates-btn");
|
||||
is_element_visible(el, "Find updates link is visible.");
|
||||
el = doc.getElementById("detail-warning");
|
||||
is_element_visible(el, "Warning notification is visible.");
|
||||
}
|
||||
|
||||
const addonCard = get_addon_element(gManagerWindow, addon.id);
|
||||
let el = addonCard.querySelector("[action=update-check]");
|
||||
is_element_visible(el, "Check for Updates action is visible");
|
||||
|
||||
let warningMessageBar = await BrowserTestUtils.waitForCondition(() => {
|
||||
return addonCard.querySelector(
|
||||
"message-bar.addon-card-message[type=warning]"
|
||||
);
|
||||
}, "Wait for the addon card message to be updated");
|
||||
is_element_visible(warningMessageBar, "Warning notification is visible");
|
||||
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
}
|
||||
|
@ -354,66 +255,19 @@ async function testInstalled() {
|
|||
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
Assert.ok(item, "Got add-on element.");
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
is(item.parentNode.getAttribute("section"), "0", "Should be enabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const alwaysActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=always-activate]"
|
||||
);
|
||||
ok(
|
||||
alwaysActivate.hasAttribute("checked"),
|
||||
"Plugin state should be always-activate"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
item.parentNode.ensureElementIsVisible(item);
|
||||
is(item.getAttribute("active"), "true");
|
||||
|
||||
let el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning"
|
||||
);
|
||||
is_element_hidden(el, "Warning notification is hidden.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"class",
|
||||
"disabled-postfix"
|
||||
);
|
||||
is_element_hidden(el, "disabled-postfix is hidden.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"disable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Disable button not visible.");
|
||||
el = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"enable-btn"
|
||||
);
|
||||
is_element_hidden(el, "Enable button not visible.");
|
||||
|
||||
let menu = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"state-menulist"
|
||||
);
|
||||
is_element_visible(menu, "State menu should be visible.");
|
||||
|
||||
let alwaysActivate = item.ownerDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"always-activate-menuitem"
|
||||
);
|
||||
is(
|
||||
menu.selectedItem,
|
||||
alwaysActivate,
|
||||
"Plugin state should be always-activate."
|
||||
);
|
||||
}
|
||||
is(item.parentNode.getAttribute("section"), "0", "Should be enabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const alwaysActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=always-activate]"
|
||||
);
|
||||
ok(
|
||||
alwaysActivate.hasAttribute("checked"),
|
||||
"Plugin state should be always-activate"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,44 +275,13 @@ async function testInstalledDetails() {
|
|||
for (let addon of gMockAddons) {
|
||||
await openDetailsView(addon.id);
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
let card = get_addon_element(gManagerWindow, addon.id);
|
||||
is_element_visible(
|
||||
card.querySelector("[action=update-check]"),
|
||||
"Find updates link is bisible"
|
||||
);
|
||||
} else {
|
||||
let doc = gManagerWindow.document;
|
||||
let card = get_addon_element(gManagerWindow, addon.id);
|
||||
ok(card, "Got add-on element:" + addon.id);
|
||||
|
||||
let el = doc.getElementsByClassName("disabled-postfix")[0];
|
||||
is_element_hidden(el, "disabled-postfix is hidden.");
|
||||
el = doc.getElementById("detail-findUpdates-btn");
|
||||
is_element_visible(el, "Find updates link is visible.");
|
||||
el = doc.getElementById("detail-warning");
|
||||
is_element_hidden(el, "Warning notification is hidden.");
|
||||
el = doc.getElementsByTagName("setting")[0];
|
||||
|
||||
let contextMenu = doc.getElementById("addonitem-popup");
|
||||
await new Promise(resolve => {
|
||||
let listener = () => {
|
||||
contextMenu.removeEventListener("popupshown", listener);
|
||||
resolve();
|
||||
};
|
||||
contextMenu.addEventListener("popupshown", listener);
|
||||
el = doc.getElementsByClassName("detail-view-container")[0];
|
||||
EventUtils.synthesizeMouse(el, 4, 4, {}, gManagerWindow);
|
||||
EventUtils.synthesizeMouse(
|
||||
el,
|
||||
4,
|
||||
4,
|
||||
{ type: "contextmenu", button: 2 },
|
||||
gManagerWindow
|
||||
);
|
||||
});
|
||||
let menuSep = doc.getElementById("addonitem-menuseparator");
|
||||
is_element_hidden(menuSep, "Menu separator is hidden.");
|
||||
contextMenu.hidePopup();
|
||||
}
|
||||
is_element_visible(
|
||||
card.querySelector("[action=update-check]"),
|
||||
"Find updates link is visible"
|
||||
);
|
||||
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
}
|
||||
|
@ -469,22 +292,18 @@ async function testInstalledGlobalEmeDisabled() {
|
|||
for (let addon of gMockAddons) {
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
if (addon.isEME) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
is(item.parentNode.getAttribute("section"), "1", "Should be disabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const askActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=ask-to-activate]"
|
||||
);
|
||||
ok(
|
||||
askActivate.shadowRoot.querySelector("button").disabled,
|
||||
"ask-to-activate should be disabled"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
Assert.ok(!item, "Couldn't get add-on element.");
|
||||
}
|
||||
is(item.parentNode.getAttribute("section"), "1", "Should be disabled");
|
||||
// Open the options menu (needed to check the disabled buttons).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const askActivate = pluginOptions.querySelector(
|
||||
"panel-item[action=ask-to-activate]"
|
||||
);
|
||||
ok(
|
||||
askActivate.shadowRoot.querySelector("button").disabled,
|
||||
"ask-to-activate should be disabled"
|
||||
);
|
||||
pluginOptions.querySelector("panel-list").open = false;
|
||||
} else {
|
||||
Assert.ok(item, "Got add-on element.");
|
||||
}
|
||||
|
@ -520,34 +339,19 @@ async function testPreferencesButton() {
|
|||
);
|
||||
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
let doc = gManagerWindow.document;
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
// Open the options menu (needed to check the more options action is enabled).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const moreOptions = pluginOptions.querySelector(
|
||||
"panel-item[action=expand]"
|
||||
);
|
||||
ok(
|
||||
!moreOptions.shadowRoot.querySelector("button").disabled,
|
||||
"more options action should be enabled"
|
||||
);
|
||||
moreOptions.click();
|
||||
} else {
|
||||
let button = doc.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is_element_visible(button);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
button,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
}
|
||||
// Open the options menu (needed to check the more options action is enabled).
|
||||
const pluginOptions = item.querySelector("plugin-options");
|
||||
pluginOptions.querySelector("panel-list").open = true;
|
||||
const moreOptions = pluginOptions.querySelector(
|
||||
"panel-item[action=expand]"
|
||||
);
|
||||
ok(
|
||||
!moreOptions.shadowRoot.querySelector("button").disabled,
|
||||
"more options action should be enabled"
|
||||
);
|
||||
moreOptions.click();
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
}
|
||||
|
@ -567,38 +371,15 @@ async function testUpdateButton() {
|
|||
|
||||
for (let addon of gMockAddons) {
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
let doc = gManagerWindow.document;
|
||||
let item = get_addon_element(gManagerWindow, addon.id);
|
||||
|
||||
gInstalledAddonId = "";
|
||||
gInstallDeferred = Promise.defer();
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
item.querySelector("[action=expand]").click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
let detail = get_addon_element(gManagerWindow, addon.id);
|
||||
detail.querySelector("[action=update-check]").click();
|
||||
} else {
|
||||
let button = doc.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
button,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
|
||||
button = doc.getElementById("detail-findUpdates-btn");
|
||||
Assert.ok(button != null, "Got detail-findUpdates-btn");
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
button,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
}
|
||||
item.querySelector("[action=expand]").click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
let detail = get_addon_element(gManagerWindow, addon.id);
|
||||
detail.querySelector("[action=update-check]").click();
|
||||
|
||||
await gInstallDeferred.promise;
|
||||
Assert.equal(gInstalledAddonId, addon.id);
|
||||
|
@ -672,8 +453,8 @@ async function testCleanupState() {
|
|||
// This function run the sequence of all the gmpProvider tests
|
||||
// under the same initializeStateOptions (which will enable or disable
|
||||
// the HTML about:addons views).
|
||||
async function test_gmpProvider(initializeStateOptions) {
|
||||
await initializeState(initializeStateOptions);
|
||||
add_task(async function test_gmpProvider(initializeStateOptions) {
|
||||
await initializeState();
|
||||
await testNotInstalledDisabled();
|
||||
await testNotInstalledDisabledDetails();
|
||||
await testNotInstalled();
|
||||
|
@ -685,12 +466,4 @@ async function test_gmpProvider(initializeStateOptions) {
|
|||
await testUpdateButton();
|
||||
await testEmeSupport();
|
||||
await testCleanupState();
|
||||
}
|
||||
|
||||
add_task(function test_gmpProvider_on_XUL_aboutaddons() {
|
||||
return test_gmpProvider({ useHtmlViews: false });
|
||||
});
|
||||
|
||||
add_task(async function test_gmpProvider_on_HTML_aboutaddons() {
|
||||
return test_gmpProvider({ useHtmlViews: true });
|
||||
});
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -270,7 +270,6 @@ add_task(async function setup() {
|
|||
// Enable html about:addons and the abuse reporting.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.abuseReport.enabled", true],
|
||||
["extensions.abuseReport.url", "http://test.addons.org/api/report/"],
|
||||
],
|
||||
|
|
|
@ -107,10 +107,7 @@ async function hasPrivateAllowed(id) {
|
|||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.allowPrivateBrowsingByDefault", false],
|
||||
],
|
||||
set: [["extensions.allowPrivateBrowsingByDefault", false]],
|
||||
});
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
|
|
@ -289,8 +289,6 @@ add_task(async function setup() {
|
|||
"extensions.getAddons.discovery.api_url",
|
||||
`http://${AMO_TEST_HOST}/discoapi`,
|
||||
],
|
||||
// Enable HTML for all because some tests load non-discopane views.
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.htmlaboutaddons.discover.enabled", true],
|
||||
// Disable non-discopane recommendations to avoid unexpected discovery
|
||||
// API requests.
|
||||
|
|
|
@ -48,7 +48,6 @@ add_task(async function setup() {
|
|||
["extensions.getAddons.discovery.api_url", `${serverBaseUrl}discoapi`],
|
||||
["app.support.baseURL", `${serverBaseUrl}sumo/`],
|
||||
["extensions.htmlaboutaddons.discover.enabled", true],
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
// Discovery API requests can be triggered by the discopane and the
|
||||
// recommendations in the list view. To make sure that the every test
|
||||
// checks the behavior of the view they're testing, ensure that only one
|
||||
|
|
|
@ -35,9 +35,6 @@ function waitForThemeChange(list) {
|
|||
}
|
||||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
promptService = mockPromptService();
|
||||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
|
|
@ -41,7 +41,6 @@ add_task(async function setup() {
|
|||
set: [
|
||||
// Disable personalized recommendations, they will break the data URI.
|
||||
["browser.discovery.enabled", false],
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.getAddons.discovery.api_url", `data:;base64,${results}`],
|
||||
[
|
||||
"extensions.recommendations.themeRecommendationUrl",
|
||||
|
|
|
@ -33,14 +33,8 @@ function createMessageBar(messageBarStack, { attrs, children, onclose } = {}) {
|
|||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
htmlAboutAddonsWindow = await loadInitialView("extension");
|
||||
registerCleanupFunction(async () => {
|
||||
await closeView(htmlAboutAddonsWindow);
|
||||
});
|
||||
registerCleanupFunction(() => closeView(htmlAboutAddonsWindow));
|
||||
});
|
||||
|
||||
add_task(async function test_message_bar_stack() {
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
const DEFAULT_SECTION_NAMES = ["one", "two", "three"];
|
||||
|
||||
function makeButton({ doc, name, deckId }) {
|
||||
|
|
|
@ -27,10 +27,7 @@ function waitOptionsBrowserInserted() {
|
|||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.htmlaboutaddons.inline-options.enabled", true],
|
||||
],
|
||||
set: [["extensions.htmlaboutaddons.inline-options.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.htmlaboutaddons.inline-options.enabled", true],
|
||||
],
|
||||
set: [["extensions.htmlaboutaddons.inline-options.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
const TEST_PLUGIN_DESCRIPTION = "Flash plug-in for testing purposes.";
|
||||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
let gProvider = new MockProvider();
|
||||
gProvider.createAddons([
|
||||
{
|
||||
|
|
|
@ -8,10 +8,6 @@ function dateHoursAgo(hours) {
|
|||
}
|
||||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
gProvider = new MockProvider();
|
||||
gProvider.createAddons([
|
||||
{
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
});
|
||||
|
||||
async function checkRecommendedBadge(id, hidden) {
|
||||
function checkBadge() {
|
||||
let card = win.document.querySelector(`addon-card[addon-id="${id}"]`);
|
||||
|
|
|
@ -6,10 +6,7 @@ const { AddonTestUtils } = ChromeUtils.import(
|
|||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
||||
add_task(async function enableHtmlViews() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
add_task(async function setup() {
|
||||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
||||
|
|
|
@ -23,9 +23,6 @@ const SUPPORT_URL = Services.urlFormatter.formatURL(
|
|||
);
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
gProvider = new MockProvider();
|
||||
});
|
||||
|
||||
|
|
|
@ -1,274 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
||||
|
||||
/* globals TestUtils */
|
||||
|
||||
let { ExtensionTestCommon } = ChromeUtils.import(
|
||||
"resource://testing-common/ExtensionTestCommon.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.import("resource://testing-common/ContentTask.jsm", {});
|
||||
|
||||
// This test is testing resizing of the inline options in XUL about:addons. The
|
||||
// behavior in HTML about:addons is checked in the testInlineOptions task of
|
||||
// browser_html_options_ui.js.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
var gAddon;
|
||||
var gOtherAddon;
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
|
||||
function installAddon(details) {
|
||||
let id = Cc["@mozilla.org/uuid-generator;1"]
|
||||
.getService(Ci.nsIUUIDGenerator)
|
||||
.generateUUID().number;
|
||||
if (!details.manifest) {
|
||||
details.manifest = {};
|
||||
}
|
||||
details.manifest.applications = { gecko: { id } };
|
||||
let xpi = ExtensionTestCommon.generateXPI(details);
|
||||
|
||||
return AddonManager.installTemporaryAddon(xpi).then(addon => {
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
addon.uninstall();
|
||||
|
||||
Services.obs.notifyObservers(xpi, "flush-cache-entry");
|
||||
xpi.remove(false);
|
||||
});
|
||||
|
||||
return addon;
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
gAddon = await installAddon({
|
||||
manifest: {
|
||||
options_ui: {
|
||||
page: "options.html",
|
||||
},
|
||||
},
|
||||
|
||||
files: {
|
||||
"options.html": `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<style type="text/css">
|
||||
body > p {
|
||||
height: 300px;
|
||||
margin: 0;
|
||||
}
|
||||
body.bigger > p {
|
||||
height: 600px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p>The quick mauve fox jumps over the opalescent dog.</p>
|
||||
</body>
|
||||
</html>`,
|
||||
},
|
||||
});
|
||||
|
||||
// Create another add-on with no inline options, to verify that detail
|
||||
// view switches work correctly.
|
||||
gOtherAddon = await installAddon({});
|
||||
|
||||
gManagerWindow = await open_manager("addons://list/extension");
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
});
|
||||
|
||||
async function openDetailsBrowser(addonId) {
|
||||
var addon = get_addon_element(gManagerWindow, addonId);
|
||||
|
||||
is(
|
||||
addon.mAddon.optionsType,
|
||||
AddonManager.OPTIONS_TYPE_INLINE_BROWSER,
|
||||
"Options should be inline browser type"
|
||||
);
|
||||
|
||||
addon.parentNode.ensureElementIsVisible(addon);
|
||||
|
||||
var button = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
addon,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
|
||||
is_element_visible(button, "Preferences button should be visible");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
|
||||
|
||||
await TestUtils.topicObserved(
|
||||
AddonManager.OPTIONS_NOTIFICATION_DISPLAYED,
|
||||
(subject, data) => data == addonId
|
||||
);
|
||||
|
||||
is(
|
||||
gManagerWindow.gViewController.currentViewId,
|
||||
`addons://detail/${encodeURIComponent(addonId)}/preferences`,
|
||||
"Current view should scroll to preferences"
|
||||
);
|
||||
|
||||
var browser = gManagerWindow.document.querySelector(
|
||||
"#detail-grid > rows > stack > .inline-options-browser"
|
||||
);
|
||||
var rows = browser.parentNode.parentNode;
|
||||
|
||||
let url = await ContentTask.spawn(browser, {}, () => content.location.href);
|
||||
|
||||
ok(browser, "Grid should have a browser descendant");
|
||||
is(browser.localName, "browser", "Grid should have a browser descendant");
|
||||
is(
|
||||
url,
|
||||
addon.mAddon.optionsURL,
|
||||
"Browser has the expected options URL loaded"
|
||||
);
|
||||
|
||||
is(
|
||||
browser.clientWidth,
|
||||
browser.parentNode.clientWidth,
|
||||
"Browser should be the same width as its direct parent"
|
||||
);
|
||||
is(
|
||||
browser.clientWidth,
|
||||
rows.clientWidth,
|
||||
"Browser should be the same width as its rows ancestor"
|
||||
);
|
||||
|
||||
button = gManagerWindow.document.getElementById("detail-prefs-btn");
|
||||
is_element_hidden(button, "Preferences button should not be visible");
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
||||
add_task(async function test_inline_browser_addon() {
|
||||
let browser = await openDetailsBrowser(gAddon.id);
|
||||
|
||||
function checkHeights(expected) {
|
||||
let { clientHeight } = browser;
|
||||
return ContentTask.spawn(
|
||||
browser,
|
||||
{ expected, clientHeight },
|
||||
({ expected, clientHeight }) => {
|
||||
let { body } = content.document;
|
||||
|
||||
is(
|
||||
body.clientHeight,
|
||||
expected,
|
||||
`Document body should be ${expected}px tall`
|
||||
);
|
||||
is(
|
||||
body.clientHeight,
|
||||
body.scrollHeight,
|
||||
"Document body should be tall enough to fit its contents"
|
||||
);
|
||||
|
||||
let heightDiff = clientHeight - expected;
|
||||
ok(
|
||||
heightDiff >= 0 && heightDiff < 50,
|
||||
`Browser should be slightly taller than the document body (${clientHeight} vs. ${expected})`
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Delay long enough to avoid hitting our resize rate limit.
|
||||
let delay = () => new Promise(resolve => setTimeout(resolve, 300));
|
||||
|
||||
await delay();
|
||||
|
||||
await checkHeights(300);
|
||||
|
||||
info(
|
||||
"Increase the document height, and expect the browser to grow correspondingly"
|
||||
);
|
||||
await ContentTask.spawn(browser, null, () => {
|
||||
content.document.body.classList.toggle("bigger");
|
||||
});
|
||||
|
||||
await delay();
|
||||
|
||||
await checkHeights(600);
|
||||
|
||||
info(
|
||||
"Decrease the document height, and expect the browser to shrink correspondingly"
|
||||
);
|
||||
await ContentTask.spawn(browser, null, () => {
|
||||
content.document.body.classList.toggle("bigger");
|
||||
});
|
||||
|
||||
await delay();
|
||||
|
||||
await checkHeights(300);
|
||||
|
||||
await new Promise(resolve =>
|
||||
gCategoryUtilities.openType("extension", resolve)
|
||||
);
|
||||
|
||||
browser = gManagerWindow.document.querySelector(".inline-options-browser");
|
||||
|
||||
is(browser, null, "Options browser should be removed from the document");
|
||||
});
|
||||
|
||||
// Test that loading an add-on with no inline browser works as expected
|
||||
// after having viewed our main test add-on.
|
||||
add_task(async function test_plain_addon() {
|
||||
var addon = get_addon_element(gManagerWindow, gOtherAddon.id);
|
||||
|
||||
is(addon.mAddon.optionsType, null, "Add-on should have no options");
|
||||
|
||||
addon.parentNode.ensureElementIsVisible(addon);
|
||||
|
||||
await EventUtils.synthesizeMouseAtCenter(
|
||||
addon,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(addon, { clickCount: 2 }, gManagerWindow);
|
||||
|
||||
await BrowserTestUtils.waitForEvent(gManagerWindow, "ViewChanged");
|
||||
|
||||
is(
|
||||
gManagerWindow.gViewController.currentViewId,
|
||||
`addons://detail/${encodeURIComponent(gOtherAddon.id)}`,
|
||||
"Detail view should be open"
|
||||
);
|
||||
|
||||
var browser = gManagerWindow.document.querySelector(
|
||||
"#detail-grid > rows > .inline-options-browser"
|
||||
);
|
||||
|
||||
is(browser, null, "Detail view should have no inline browser");
|
||||
|
||||
await new Promise(resolve =>
|
||||
gCategoryUtilities.openType("extension", resolve)
|
||||
);
|
||||
});
|
||||
|
||||
// Test that loading the original add-on details successfully creates a
|
||||
// browser.
|
||||
add_task(async function test_inline_browser_addon_again() {
|
||||
let browser = await openDetailsBrowser(gAddon.id);
|
||||
|
||||
await new Promise(resolve =>
|
||||
gCategoryUtilities.openType("extension", resolve)
|
||||
);
|
||||
|
||||
browser = gManagerWindow.document.querySelector(".inline-options-browser");
|
||||
|
||||
is(browser, null, "Options browser should be removed from the document");
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await close_manager(gManagerWindow);
|
||||
|
||||
gManagerWindow = null;
|
||||
gCategoryUtilities = null;
|
||||
});
|
|
@ -213,7 +213,7 @@ function clickLinks(doc) {
|
|||
}
|
||||
}
|
||||
|
||||
async function init(startPage, isHtmlViews) {
|
||||
async function init(startPage) {
|
||||
gManagerWindow = await open_manager(null);
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
|
@ -226,26 +226,20 @@ async function init(startPage, isHtmlViews) {
|
|||
|
||||
await gCategoryUtilities.openType(startPage);
|
||||
|
||||
if (isHtmlViews) {
|
||||
return gManagerWindow.document.getElementById("html-view-browser")
|
||||
.contentDocument;
|
||||
}
|
||||
return gManagerWindow.document;
|
||||
return gManagerWindow.document.getElementById("html-view-browser")
|
||||
.contentDocument;
|
||||
}
|
||||
|
||||
/* Test functions start here. */
|
||||
|
||||
async function setup(isHtmlViews) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", isHtmlViews]],
|
||||
});
|
||||
add_task(async function setup() {
|
||||
// Clear out any telemetry data that existed before this file is run.
|
||||
Services.telemetry.clearEvents();
|
||||
}
|
||||
});
|
||||
|
||||
async function testBasicViewTelemetry(isHtmlViews) {
|
||||
add_task(async function testBasicViewTelemetry() {
|
||||
let addons = await Promise.all([installTheme(), installExtension()]);
|
||||
let doc = await init("discover", isHtmlViews);
|
||||
let doc = await init("discover");
|
||||
|
||||
await gCategoryUtilities.openType("theme");
|
||||
openDetailView(doc, "theme@mochi.test");
|
||||
|
@ -278,12 +272,12 @@ async function testBasicViewTelemetry(isHtmlViews) {
|
|||
|
||||
await close_manager(gManagerWindow);
|
||||
await Promise.all(addons.map(addon => addon.unload()));
|
||||
}
|
||||
});
|
||||
|
||||
async function testExtensionEvents(isHtmlViews) {
|
||||
add_task(async function testExtensionEvents() {
|
||||
let addon = await installExtension();
|
||||
let type = "extension";
|
||||
let doc = await init("extension", isHtmlViews);
|
||||
let doc = await init("extension");
|
||||
|
||||
// Check/clear the current telemetry.
|
||||
assertTelemetryMatches(
|
||||
|
@ -315,7 +309,7 @@ async function testExtensionEvents(isHtmlViews) {
|
|||
|
||||
// Check remove/undo.
|
||||
await removeAddonAndUndo(doc, row);
|
||||
let uninstallValue = isHtmlViews ? "accepted" : null;
|
||||
let uninstallValue = "accepted";
|
||||
assertTelemetryMatches(
|
||||
[
|
||||
[
|
||||
|
@ -455,10 +449,10 @@ async function testExtensionEvents(isHtmlViews) {
|
|||
await close_manager(gManagerWindow);
|
||||
await addon.unload();
|
||||
await upgraded.unload();
|
||||
}
|
||||
});
|
||||
|
||||
async function testGeneralActions(isHtmlViews) {
|
||||
await init("extension", isHtmlViews);
|
||||
add_task(async function testGeneralActions() {
|
||||
await init("extension");
|
||||
|
||||
let doc = gManagerWindow.document;
|
||||
let menu = doc.getElementById("utils-menu");
|
||||
|
@ -550,12 +544,12 @@ async function testGeneralActions(isHtmlViews) {
|
|||
await close_manager(gManagerWindow);
|
||||
|
||||
assertTelemetryMatches([]);
|
||||
}
|
||||
});
|
||||
|
||||
async function testPreferencesLink(isHtmlViews) {
|
||||
add_task(async function testPreferencesLink() {
|
||||
assertTelemetryMatches([]);
|
||||
|
||||
await init("theme", isHtmlViews);
|
||||
await init("theme");
|
||||
|
||||
let doc = gManagerWindow.document;
|
||||
|
||||
|
@ -588,31 +582,4 @@ async function testPreferencesLink(isHtmlViews) {
|
|||
);
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
}
|
||||
|
||||
const testFns = [
|
||||
testBasicViewTelemetry,
|
||||
testExtensionEvents,
|
||||
testGeneralActions,
|
||||
testPreferencesLink,
|
||||
];
|
||||
|
||||
/**
|
||||
* Setup the tasks. This will add tasks for each of testFns to run with the
|
||||
* XUL and HTML version of about:addons.
|
||||
*
|
||||
* To add a test, add it to the testFns array.
|
||||
*/
|
||||
function addTestTasks(isHtmlViews) {
|
||||
add_task(() => setup(isHtmlViews));
|
||||
|
||||
for (let fn of testFns) {
|
||||
let localTestFnName = fn.name + (isHtmlViews ? "HTML" : "XUL");
|
||||
// Get an informative name for the function in stack traces.
|
||||
let obj = { [localTestFnName]: () => fn(isHtmlViews) };
|
||||
add_task(obj[localTestFnName]);
|
||||
}
|
||||
}
|
||||
|
||||
addTestTasks(false);
|
||||
addTestTasks(true);
|
||||
});
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// The HTML tests are in browser_html_warning_messages.js.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
// Tests that signed and unsigned language packs show up correctly in
|
||||
// the Languages tab based on the langpack signing preference.
|
||||
add_task(async function() {
|
||||
const PREF = "extensions.langpacks.signatures.required";
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[PREF, false]],
|
||||
});
|
||||
|
||||
let provider = new MockProvider();
|
||||
|
||||
provider.createAddons([
|
||||
{
|
||||
id: "signed@tests.mozilla.org",
|
||||
name: "Signed langpack",
|
||||
type: "locale",
|
||||
signedState: AddonManager.SIGNEDSTATE_SIGNED,
|
||||
isCorrectlySigned: true,
|
||||
},
|
||||
{
|
||||
id: "unsigned@tests.mozilla.org",
|
||||
name: "Unsigned langpack",
|
||||
type: "locale",
|
||||
signedState: AddonManager.SIGNEDSTATE_MISSING,
|
||||
isCorrectlySigned: false,
|
||||
},
|
||||
]);
|
||||
|
||||
let mgrWin = await open_manager(null);
|
||||
|
||||
function checklist(signingRequired) {
|
||||
let list = mgrWin.document.getElementById("addon-list");
|
||||
is(list.itemChildren.length, 2, "Found 2 items in langpack list");
|
||||
for (let item of list.itemChildren) {
|
||||
let what, warningVisible, errorVisible;
|
||||
|
||||
if (item.mAddon.id.startsWith("signed")) {
|
||||
// Signed langpack should not have any warning/error
|
||||
what = "signed langpack";
|
||||
warningVisible = false;
|
||||
errorVisible = false;
|
||||
} else if (signingRequired) {
|
||||
// Unsigned should have an error if signing is required
|
||||
what = "unsigned langpack";
|
||||
warningVisible = false;
|
||||
errorVisible = true;
|
||||
} else {
|
||||
// Usnigned should have a warning is signing is not required
|
||||
what = "unsigned langpack";
|
||||
warningVisible = true;
|
||||
errorVisible = false;
|
||||
}
|
||||
|
||||
let warning = mgrWin.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning"
|
||||
);
|
||||
let warningLink = mgrWin.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"warning-link"
|
||||
);
|
||||
if (warningVisible) {
|
||||
is_element_visible(warning, `Warning should be visible for ${what}`);
|
||||
is_element_visible(
|
||||
warningLink,
|
||||
`Warning link should be visible for ${what}`
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(warning, `Warning should be hidden for ${what}`);
|
||||
is_element_hidden(
|
||||
warningLink,
|
||||
`Warning link should be hidden for ${what}`
|
||||
);
|
||||
}
|
||||
|
||||
let error = mgrWin.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"error"
|
||||
);
|
||||
let errorLink = mgrWin.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"error-link"
|
||||
);
|
||||
if (errorVisible) {
|
||||
is_element_visible(error, `Error should be visible for ${what}`);
|
||||
is_element_visible(
|
||||
errorLink,
|
||||
`Error link should be visible for ${what}`
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(error, `Error should be hidden for ${what}`);
|
||||
is_element_hidden(errorLink, `Error link should be hidden for ${what}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let catUtils = new CategoryUtilities(mgrWin);
|
||||
|
||||
await catUtils.openType("locale");
|
||||
checklist(false);
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[PREF, true]],
|
||||
});
|
||||
|
||||
await catUtils.openType("extension");
|
||||
await catUtils.openType("locale");
|
||||
checklist(true);
|
||||
|
||||
await close_manager(mgrWin);
|
||||
});
|
|
@ -1,260 +0,0 @@
|
|||
// This test is testing the view with legacy add-ons in the XUL about:addons UI.
|
||||
// This is not implemented in HTML about:addons, but might be in bug 1525184.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
const INFO_URL =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"webextensions";
|
||||
|
||||
// The mochitest framework installs a bunch of legacy extensions.
|
||||
// Fortunately, the extensions.legacy.exceptions preference exists to
|
||||
// avoid treating some extensions as legacy for the purposes of the UI.
|
||||
const IGNORE = [
|
||||
"special-powers@mozilla.org",
|
||||
"mochikit@mozilla.org",
|
||||
"mozscreenshots@mozilla.org",
|
||||
];
|
||||
|
||||
let exceptions = Services.prefs.getCharPref("extensions.legacy.exceptions");
|
||||
exceptions = [exceptions, ...IGNORE].join(",");
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.legacy.enabled", false],
|
||||
["extensions.legacy.exceptions", exceptions],
|
||||
|
||||
["xpinstall.signatures.required", false],
|
||||
],
|
||||
});
|
||||
|
||||
let goodAddons = [
|
||||
{
|
||||
id: "webextension@tests.mozilla.org",
|
||||
name: "WebExtension",
|
||||
type: "extension",
|
||||
isWebExtension: true,
|
||||
},
|
||||
{
|
||||
id: "mozilla@tests.mozilla.org",
|
||||
name: "Mozilla signed extension",
|
||||
type: "extension",
|
||||
isWebExtension: false,
|
||||
signedState: AddonManager.SIGNEDSTATE_PRIVILEGED,
|
||||
},
|
||||
];
|
||||
|
||||
let disabledAddon = [
|
||||
{
|
||||
id: "legacy@tests.mozilla.org",
|
||||
name: "Legacy extension",
|
||||
type: "extension",
|
||||
isWebExtension: false,
|
||||
appDisabled: true,
|
||||
},
|
||||
];
|
||||
|
||||
let unsignedAddons = [
|
||||
{
|
||||
id: "unsigned_webext@tests.mozilla.org",
|
||||
name: "Unsigned WebExtension",
|
||||
type: "extension",
|
||||
isWebExtension: true,
|
||||
appDisabled: true,
|
||||
signedState: AddonManager.SIGNEDSTATE_MISSING,
|
||||
},
|
||||
{
|
||||
id: "unsigned_legacy@tests.mozilla.org",
|
||||
name: "Unsigned legacy extension",
|
||||
type: "extension",
|
||||
isWebExtension: false,
|
||||
appDisabled: true,
|
||||
signedState: AddonManager.SIGNEDSTATE_MISSING,
|
||||
},
|
||||
];
|
||||
|
||||
let provider = new MockProvider();
|
||||
provider.createAddons(goodAddons);
|
||||
|
||||
let mgrWin = await open_manager(null);
|
||||
let catUtils = new CategoryUtilities(mgrWin);
|
||||
|
||||
// Check that the test addons in the given list are exactly those
|
||||
// in the expected list.
|
||||
async function checkList(listId, expectIds) {
|
||||
let ids = new Set(expectIds);
|
||||
for (let item of mgrWin.document.getElementById(listId).itemChildren) {
|
||||
if (!item.mAddon.id.endsWith("@tests.mozilla.org")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ok(ids.has(item.mAddon.id), `Found ${item.mAddon.id} in addons list`);
|
||||
ids.delete(item.mAddon.id);
|
||||
}
|
||||
|
||||
for (let id of ids) {
|
||||
ok(false, `Did not find ${id} in addons list`);
|
||||
}
|
||||
}
|
||||
|
||||
// Initially, we have two good extensions (a webextension and a
|
||||
// "Mozilla Extensions"-signed extension).
|
||||
await catUtils.openType("extension");
|
||||
checkList("addon-list", [
|
||||
"webextension@tests.mozilla.org",
|
||||
"mozilla@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
let banner = mgrWin.document.getElementById("legacy-extensions-notice");
|
||||
is_element_hidden(banner, "Warning about legacy extensions should be hidden");
|
||||
is(
|
||||
mgrWin.gLegacyView._categoryItem.disabled,
|
||||
true,
|
||||
"Legacy category is hidden"
|
||||
);
|
||||
|
||||
// Now add a legacy extension
|
||||
provider.createAddons(disabledAddon);
|
||||
|
||||
// The legacy category does not watch for new installs since new
|
||||
// legacy extensions cannot be installed while legacy extensions
|
||||
// are disabled, so manually refresh it here.
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
|
||||
// Make sure we re-render the extensions list, after that we should
|
||||
// still just have the original two entries.
|
||||
await catUtils.openType("plugin");
|
||||
await catUtils.openType("extension");
|
||||
|
||||
checkList("addon-list", [
|
||||
"webextension@tests.mozilla.org",
|
||||
"mozilla@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
// But now the legacy banner and category should be visible
|
||||
banner = mgrWin.document.getElementById("legacy-extensions-notice");
|
||||
is_element_visible(
|
||||
banner,
|
||||
"Warning about legacy extensions should be visible"
|
||||
);
|
||||
|
||||
let catItem = mgrWin.gLegacyView._categoryItem;
|
||||
is(catItem.disabled, false, "Legacy category is visible");
|
||||
is(
|
||||
catItem.getAttribute("name"),
|
||||
get_string("type.legacy.name"),
|
||||
"Category label with no unsigned extensions is correct"
|
||||
);
|
||||
|
||||
// Follow the link to the legacy extensions page
|
||||
let legacyLink = mgrWin.document.getElementById(
|
||||
"legacy-extensions-learnmore-link"
|
||||
);
|
||||
is_element_visible(legacyLink, "Link to legacy extension is visible");
|
||||
|
||||
let loadPromise = new Promise(resolve =>
|
||||
wait_for_view_load(mgrWin, resolve, true)
|
||||
);
|
||||
legacyLink.click();
|
||||
await loadPromise;
|
||||
|
||||
is(
|
||||
mgrWin.gViewController.currentViewId,
|
||||
"addons://legacy/",
|
||||
"Legacy extensions link leads to the correct view"
|
||||
);
|
||||
|
||||
let link = mgrWin.document.getElementById("legacy-learnmore");
|
||||
is(link.href, INFO_URL, "Learn more link points to the right place");
|
||||
|
||||
// The only extension in the list should be the one we just added.
|
||||
checkList("legacy-list", ["legacy@tests.mozilla.org"]);
|
||||
|
||||
// Now add some unsigned addons and flip the signing preference
|
||||
provider.createAddons(unsignedAddons);
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["xpinstall.signatures.required", true]],
|
||||
});
|
||||
|
||||
// The entry on the left side should now read "Unsupported"
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
is(catItem.disabled, false, "Legacy category is visible");
|
||||
is(
|
||||
catItem.getAttribute("name"),
|
||||
get_string("type.unsupported.name"),
|
||||
"Category label with unsigned extensions is correct"
|
||||
);
|
||||
|
||||
// The main extensions list should still have the original two
|
||||
// good extensions and the legacy banner.
|
||||
await catUtils.openType("extension");
|
||||
checkList("addon-list", [
|
||||
"webextension@tests.mozilla.org",
|
||||
"mozilla@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
banner = mgrWin.document.getElementById("legacy-extensions-notice");
|
||||
is_element_visible(
|
||||
banner,
|
||||
"Warning about legacy extensions should be visible"
|
||||
);
|
||||
|
||||
// And the legacy pane should show both legacy and unsigned extensions
|
||||
await catUtils.openType("legacy");
|
||||
checkList("legacy-list", [
|
||||
"legacy@tests.mozilla.org",
|
||||
"unsigned_webext@tests.mozilla.org",
|
||||
"unsigned_legacy@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
// Disable unsigned extensions
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["xpinstall.signatures.required", false]],
|
||||
});
|
||||
|
||||
await new Promise(executeSoon);
|
||||
|
||||
// The name of the pane should go back to "Legacy Extensions"
|
||||
await mgrWin.gLegacyView.refreshVisibility();
|
||||
is(catItem.disabled, false, "Legacy category is visible");
|
||||
is(
|
||||
catItem.getAttribute("name"),
|
||||
get_string("type.legacy.name"),
|
||||
"Category label with no unsigned extensions is correct"
|
||||
);
|
||||
|
||||
// The unsigned extension should be present in the main extensions pane
|
||||
await catUtils.openType("extension");
|
||||
checkList("addon-list", [
|
||||
"webextension@tests.mozilla.org",
|
||||
"mozilla@tests.mozilla.org",
|
||||
"unsigned_webext@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
// And it should not be present in the legacy pane
|
||||
await catUtils.openType("legacy");
|
||||
checkList("legacy-list", [
|
||||
"legacy@tests.mozilla.org",
|
||||
"unsigned_legacy@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
await close_manager(mgrWin);
|
||||
|
||||
// Now enable legacy extensions and open a new addons manager tab.
|
||||
// The remembered last view will be the list of legacy extensions but
|
||||
// now that legacy extensions are enabled, we should jump to the
|
||||
// regular Extensions list.
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.legacy.enabled", true]],
|
||||
});
|
||||
|
||||
mgrWin = await open_manager(null);
|
||||
is(
|
||||
mgrWin.gViewController.currentViewId,
|
||||
"addons://list/extension",
|
||||
"addons manager switched to extensions list"
|
||||
);
|
||||
await close_manager(mgrWin);
|
||||
});
|
|
@ -1,104 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// This test is testing XUL about:addons UI not implemented in the HTML about:addons,
|
||||
// it may be adapted or tested in a separate test file in Bug 1525184.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
const INFO_URL =
|
||||
Services.urlFormatter.formatURLPref("app.support.baseURL") +
|
||||
"webextensions";
|
||||
|
||||
const NAMES = {
|
||||
newTheme: "New LWT",
|
||||
legacy: "Legacy Extension",
|
||||
webextension: "WebExtension",
|
||||
dictionary: "Dictionary",
|
||||
langpack: "Language Pack",
|
||||
};
|
||||
let addons = [
|
||||
{
|
||||
id: "new-theme@tests.mozilla.org",
|
||||
name: NAMES.newTheme,
|
||||
type: "theme",
|
||||
isWebExtension: true,
|
||||
},
|
||||
{
|
||||
id: "legacy@tests.mozilla.org",
|
||||
name: NAMES.legacy,
|
||||
type: "extension",
|
||||
isWebExtension: false,
|
||||
},
|
||||
{
|
||||
id: "webextension@tests.mozilla.org",
|
||||
name: NAMES.webextension,
|
||||
type: "extension",
|
||||
isWebExtension: true,
|
||||
},
|
||||
{
|
||||
id: "dictionary@tests.mozilla.org",
|
||||
name: NAMES.dictionary,
|
||||
type: "dictionary",
|
||||
},
|
||||
];
|
||||
|
||||
let provider = new MockProvider();
|
||||
provider.createAddons(addons);
|
||||
|
||||
let mgrWin = await open_manager(null);
|
||||
let catUtils = new CategoryUtilities(mgrWin);
|
||||
|
||||
async function check(category, name, isLegacy) {
|
||||
await catUtils.openType(category);
|
||||
|
||||
let document = mgrWin.document;
|
||||
// First find the entry in the list.
|
||||
let item = Array.from(
|
||||
document.getElementById("addon-list").childNodes
|
||||
).find(i => i.getAttribute("name") == name);
|
||||
|
||||
ok(item, `Found ${name} in list`);
|
||||
item.parentNode.ensureElementIsVisible(item);
|
||||
|
||||
// Check the badge
|
||||
let badge = document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"legacy"
|
||||
);
|
||||
|
||||
if (isLegacy) {
|
||||
is_element_visible(badge, `Legacy badge is visible for ${name}`);
|
||||
is(badge.href, INFO_URL, "Legacy badge link is correct");
|
||||
} else {
|
||||
is_element_hidden(badge, `Legacy badge is hidden for ${name}`);
|
||||
}
|
||||
|
||||
// Click down to the details page.
|
||||
EventUtils.synthesizeMouseAtCenter(item, {}, mgrWin);
|
||||
await new Promise(resolve => wait_for_view_load(mgrWin, resolve));
|
||||
|
||||
// And check the badge
|
||||
let elements = document.getElementsByClassName("legacy-warning");
|
||||
is(elements.length, 1, "Found the legacy-warning element");
|
||||
badge = elements[0];
|
||||
|
||||
if (isLegacy) {
|
||||
is_element_visible(badge, `Legacy badge is visible for ${name}`);
|
||||
is(badge.href, INFO_URL, "Legacy badge link is correct");
|
||||
} else {
|
||||
is_element_hidden(badge, `Legacy badge is hidden for ${name}`);
|
||||
}
|
||||
}
|
||||
|
||||
await check("theme", NAMES.newTheme, false);
|
||||
await check("extension", NAMES.legacy, true);
|
||||
await check("extension", NAMES.webextension, false);
|
||||
await check("dictionary", NAMES.dictionary, false);
|
||||
|
||||
await close_manager(mgrWin);
|
||||
});
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,439 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests manual updates, including the Available Updates pane
|
||||
|
||||
var gProvider;
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
var gAvailableCategory;
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "addon1@tests.mozilla.org",
|
||||
name: "auto updating addon",
|
||||
version: "1.0",
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_ENABLE,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
add_test(function clearOldTelemetry() {
|
||||
Services.telemetry.clearEvents();
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
gAvailableCategory = gManagerWindow.gCategories.get(
|
||||
"addons://updates/available"
|
||||
);
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
false,
|
||||
"Available Updates category should initially be hidden"
|
||||
);
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "addon2@tests.mozilla.org",
|
||||
name: "manually updating addon",
|
||||
version: "1.0",
|
||||
isCompatible: false,
|
||||
operationsRequiringRestart: 0,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE,
|
||||
},
|
||||
]);
|
||||
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
false,
|
||||
"Available Updates category should still be hidden"
|
||||
);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(async function() {
|
||||
let finished = 0;
|
||||
function maybeRunNext() {
|
||||
if (++finished == 2) {
|
||||
run_next_test();
|
||||
}
|
||||
}
|
||||
|
||||
gAvailableCategory.addEventListener(
|
||||
"CategoryBadgeUpdated",
|
||||
function() {
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
true,
|
||||
"Available Updates category should now be visible"
|
||||
);
|
||||
is(
|
||||
gAvailableCategory.badgeCount,
|
||||
1,
|
||||
"Badge for Available Updates should now be 1"
|
||||
);
|
||||
maybeRunNext();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
await gCategoryUtilities.openType("extension");
|
||||
gProvider.createInstalls([
|
||||
{
|
||||
name: "manually updating addon (new and improved!)",
|
||||
existingAddon: gProvider.addons[1],
|
||||
version: "1.1",
|
||||
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml"),
|
||||
},
|
||||
]);
|
||||
|
||||
var item = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
|
||||
get_tooltip_info(item).then(({ version }) => {
|
||||
is(version, "1.0", "Should still show the old version in the tooltip");
|
||||
maybeRunNext();
|
||||
});
|
||||
});
|
||||
|
||||
add_test(async function() {
|
||||
Promise.resolve().then(() => {
|
||||
EventUtils.synthesizeMouseAtCenter(gAvailableCategory, {}, gManagerWindow);
|
||||
});
|
||||
await wait_for_view_load(gManagerWindow, null, true);
|
||||
is(
|
||||
gManagerWindow.document.getElementById("categories").selectedItem.value,
|
||||
"addons://updates/available",
|
||||
"Available Updates category should now be selected"
|
||||
);
|
||||
is(
|
||||
gManagerWindow.gViewController.currentViewId,
|
||||
"addons://updates/available",
|
||||
"Available Updates view should be the current view"
|
||||
);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(async function() {
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
is(list.itemCount, 1, "Should be 1 available update listed");
|
||||
var item = list.firstChild;
|
||||
is(
|
||||
item.mAddon.id,
|
||||
"addon2@tests.mozilla.org",
|
||||
"Update item should be for the manually updating addon"
|
||||
);
|
||||
|
||||
// The item in the list will be checking for update information asynchronously
|
||||
// so we have to wait for it to complete. Doing the same async request should
|
||||
// make our callback be called later.
|
||||
await AddonManager.getAllInstalls();
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
function checkReleaseNotesTelemetry() {
|
||||
let snapshot = Services.telemetry.snapshotEvents(
|
||||
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS,
|
||||
true
|
||||
);
|
||||
ok(
|
||||
snapshot.parent && snapshot.parent.length > 0,
|
||||
"Got parent telemetry events in the snapshot"
|
||||
);
|
||||
|
||||
let releaseNotesEvents = snapshot.parent
|
||||
.filter(
|
||||
([ts, category, method]) =>
|
||||
category == "addonsManager" && method == "action"
|
||||
)
|
||||
.map(([ts, category, ...rest]) => rest);
|
||||
|
||||
Assert.deepEqual(
|
||||
releaseNotesEvents,
|
||||
[
|
||||
[
|
||||
"action",
|
||||
"aboutAddons",
|
||||
null,
|
||||
{
|
||||
action: "releaseNotes",
|
||||
type: "extension",
|
||||
addonId: "addon2@tests.mozilla.org",
|
||||
view: "updates",
|
||||
},
|
||||
],
|
||||
[
|
||||
"action",
|
||||
"aboutAddons",
|
||||
null,
|
||||
{
|
||||
action: "releaseNotes",
|
||||
type: "extension",
|
||||
addonId: "addon2@tests.mozilla.org",
|
||||
view: "updates",
|
||||
},
|
||||
],
|
||||
],
|
||||
"The releaseNotes events are tracked"
|
||||
);
|
||||
}
|
||||
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
var item = list.firstChild;
|
||||
get_tooltip_info(item).then(({ version }) => {
|
||||
is(version, "1.1", "Update item should have version number of the update");
|
||||
var postfix = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"class",
|
||||
"update-postfix"
|
||||
);
|
||||
is_element_visible(postfix, "'Update' postfix should be visible");
|
||||
is_element_visible(item._updateAvailable, "");
|
||||
is_element_visible(
|
||||
item._relNotesToggle,
|
||||
"Release notes toggle should be visible"
|
||||
);
|
||||
is_element_hidden(item._warning, "Incompatible warning should be hidden");
|
||||
is_element_hidden(item._error, "Blocklist error should be hidden");
|
||||
|
||||
info("Opening release notes");
|
||||
item.addEventListener(
|
||||
"RelNotesToggle",
|
||||
function() {
|
||||
info("Release notes now open");
|
||||
|
||||
is_element_hidden(
|
||||
item._relNotesLoading,
|
||||
"Release notes loading message should be hidden"
|
||||
);
|
||||
is_element_visible(
|
||||
item._relNotesError,
|
||||
"Release notes error message should be visible"
|
||||
);
|
||||
is(
|
||||
item._relNotes.childElementCount,
|
||||
0,
|
||||
"Release notes should be empty"
|
||||
);
|
||||
|
||||
info("Closing release notes");
|
||||
item.addEventListener(
|
||||
"RelNotesToggle",
|
||||
function() {
|
||||
info("Release notes now closed");
|
||||
info("Setting Release notes URI to something that should load");
|
||||
gProvider.installs[0].releaseNotesURI = Services.io.newURI(
|
||||
TESTROOT + "releaseNotes.xhtml"
|
||||
);
|
||||
|
||||
info("Re-opening release notes");
|
||||
item.addEventListener(
|
||||
"RelNotesToggle",
|
||||
function() {
|
||||
info("Release notes now open");
|
||||
|
||||
is_element_hidden(
|
||||
item._relNotesLoading,
|
||||
"Release notes loading message should be hidden"
|
||||
);
|
||||
is_element_hidden(
|
||||
item._relNotesError,
|
||||
"Release notes error message should be hidden"
|
||||
);
|
||||
isnot(
|
||||
item._relNotes.childElementCount,
|
||||
0,
|
||||
"Release notes should have been inserted into container"
|
||||
);
|
||||
|
||||
checkReleaseNotesTelemetry();
|
||||
|
||||
run_next_test();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
item._relNotesToggle,
|
||||
{},
|
||||
gManagerWindow
|
||||
);
|
||||
is_element_visible(
|
||||
item._relNotesLoading,
|
||||
"Release notes loading message should be visible"
|
||||
);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
item._relNotesToggle,
|
||||
{},
|
||||
gManagerWindow
|
||||
);
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
item._relNotesToggle,
|
||||
{},
|
||||
gManagerWindow
|
||||
);
|
||||
is_element_visible(
|
||||
item._relNotesLoading,
|
||||
"Release notes loading message should be visible"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
var badgeUpdated = false;
|
||||
var installCompleted = false;
|
||||
|
||||
gAvailableCategory.addEventListener(
|
||||
"CategoryBadgeUpdated",
|
||||
function() {
|
||||
if (installCompleted) {
|
||||
run_next_test();
|
||||
} else {
|
||||
badgeUpdated = true;
|
||||
}
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
var list = gManagerWindow.document.getElementById("updates-list");
|
||||
var item = list.firstChild;
|
||||
var updateBtn = item._updateBtn;
|
||||
is_element_visible(updateBtn, "Update button should be visible");
|
||||
|
||||
var install = gProvider.installs[0];
|
||||
var listener = {
|
||||
onInstallStarted() {
|
||||
info("Install started");
|
||||
is_element_visible(
|
||||
item._installStatus,
|
||||
"Install progress widget should be visible"
|
||||
);
|
||||
},
|
||||
onInstallEnded(...args) {
|
||||
install.removeTestListener(this);
|
||||
info("Install ended");
|
||||
is_element_hidden(
|
||||
item._installStatus,
|
||||
"Install progress widget should be hidden"
|
||||
);
|
||||
|
||||
if (badgeUpdated) {
|
||||
run_next_test();
|
||||
} else {
|
||||
installCompleted = true;
|
||||
}
|
||||
},
|
||||
};
|
||||
install.addTestListener(listener);
|
||||
EventUtils.synthesizeMouseAtCenter(updateBtn, {}, gManagerWindow);
|
||||
});
|
||||
|
||||
add_test(async function() {
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
true,
|
||||
"Available Updates category should still be visible"
|
||||
);
|
||||
is(
|
||||
gAvailableCategory.badgeCount,
|
||||
0,
|
||||
"Badge for Available Updates should now be 0"
|
||||
);
|
||||
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
false,
|
||||
"Available Updates category should be hidden"
|
||||
);
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
let aWindow = await open_manager(null);
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
gAvailableCategory = gManagerWindow.gCategories.get(
|
||||
"addons://updates/available"
|
||||
);
|
||||
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
false,
|
||||
"Available Updates category should be hidden"
|
||||
);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
add_test(function() {
|
||||
gAvailableCategory.addEventListener(
|
||||
"CategoryBadgeUpdated",
|
||||
async function() {
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
true,
|
||||
"Available Updates category should now be visible"
|
||||
);
|
||||
is(
|
||||
gAvailableCategory.badgeCount,
|
||||
1,
|
||||
"Badge for Available Updates should now be 1"
|
||||
);
|
||||
|
||||
gAvailableCategory.addEventListener(
|
||||
"CategoryBadgeUpdated",
|
||||
function() {
|
||||
is(
|
||||
gCategoryUtilities.isVisible(gAvailableCategory),
|
||||
false,
|
||||
"Available Updates category should now be hidden"
|
||||
);
|
||||
|
||||
run_next_test();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID("addon2@tests.mozilla.org");
|
||||
aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_ENABLE;
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
gProvider.createInstalls([
|
||||
{
|
||||
name: "manually updating addon (new and even more improved!)",
|
||||
existingAddon: gProvider.addons[1],
|
||||
version: "1.2",
|
||||
releaseNotesURI: Services.io.newURI(TESTROOT + "thereIsNoFileHere.xhtml"),
|
||||
},
|
||||
]);
|
||||
});
|
|
@ -1,149 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that state menu is displayed correctly (enabled or disabled) in the add-on manager
|
||||
// when the preference is unlocked / locked
|
||||
const gIsWindows = "@mozilla.org/windows-registry-key;1" in Cc;
|
||||
const gIsLinux =
|
||||
"@mozilla.org/gnome-gconf-service;1" in Cc ||
|
||||
"@mozilla.org/gio-service;1" in Cc;
|
||||
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
var gPluginElement;
|
||||
|
||||
function getTestPluginPref() {
|
||||
let prefix = "plugin.state.";
|
||||
if (gIsWindows) {
|
||||
return `${prefix}nptest`;
|
||||
}
|
||||
if (gIsLinux) {
|
||||
return `${prefix}libnptest`;
|
||||
}
|
||||
return `${prefix}test`;
|
||||
}
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons tests should verify
|
||||
// this in their own test files).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.unlockPref(getTestPluginPref());
|
||||
Services.prefs.clearUserPref(getTestPluginPref());
|
||||
});
|
||||
|
||||
function getPlugins() {
|
||||
return AddonManager.getAddonsByTypes(["plugin"]);
|
||||
}
|
||||
|
||||
function getTestPlugin(aPlugins) {
|
||||
let testPluginId;
|
||||
|
||||
for (let plugin of aPlugins) {
|
||||
if (plugin.name == "Test Plug-in") {
|
||||
testPluginId = plugin.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Assert.ok(testPluginId, "Test Plug-in should exist");
|
||||
|
||||
let pluginElement = get_addon_element(gManagerWindow, testPluginId);
|
||||
pluginElement.parentNode.ensureElementIsVisible(pluginElement);
|
||||
|
||||
return pluginElement;
|
||||
}
|
||||
|
||||
function checkStateMenu(locked) {
|
||||
Assert.equal(
|
||||
Services.prefs.prefIsLocked(getTestPluginPref()),
|
||||
locked,
|
||||
"Preference lock state should be correct."
|
||||
);
|
||||
let menuList = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
gPluginElement,
|
||||
"anonid",
|
||||
"state-menulist"
|
||||
);
|
||||
// State menu should always have a selected item which must be visible
|
||||
let selectedMenuItem = menuList.querySelector(
|
||||
'.addon-control[selected="true"]'
|
||||
);
|
||||
|
||||
is_element_visible(menuList, "State menu should be visible.");
|
||||
Assert.equal(
|
||||
menuList.disabled,
|
||||
locked,
|
||||
"State menu should" + (locked === true ? "" : " not") + " be disabled."
|
||||
);
|
||||
|
||||
is_element_visible(
|
||||
selectedMenuItem,
|
||||
"State menu's selected item should be visible."
|
||||
);
|
||||
}
|
||||
|
||||
function checkStateMenuDetail(locked) {
|
||||
Assert.equal(
|
||||
Services.prefs.prefIsLocked(getTestPluginPref()),
|
||||
locked,
|
||||
"Preference should be " + (locked === true ? "" : "un") + "locked."
|
||||
);
|
||||
|
||||
// open details menu
|
||||
EventUtils.synthesizeMouseAtCenter(gPluginElement, {}, gManagerWindow);
|
||||
|
||||
return new Promise(async resolve => {
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
let menuList = gManagerWindow.document.getElementById(
|
||||
"detail-state-menulist"
|
||||
);
|
||||
is_element_visible(menuList, "Details state menu should be visible.");
|
||||
Assert.equal(
|
||||
menuList.disabled,
|
||||
locked,
|
||||
"Details state menu enabled state should be correct."
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function initializeState() {
|
||||
Services.prefs.setIntPref(getTestPluginPref(), Ci.nsIPluginTag.STATE_ENABLED);
|
||||
Services.prefs.unlockPref(getTestPluginPref());
|
||||
gManagerWindow = await open_manager();
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
|
||||
let plugins = await getPlugins();
|
||||
gPluginElement = getTestPlugin(plugins);
|
||||
});
|
||||
|
||||
// Tests that plugin state menu is enabled if the preference is unlocked
|
||||
add_task(async function taskCheckStateMenuIsEnabled() {
|
||||
checkStateMenu(false);
|
||||
await checkStateMenuDetail(false);
|
||||
});
|
||||
|
||||
// Lock the preference and then reload the plugin category
|
||||
add_task(async function reinitializeState() {
|
||||
// lock the preference
|
||||
Services.prefs.lockPref(getTestPluginPref());
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
// Retrieve the test plugin element
|
||||
let plugins = await getPlugins();
|
||||
gPluginElement = getTestPlugin(plugins);
|
||||
});
|
||||
|
||||
// Tests that plugin state menu is disabled if the preference is locked
|
||||
add_task(async function taskCheckStateMenuIsDisabled() {
|
||||
checkStateMenu(true);
|
||||
await checkStateMenuDetail(true);
|
||||
});
|
||||
|
||||
add_task(async function testCleanup() {
|
||||
await close_manager(gManagerWindow);
|
||||
});
|
|
@ -11,7 +11,7 @@ async function getTestPluginAddon() {
|
|||
return plugins.find(plugin => plugin.name === "Test Plug-in");
|
||||
}
|
||||
|
||||
async function test_inline_plugin_prefs() {
|
||||
add_task(async function test_inline_plugin_prefs() {
|
||||
gManagerWindow = await open_manager("addons://list/plugin");
|
||||
let testPlugin = await getTestPluginAddon();
|
||||
ok(testPlugin, "Test Plug-in should exist");
|
||||
|
@ -35,26 +35,7 @@ async function test_inline_plugin_prefs() {
|
|||
}
|
||||
).then(event => event.target);
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
pluginEl.querySelector("panel-item[action='preferences']").click();
|
||||
} else {
|
||||
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
|
||||
|
||||
let button = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
pluginEl,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is_element_visible(button, "Preferences button should be visible");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
pluginEl,
|
||||
{ clickCount: 1 },
|
||||
gManagerWindow
|
||||
);
|
||||
|
||||
await TestUtils.topicObserved(AddonManager.OPTIONS_NOTIFICATION_DISPLAYED);
|
||||
}
|
||||
pluginEl.querySelector("panel-item[action='preferences']").click();
|
||||
|
||||
info("Waiting for inline options page to be ready");
|
||||
let doc = (await optionsBrowserPromise).contentDocument;
|
||||
|
@ -82,20 +63,4 @@ async function test_inline_plugin_prefs() {
|
|||
);
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
}
|
||||
|
||||
add_task(async function test_inline_plugin_prefs_on_XUL_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await test_inline_plugin_prefs();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_task(async function test_inline_plugin_prefs_on_HTML_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await test_inline_plugin_prefs();
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests plugin prefs being enabled
|
||||
|
||||
function getTestPlugin(aPlugins) {
|
||||
let [testPlugin] = aPlugins.filter(plugin => plugin.name === "Test Plug-in");
|
||||
Assert.ok(testPlugin, "Test Plug-in should exist");
|
||||
return testPlugin;
|
||||
}
|
||||
|
||||
add_task(async function taskCheckPluginPrefsEnabled() {
|
||||
const [gManagerWindow, plugins] = await Promise.all([
|
||||
open_manager(),
|
||||
AddonManager.getAddonsByTypes(["plugin"]),
|
||||
]);
|
||||
const testPlugin = getTestPlugin(plugins);
|
||||
const testPluginTag = getTestPluginTag();
|
||||
Assert.ok(testPluginTag, "Test Plug-in tag should exist");
|
||||
const initialTestPluginState = testPluginTag.enabledState;
|
||||
|
||||
Assert.ok(
|
||||
gManagerWindow.gViewController.commands.cmd_showItemPreferences.isEnabled(
|
||||
testPlugin
|
||||
),
|
||||
"Test Plug-in preferences should be enabled"
|
||||
);
|
||||
testPluginTag.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
|
||||
Assert.ok(
|
||||
gManagerWindow.gViewController.commands.cmd_showItemPreferences.isEnabled(
|
||||
testPlugin
|
||||
),
|
||||
"Test Plug-in preferences should be enabled"
|
||||
);
|
||||
|
||||
testPluginTag.enabledState = initialTestPluginState;
|
||||
await close_manager(gManagerWindow);
|
||||
});
|
|
@ -14,78 +14,26 @@ const testIdSuffix = "@tests.mozilla.org";
|
|||
|
||||
let gManagerWindow, xpi1, xpi2;
|
||||
|
||||
function get_test_items_in_list(aManager) {
|
||||
let item = aManager.document.getElementById("addon-list").firstChild;
|
||||
let items = [];
|
||||
|
||||
while (item) {
|
||||
if (item.localName != "richlistitem") {
|
||||
item = item.nextSibling;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
!item.mAddon ||
|
||||
item.mAddon.id.substring(item.mAddon.id.length - testIdSuffix.length) ==
|
||||
testIdSuffix
|
||||
) {
|
||||
items.push(item);
|
||||
}
|
||||
item = item.nextSibling;
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
function htmlDoc() {
|
||||
return gManagerWindow.document.getElementById("html-view-browser")
|
||||
.contentDocument;
|
||||
}
|
||||
|
||||
function get_list_item_count() {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return htmlDoc().querySelectorAll(`addon-card[addon-id$="${testIdSuffix}"]`)
|
||||
.length;
|
||||
}
|
||||
return get_test_items_in_list(gManagerWindow).length;
|
||||
}
|
||||
|
||||
function get_node(parent, anonid) {
|
||||
return parent.ownerDocument.getAnonymousElementByAttribute(
|
||||
parent,
|
||||
"anonid",
|
||||
anonid
|
||||
);
|
||||
return htmlDoc().querySelectorAll(`addon-card[addon-id$="${testIdSuffix}"]`)
|
||||
.length;
|
||||
}
|
||||
|
||||
function removeItem(item) {
|
||||
let button;
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
button = item.querySelector('[action="remove"]');
|
||||
button.click();
|
||||
} else {
|
||||
button = get_node(item, "remove-btn");
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, button.ownerGlobal);
|
||||
}
|
||||
}
|
||||
|
||||
function get_class_node(parent, cls) {
|
||||
return parent.ownerDocument.getAnonymousElementByAttribute(
|
||||
parent,
|
||||
"class",
|
||||
cls
|
||||
);
|
||||
let button = item.querySelector('[action="remove"]');
|
||||
button.click();
|
||||
}
|
||||
|
||||
function hasPendingMessage(item, msg) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
let messageBar = htmlDoc().querySelector(
|
||||
`message-bar[addon-id="${item.addon.id}"`
|
||||
);
|
||||
is_element_visible(messageBar, msg);
|
||||
} else {
|
||||
is_element_visible(get_class_node(item, "pending"), msg);
|
||||
}
|
||||
let messageBar = htmlDoc().querySelector(
|
||||
`message-bar[addon-id="${item.addon.id}"`
|
||||
);
|
||||
is_element_visible(messageBar, msg);
|
||||
}
|
||||
|
||||
async function install_addon(xpi) {
|
||||
|
@ -109,69 +57,47 @@ async function check_addon(aAddon, aVersion) {
|
|||
let { version } = await get_tooltip_info(item, gManagerWindow);
|
||||
is(version, aVersion, "Version should be correct");
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
const l10nAttrs = item.ownerDocument.l10n.getAttributes(
|
||||
item.querySelector(".addon-name")
|
||||
);
|
||||
if (aAddon.userDisabled) {
|
||||
Assert.deepEqual(
|
||||
l10nAttrs,
|
||||
{ id: "addon-name-disabled", args: { name: aAddon.name } },
|
||||
"localized addon name is marked as disabled"
|
||||
);
|
||||
} else {
|
||||
Assert.deepEqual(
|
||||
l10nAttrs,
|
||||
{ id: null, args: null },
|
||||
"localized addon name is not marked as disabled"
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const l10nAttrs = item.ownerDocument.l10n.getAttributes(
|
||||
item.querySelector(".addon-name")
|
||||
);
|
||||
if (aAddon.userDisabled) {
|
||||
is_element_visible(
|
||||
get_class_node(item, "disabled-postfix"),
|
||||
"Disabled postfix should be hidden"
|
||||
Assert.deepEqual(
|
||||
l10nAttrs,
|
||||
{ id: "addon-name-disabled", args: { name: aAddon.name } },
|
||||
"localized addon name is marked as disabled"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
get_class_node(item, "disabled-postfix"),
|
||||
"Disabled postfix should be hidden"
|
||||
Assert.deepEqual(
|
||||
l10nAttrs,
|
||||
{ id: null, args: null },
|
||||
"localized addon name is not marked as disabled"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async function wait_for_addon_item_added(addonId) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
htmlDoc().querySelector("addon-list"),
|
||||
"add"
|
||||
);
|
||||
const item = get_addon_element(gManagerWindow, addonId);
|
||||
ok(item, `Found addon card for ${addonId}`);
|
||||
}
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
htmlDoc().querySelector("addon-list"),
|
||||
"add"
|
||||
);
|
||||
const item = get_addon_element(gManagerWindow, addonId);
|
||||
ok(item, `Found addon card for ${addonId}`);
|
||||
}
|
||||
|
||||
async function wait_for_addon_item_removed(addonId) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
htmlDoc().querySelector("addon-list"),
|
||||
"remove"
|
||||
);
|
||||
const item = get_addon_element(gManagerWindow, addonId);
|
||||
ok(!item, `There shouldn't be an addon card for ${addonId}`);
|
||||
}
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
htmlDoc().querySelector("addon-list"),
|
||||
"remove"
|
||||
);
|
||||
const item = get_addon_element(gManagerWindow, addonId);
|
||||
ok(!item, `There shouldn't be an addon card for ${addonId}`);
|
||||
}
|
||||
|
||||
async function wait_for_addon_item_updated(addonId) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
get_addon_element(gManagerWindow, addonId),
|
||||
"update"
|
||||
);
|
||||
}
|
||||
function wait_for_addon_item_updated(addonId) {
|
||||
return BrowserTestUtils.waitForEvent(
|
||||
get_addon_element(gManagerWindow, addonId),
|
||||
"update"
|
||||
);
|
||||
}
|
||||
|
||||
// Install version 1 then upgrade to version 2 with the manager open
|
||||
|
@ -316,35 +242,6 @@ async function test_upgrade_pending_uninstall_disabled_v1_to_v2() {
|
|||
is(get_list_item_count(), 0, "Should be no items in the list");
|
||||
}
|
||||
|
||||
async function test_upgrades(useHtmlViews) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", useHtmlViews]],
|
||||
});
|
||||
|
||||
// Close existing about:addons tab if a test failure has
|
||||
// prevented it from being closed.
|
||||
if (gManagerWindow) {
|
||||
await close_manager(gManagerWindow);
|
||||
}
|
||||
|
||||
gManagerWindow = await open_manager("addons://list/extension");
|
||||
is(
|
||||
gManagerWindow.useHtmlViews,
|
||||
useHtmlViews,
|
||||
"Got about:addons window in the expected mode"
|
||||
);
|
||||
|
||||
await test_upgrade_v1_to_v2();
|
||||
await test_upgrade_disabled_v1_to_v2();
|
||||
await test_upgrade_pending_uninstall_v1_to_v2();
|
||||
await test_upgrade_pending_uninstall_disabled_v1_to_v2();
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
gManagerWindow = null;
|
||||
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
xpi1 = await AddonTestUtils.createTempWebExtensionFile({
|
||||
manifest: {
|
||||
|
@ -364,10 +261,20 @@ add_task(async function setup() {
|
|||
mockPromptService()._response = 0;
|
||||
});
|
||||
|
||||
add_task(function run_tests_on_XUL_aboutaddons() {
|
||||
return test_upgrades(false);
|
||||
});
|
||||
add_task(async function test_upgrades() {
|
||||
// Close existing about:addons tab if a test failure has
|
||||
// prevented it from being closed.
|
||||
if (gManagerWindow) {
|
||||
await close_manager(gManagerWindow);
|
||||
}
|
||||
|
||||
add_task(function run_tests_on_HTML_aboutaddons() {
|
||||
return test_upgrades(true);
|
||||
gManagerWindow = await open_manager("addons://list/extension");
|
||||
|
||||
await test_upgrade_v1_to_v2();
|
||||
await test_upgrade_disabled_v1_to_v2();
|
||||
await test_upgrade_pending_uninstall_v1_to_v2();
|
||||
await test_upgrade_pending_uninstall_disabled_v1_to_v2();
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
gManagerWindow = null;
|
||||
});
|
||||
|
|
|
@ -1,385 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that sorting of add-ons works correctly
|
||||
// (this test uses the list view, even though it no longer has sort buttons - see bug 623207)
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI features that are not supported in the
|
||||
// HTML about:addons.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
gProvider.createAddons([
|
||||
{
|
||||
// enabledInstalled group
|
||||
// * Enabled
|
||||
// * Incompatible but enabled because compatibility checking is off
|
||||
// * Waiting to be installed
|
||||
// * Waiting to be enabled
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Test add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 2, 0, 0, 0),
|
||||
pendingOperations: AddonManager.PENDING_NONE,
|
||||
},
|
||||
{
|
||||
id: "test2@tests.mozilla.org",
|
||||
name: "a first add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 1, 23, 59, 59),
|
||||
pendingOperations: AddonManager.PENDING_UPGRADE,
|
||||
isActive: true,
|
||||
isCompatible: false,
|
||||
},
|
||||
{
|
||||
id: "test3@tests.mozilla.org",
|
||||
name: "\u010Cesk\u00FD slovn\u00EDk", // Český slovník
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 2, 0, 0, 1),
|
||||
pendingOperations: AddonManager.PENDING_INSTALL,
|
||||
isActive: false,
|
||||
},
|
||||
{
|
||||
id: "test4@tests.mozilla.org",
|
||||
name: "canadian dictionary",
|
||||
updateDate: new Date(1970, 0, 1, 0, 0, 0),
|
||||
description: "foo",
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: "test5@tests.mozilla.org",
|
||||
name: "croatian dictionary",
|
||||
description: "foo",
|
||||
updateDate: new Date(2012, 12, 12, 0, 0, 0),
|
||||
pendingOperations: AddonManager.PENDING_ENABLE,
|
||||
isActive: false,
|
||||
},
|
||||
{
|
||||
// pendingDisable group
|
||||
// * Waiting to be disabled
|
||||
id: "test6@tests.mozilla.org",
|
||||
name: "orange Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 2, 0, 0, 0),
|
||||
isCompatible: false,
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "test7@tests.mozilla.org",
|
||||
name: "Blue Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 1, 23, 59, 59),
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "test8@tests.mozilla.org",
|
||||
name: "Green Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 3, 0, 0, 1),
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "test9@tests.mozilla.org",
|
||||
name: "red Add-on",
|
||||
updateDate: new Date(2011, 4, 1, 0, 0, 0),
|
||||
description: "foo",
|
||||
isCompatible: false,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
},
|
||||
{
|
||||
id: "test10@tests.mozilla.org",
|
||||
name: "Purple Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2012, 12, 12, 0, 0, 0),
|
||||
isCompatible: false,
|
||||
pendingOperations: AddonManager.PENDING_DISABLE,
|
||||
},
|
||||
{
|
||||
// pendingUninstall group
|
||||
// * Waiting to be removed
|
||||
id: "test11@tests.mozilla.org",
|
||||
name: "amber Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(1978, 4, 2, 0, 0, 0),
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
},
|
||||
{
|
||||
id: "test12@tests.mozilla.org",
|
||||
name: "Salmon Add-on - pending disable",
|
||||
description: "foo",
|
||||
updateDate: new Date(2054, 4, 1, 23, 59, 59),
|
||||
isActive: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
},
|
||||
{
|
||||
id: "test13@tests.mozilla.org",
|
||||
name: "rose Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 2, 0, 0, 1),
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
},
|
||||
{
|
||||
id: "test14@tests.mozilla.org",
|
||||
name: "Violet Add-on",
|
||||
updateDate: new Date(2010, 5, 1, 0, 0, 0),
|
||||
description: "foo",
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
},
|
||||
{
|
||||
id: "test15@tests.mozilla.org",
|
||||
name: "white Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 12, 0, 0, 0),
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
pendingOperations: AddonManager.PENDING_UNINSTALL,
|
||||
},
|
||||
{
|
||||
// disabledIncompatibleBlocked group
|
||||
// * Disabled
|
||||
// * Incompatible
|
||||
// * Blocklisted
|
||||
id: "test16@tests.mozilla.org",
|
||||
name: "grimsby Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 1, 0, 0, 0),
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
},
|
||||
{
|
||||
id: "test17@tests.mozilla.org",
|
||||
name: "beamsville Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 8, 23, 59, 59),
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
},
|
||||
{
|
||||
id: "test18@tests.mozilla.org",
|
||||
name: "smithville Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 3, 0, 0, 1),
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
|
||||
},
|
||||
{
|
||||
id: "test19@tests.mozilla.org",
|
||||
name: "dunnville Add-on",
|
||||
updateDate: new Date(2010, 4, 2, 0, 0, 0),
|
||||
description: "foo",
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
isCompatible: false,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_NOT_BLOCKED,
|
||||
},
|
||||
{
|
||||
id: "test20@tests.mozilla.org",
|
||||
name: "silverdale Add-on",
|
||||
description: "foo",
|
||||
updateDate: new Date(2010, 4, 12, 0, 0, 0),
|
||||
isActive: false,
|
||||
appDisabled: true,
|
||||
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
function set_order(aSortBy, aAscending) {
|
||||
var list = gManagerWindow.document.getElementById("addon-list");
|
||||
var elements = [];
|
||||
var node = list.firstChild;
|
||||
while (node) {
|
||||
elements.push(node);
|
||||
node = node.nextSibling;
|
||||
}
|
||||
gManagerWindow.sortElements(elements, ["uiState", aSortBy], aAscending);
|
||||
for (let element of elements) {
|
||||
list.appendChild(element);
|
||||
}
|
||||
}
|
||||
|
||||
function check_order(aExpectedOrder) {
|
||||
var order = [];
|
||||
var list = gManagerWindow.document.getElementById("addon-list");
|
||||
var node = list.firstChild;
|
||||
while (node) {
|
||||
var id = node.getAttribute("value");
|
||||
if (id && id.endsWith("@tests.mozilla.org")) {
|
||||
order.push(node.getAttribute("value"));
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
is(
|
||||
order.toSource(),
|
||||
aExpectedOrder.toSource(),
|
||||
"Should have seen the right order"
|
||||
);
|
||||
}
|
||||
|
||||
// Tests that ascending name ordering was the default
|
||||
add_test(function() {
|
||||
check_order([
|
||||
"test2@tests.mozilla.org",
|
||||
"test4@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
"test5@tests.mozilla.org",
|
||||
"test1@tests.mozilla.org",
|
||||
"test7@tests.mozilla.org",
|
||||
"test8@tests.mozilla.org",
|
||||
"test6@tests.mozilla.org",
|
||||
"test10@tests.mozilla.org",
|
||||
"test9@tests.mozilla.org",
|
||||
"test11@tests.mozilla.org",
|
||||
"test13@tests.mozilla.org",
|
||||
"test12@tests.mozilla.org",
|
||||
"test14@tests.mozilla.org",
|
||||
"test15@tests.mozilla.org",
|
||||
"test17@tests.mozilla.org",
|
||||
"test19@tests.mozilla.org",
|
||||
"test16@tests.mozilla.org",
|
||||
"test20@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
]);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Tests that switching to date ordering works
|
||||
add_test(function() {
|
||||
set_order("updateDate", false);
|
||||
|
||||
// When we're ascending with updateDate, it's from newest
|
||||
// to oldest.
|
||||
|
||||
check_order([
|
||||
"test5@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
"test1@tests.mozilla.org",
|
||||
"test2@tests.mozilla.org",
|
||||
"test4@tests.mozilla.org",
|
||||
"test10@tests.mozilla.org",
|
||||
"test9@tests.mozilla.org",
|
||||
"test8@tests.mozilla.org",
|
||||
"test6@tests.mozilla.org",
|
||||
"test7@tests.mozilla.org",
|
||||
"test12@tests.mozilla.org",
|
||||
"test14@tests.mozilla.org",
|
||||
"test15@tests.mozilla.org",
|
||||
"test13@tests.mozilla.org",
|
||||
"test11@tests.mozilla.org",
|
||||
"test20@tests.mozilla.org",
|
||||
"test17@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
"test19@tests.mozilla.org",
|
||||
"test16@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
set_order("updateDate", true);
|
||||
|
||||
check_order([
|
||||
"test4@tests.mozilla.org",
|
||||
"test2@tests.mozilla.org",
|
||||
"test1@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
"test5@tests.mozilla.org",
|
||||
"test7@tests.mozilla.org",
|
||||
"test6@tests.mozilla.org",
|
||||
"test8@tests.mozilla.org",
|
||||
"test9@tests.mozilla.org",
|
||||
"test10@tests.mozilla.org",
|
||||
"test11@tests.mozilla.org",
|
||||
"test13@tests.mozilla.org",
|
||||
"test15@tests.mozilla.org",
|
||||
"test14@tests.mozilla.org",
|
||||
"test12@tests.mozilla.org",
|
||||
"test16@tests.mozilla.org",
|
||||
"test19@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
"test17@tests.mozilla.org",
|
||||
"test20@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Tests that switching to name ordering works
|
||||
add_test(function() {
|
||||
set_order("name", true);
|
||||
|
||||
check_order([
|
||||
"test2@tests.mozilla.org",
|
||||
"test4@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
"test5@tests.mozilla.org",
|
||||
"test1@tests.mozilla.org",
|
||||
"test7@tests.mozilla.org",
|
||||
"test8@tests.mozilla.org",
|
||||
"test6@tests.mozilla.org",
|
||||
"test10@tests.mozilla.org",
|
||||
"test9@tests.mozilla.org",
|
||||
"test11@tests.mozilla.org",
|
||||
"test13@tests.mozilla.org",
|
||||
"test12@tests.mozilla.org",
|
||||
"test14@tests.mozilla.org",
|
||||
"test15@tests.mozilla.org",
|
||||
"test17@tests.mozilla.org",
|
||||
"test19@tests.mozilla.org",
|
||||
"test16@tests.mozilla.org",
|
||||
"test20@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
set_order("name", false);
|
||||
|
||||
check_order([
|
||||
"test1@tests.mozilla.org",
|
||||
"test5@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
"test4@tests.mozilla.org",
|
||||
"test2@tests.mozilla.org",
|
||||
"test9@tests.mozilla.org",
|
||||
"test10@tests.mozilla.org",
|
||||
"test6@tests.mozilla.org",
|
||||
"test8@tests.mozilla.org",
|
||||
"test7@tests.mozilla.org",
|
||||
"test15@tests.mozilla.org",
|
||||
"test14@tests.mozilla.org",
|
||||
"test12@tests.mozilla.org",
|
||||
"test13@tests.mozilla.org",
|
||||
"test11@tests.mozilla.org",
|
||||
"test18@tests.mozilla.org",
|
||||
"test20@tests.mozilla.org",
|
||||
"test16@tests.mozilla.org",
|
||||
"test19@tests.mozilla.org",
|
||||
"test17@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
run_next_test();
|
||||
});
|
|
@ -1,109 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that sorting of plugins works correctly
|
||||
// (this test checks that plugins with "ask to activate" state appear after those with
|
||||
// "always activate" and before those with "never activate")
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI features that are not supported in the
|
||||
// HTML about:addons.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
gProvider.createAddons([
|
||||
{
|
||||
// enabledInstalled group
|
||||
// * Always activate
|
||||
// * Ask to activate
|
||||
// * Never activate
|
||||
id: "test1@tests.mozilla.org",
|
||||
name: "Java Applet Plug-in Java 7 Update 51",
|
||||
description: "foo",
|
||||
type: "plugin",
|
||||
isActive: true,
|
||||
userDisabled: AddonManager.STATE_ASK_TO_ACTIVATE,
|
||||
},
|
||||
{
|
||||
id: "test2@tests.mozilla.org",
|
||||
name: "Quick Time Plug-in",
|
||||
description: "foo",
|
||||
type: "plugin",
|
||||
isActive: true,
|
||||
userDisabled: false,
|
||||
},
|
||||
{
|
||||
id: "test3@tests.mozilla.org",
|
||||
name: "Shockwave Flash",
|
||||
description: "foo",
|
||||
type: "plugin",
|
||||
isActive: false,
|
||||
userDisabled: true,
|
||||
},
|
||||
{
|
||||
id: "test4@tests.mozilla.org",
|
||||
name: "Adobe Reader Plug-in",
|
||||
description: "foo",
|
||||
type: "plugin",
|
||||
isActive: true,
|
||||
userDisabled: AddonManager.STATE_ASK_TO_ACTIVATE,
|
||||
},
|
||||
{
|
||||
id: "test5@tests.mozilla.org",
|
||||
name: "3rd Party Plug-in",
|
||||
description: "foo",
|
||||
type: "plugin",
|
||||
isActive: true,
|
||||
userDisabled: false,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager("addons://list/plugin");
|
||||
gManagerWindow = aWindow;
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
function check_order(aExpectedOrder) {
|
||||
var order = [];
|
||||
var list = gManagerWindow.document.getElementById("addon-list");
|
||||
var node = list.firstChild;
|
||||
while (node) {
|
||||
var id = node.getAttribute("value");
|
||||
if (id && id.endsWith("@tests.mozilla.org")) {
|
||||
order.push(node.getAttribute("value"));
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
is(
|
||||
order.toSource(),
|
||||
aExpectedOrder.toSource(),
|
||||
"Should have seen the right order"
|
||||
);
|
||||
}
|
||||
|
||||
// Tests that ascending name ordering was the default
|
||||
add_test(function() {
|
||||
check_order([
|
||||
"test5@tests.mozilla.org",
|
||||
"test2@tests.mozilla.org",
|
||||
"test4@tests.mozilla.org",
|
||||
"test1@tests.mozilla.org",
|
||||
"test3@tests.mozilla.org",
|
||||
]);
|
||||
|
||||
run_next_test();
|
||||
});
|
|
@ -1,77 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests various aspects of the details view
|
||||
|
||||
var gManagerWindow;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "tabsettings@tests.mozilla.org",
|
||||
name: "Tab Settings",
|
||||
version: "1",
|
||||
optionsURL: CHROMEROOT + "addon_prefs.xul",
|
||||
optionsType: AddonManager.OPTIONS_TYPE_TAB,
|
||||
},
|
||||
]);
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
add_test(function() {
|
||||
var addon = get_addon_element(
|
||||
gManagerWindow,
|
||||
"tabsettings@tests.mozilla.org"
|
||||
);
|
||||
is(
|
||||
addon.mAddon.optionsType,
|
||||
AddonManager.OPTIONS_TYPE_TAB,
|
||||
"Options should be inline type"
|
||||
);
|
||||
addon.parentNode.ensureElementIsVisible(addon);
|
||||
|
||||
var button = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
addon,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is_element_visible(button, "Preferences button should be visible");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, gManagerWindow);
|
||||
|
||||
var browser = gBrowser.selectedBrowser;
|
||||
browser.addEventListener(
|
||||
"DOMContentLoaded",
|
||||
function() {
|
||||
is(
|
||||
browser.currentURI.spec,
|
||||
addon.mAddon.optionsURL,
|
||||
"New tab should have loaded the options URL"
|
||||
);
|
||||
browser.contentWindow.close();
|
||||
run_next_test();
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
});
|
|
@ -1,184 +0,0 @@
|
|||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
);
|
||||
|
||||
let gManagerWindow;
|
||||
let gCategoryUtilities;
|
||||
|
||||
// This test is testing the theme list at XUL about:addons. HTML about:addons's
|
||||
// theme list is already tested in browser_html_list_view.js.
|
||||
// The testThemeOrdering part of this test should be adapted when bug 1557768
|
||||
// is fixed.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
// AddonTestUtils with open_manager cause this reference to be maintained and creates a leak.
|
||||
gManagerWindow = null;
|
||||
});
|
||||
|
||||
function imageBufferFromDataURI(encodedImageData) {
|
||||
let decodedImageData = atob(encodedImageData);
|
||||
return Uint8Array.from(decodedImageData, byte => byte.charCodeAt(0)).buffer;
|
||||
}
|
||||
const img =
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQImWNgYGBgAAAABQABh6FO1AAAAABJRU5ErkJggg==";
|
||||
const imageBuffer = imageBufferFromDataURI(img);
|
||||
|
||||
const id = "theme@mochi.test";
|
||||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
||||
function getThemeData(_id = id, manifest = {}, files = {}) {
|
||||
return {
|
||||
"manifest.json": {
|
||||
applications: {
|
||||
gecko: { id: _id },
|
||||
},
|
||||
manifest_version: 2,
|
||||
name: "atheme",
|
||||
description: "wow. such theme.",
|
||||
author: "Pixel Pusher",
|
||||
version: "1",
|
||||
theme: {},
|
||||
...manifest,
|
||||
},
|
||||
"preview.png": imageBuffer,
|
||||
...files,
|
||||
};
|
||||
}
|
||||
|
||||
async function init(startPage) {
|
||||
gManagerWindow = await open_manager(null);
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
return gCategoryUtilities.openType(startPage);
|
||||
}
|
||||
|
||||
add_task(async function testThemePreviewShown() {
|
||||
await init("theme");
|
||||
|
||||
await AddonTestUtils.promiseInstallXPI(getThemeData());
|
||||
let theme = await AddonManager.getAddonByID(id);
|
||||
|
||||
ok(theme.screenshots[0].url, "The add-on has a preview URL");
|
||||
let previewURL = theme.screenshots[0].url;
|
||||
|
||||
let doc = gManagerWindow.document;
|
||||
let item = doc.querySelector(`richlistitem[value="${id}"]`);
|
||||
|
||||
await BrowserTestUtils.waitForCondition(
|
||||
() =>
|
||||
item.getAttribute("status") == "installed" &&
|
||||
item.getAttribute("previewURL"),
|
||||
"Wait for the item to update to installed"
|
||||
);
|
||||
|
||||
is(
|
||||
item.getAttribute("previewURL"),
|
||||
previewURL,
|
||||
"The previewURL is set on the item"
|
||||
);
|
||||
let image = doc.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"theme-screenshot"
|
||||
);
|
||||
is(image.src, previewURL, "The previewURL is set on the image src");
|
||||
|
||||
item.click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
|
||||
image = doc.querySelector(".theme-screenshot");
|
||||
is(image.src, previewURL, "The previewURL is set on the detail image src");
|
||||
|
||||
// Now check that an add-on doesn't have a preview (bug 1519616).
|
||||
let extensionId = "extension@mochi.test";
|
||||
await AddonTestUtils.promiseInstallXPI({
|
||||
"manifest.json": {
|
||||
applications: {
|
||||
gecko: { id: extensionId },
|
||||
},
|
||||
manifest_version: 2,
|
||||
name: "anextension",
|
||||
description: "wow. such extension.",
|
||||
author: "Woof",
|
||||
version: "1",
|
||||
},
|
||||
});
|
||||
|
||||
await gCategoryUtilities.openType("extension");
|
||||
|
||||
// Go to the detail page.
|
||||
item = doc.querySelector(`richlistitem[value="${extensionId}"]`);
|
||||
item.click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
|
||||
// Check that the image has no src attribute.
|
||||
image = doc.querySelector(".theme-screenshot");
|
||||
ok(!image.src, "There is no preview for extensions");
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
await theme.uninstall();
|
||||
|
||||
let extension = await AddonManager.getAddonByID(extensionId);
|
||||
await extension.uninstall();
|
||||
});
|
||||
|
||||
add_task(async function testThemeOrdering() {
|
||||
// Install themes before loading the manager, if it's open they'll sort by install date.
|
||||
let themeId = id => id + "@mochi.test";
|
||||
let themeIds = [themeId(5), themeId(6), themeId(7), themeId(8)];
|
||||
await AddonTestUtils.promiseInstallXPI(
|
||||
getThemeData(themeId(6), { name: "BBB" })
|
||||
);
|
||||
await AddonTestUtils.promiseInstallXPI(
|
||||
getThemeData(themeId(7), { name: "CCC" })
|
||||
);
|
||||
await AddonTestUtils.promiseInstallXPI(
|
||||
getThemeData(themeId(5), { name: "AAA" }, { previewURL: "" })
|
||||
);
|
||||
await AddonTestUtils.promiseInstallXPI(
|
||||
getThemeData(themeId(8), { name: "DDD" })
|
||||
);
|
||||
|
||||
// Enable a theme to make sure it's first.
|
||||
let addon = await AddonManager.getAddonByID(themeId(8));
|
||||
addon.enable();
|
||||
|
||||
// Load themes now that the extensions are setup.
|
||||
await init("theme");
|
||||
|
||||
// Find the order of ids for the ones we installed.
|
||||
let list = gManagerWindow.document.getElementById("addon-list");
|
||||
let idOrder = list.itemChildren
|
||||
.map(row => row.getAttribute("value"))
|
||||
.filter(id => themeIds.includes(id));
|
||||
|
||||
// Check the order.
|
||||
Assert.deepEqual(
|
||||
idOrder,
|
||||
[
|
||||
themeId(8), // The active theme first.
|
||||
themeId(6),
|
||||
themeId(7), // With previews, ordered by name.
|
||||
themeId(5), // The theme without a preview last.
|
||||
],
|
||||
"Themes are ordered by enabled, previews, then name"
|
||||
);
|
||||
|
||||
// Ensure allow in private mode badge is hidden for themes.
|
||||
for (let item of list.itemChildren) {
|
||||
let badge = gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"privateBrowsing"
|
||||
);
|
||||
is_element_hidden(badge, `private browsing badge is hidden`);
|
||||
}
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
for (let addon of await promiseAddonsByIDs(themeIds)) {
|
||||
await addon.uninstall();
|
||||
}
|
||||
});
|
|
@ -1,513 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
// Tests that registering new types works
|
||||
|
||||
var gManagerWindow;
|
||||
var gCategoryUtilities;
|
||||
|
||||
var gProvider = {};
|
||||
|
||||
var gTypes = [
|
||||
new AddonManagerPrivate.AddonType(
|
||||
"type1",
|
||||
null,
|
||||
"Type 1",
|
||||
AddonManager.VIEW_TYPE_LIST,
|
||||
4500
|
||||
),
|
||||
new AddonManagerPrivate.AddonType("missing1", null, "Missing 1"),
|
||||
new AddonManagerPrivate.AddonType(
|
||||
"type2",
|
||||
null,
|
||||
"Type 1",
|
||||
AddonManager.VIEW_TYPE_LIST,
|
||||
5100,
|
||||
AddonManager.TYPE_UI_HIDE_EMPTY
|
||||
),
|
||||
{
|
||||
id: "type3",
|
||||
name: "Type 3",
|
||||
uiPriority: 5200,
|
||||
viewType: AddonManager.VIEW_TYPE_LIST,
|
||||
},
|
||||
];
|
||||
|
||||
// This test is testing XUL about:addons UI features that are not supported in the
|
||||
// HTML about:addons.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
function go_back(aManager) {
|
||||
gBrowser.goBack();
|
||||
}
|
||||
|
||||
function go_forward(aManager) {
|
||||
gBrowser.goForward();
|
||||
}
|
||||
|
||||
function check_state(canGoBack, canGoForward) {
|
||||
is(gBrowser.canGoBack, canGoBack, "canGoBack should be correct");
|
||||
is(gBrowser.canGoForward, canGoForward, "canGoForward should be correct");
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
function end_test() {
|
||||
finish();
|
||||
}
|
||||
|
||||
// Add a new type, open the manager and make sure it is in the right place
|
||||
add_test(async function() {
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
let aWindow = await open_manager(null);
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.get("type2"), "Type 2 should be present");
|
||||
ok(!gCategoryUtilities.get("missing1", true), "Missing 1 should be absent");
|
||||
|
||||
is(
|
||||
gCategoryUtilities.get("type1").previousSibling.getAttribute("value"),
|
||||
"addons://list/extension",
|
||||
"Type 1 should be in the right place"
|
||||
);
|
||||
is(
|
||||
gCategoryUtilities.get("type2").previousSibling.getAttribute("value"),
|
||||
"addons://list/theme",
|
||||
"Type 2 should be in the right place"
|
||||
);
|
||||
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
ok(!gCategoryUtilities.isTypeVisible("type2"), "Type 2 should be hidden");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Select the type, close the manager and remove it then open the manager and
|
||||
// check we're back to the default view
|
||||
add_test(async function() {
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await close_manager(gManagerWindow);
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
let aWindow = await open_manager(null);
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should be absent");
|
||||
ok(!gCategoryUtilities.get("type2", true), "Type 2 should be absent");
|
||||
ok(!gCategoryUtilities.get("missing1", true), "Missing 1 should be absent");
|
||||
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be back to the default view"
|
||||
);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Add a type while the manager is still open and check it appears
|
||||
add_test(async function() {
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should be absent");
|
||||
ok(!gCategoryUtilities.get("type2", true), "Type 2 should be absent");
|
||||
ok(!gCategoryUtilities.get("missing1", true), "Missing 1 should be absent");
|
||||
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.get("type2"), "Type 2 should be present");
|
||||
ok(!gCategoryUtilities.get("missing1", true), "Missing 1 should be absent");
|
||||
|
||||
is(
|
||||
gCategoryUtilities.get("type1").previousSibling.getAttribute("value"),
|
||||
"addons://list/extension",
|
||||
"Type 1 should be in the right place"
|
||||
);
|
||||
is(
|
||||
gCategoryUtilities.get("type2").previousSibling.getAttribute("value"),
|
||||
"addons://list/theme",
|
||||
"Type 2 should be in the right place"
|
||||
);
|
||||
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
ok(!gCategoryUtilities.isTypeVisible("type2"), "Type 2 should be hidden");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Remove the type while it is beng viewed and check it is replaced with the
|
||||
// default view
|
||||
add_test(async function() {
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"type1",
|
||||
"Should be showing the custom view"
|
||||
);
|
||||
check_state(true, true);
|
||||
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should be absent");
|
||||
ok(!gCategoryUtilities.get("type2", true), "Type 2 should be absent");
|
||||
ok(!gCategoryUtilities.get("missing1", true), "Missing 1 should be absent");
|
||||
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be back to the default view"
|
||||
);
|
||||
check_state(true, true);
|
||||
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be showing the extension view"
|
||||
);
|
||||
check_state(false, true);
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be back to the default view"
|
||||
);
|
||||
check_state(true, true);
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"plugin",
|
||||
"Should be back to the plugins view"
|
||||
);
|
||||
check_state(true, false);
|
||||
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be back to the default view"
|
||||
);
|
||||
check_state(true, true);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going back to a now missing category we skip it
|
||||
add_test(async function() {
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be back to the first view"
|
||||
);
|
||||
check_state(false, true);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going forward to a now missing category we skip it
|
||||
add_test(async function() {
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be back to the extension view"
|
||||
);
|
||||
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"plugin",
|
||||
"Should be back to the plugin view"
|
||||
);
|
||||
check_state(true, false);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going back to a now missing category and we can't go back any
|
||||
// any further then we just display the default view
|
||||
add_test(async function() {
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
let aWindow = await open_manager("addons://list/type1");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"type1",
|
||||
"Should be at the custom view"
|
||||
);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("extension");
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be at the default view"
|
||||
);
|
||||
check_state(false, true);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going forward to a now missing category and we can't go
|
||||
// forward any further then we just display the default view
|
||||
add_test(async function() {
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be at the extension view"
|
||||
);
|
||||
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be at the default view"
|
||||
);
|
||||
check_state(true, false);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going back we skip multiple missing categories
|
||||
add_test(async function() {
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("type3");
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be back to the first view"
|
||||
);
|
||||
check_state(false, true);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going forward we skip multiple missing categories
|
||||
add_test(async function() {
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("type3");
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
go_back(gManagerWindow);
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be back to the extension view"
|
||||
);
|
||||
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"plugin",
|
||||
"Should be back to the plugin view"
|
||||
);
|
||||
check_state(true, false);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going back we skip all missing categories and when we can't go
|
||||
// back any any further then we just display the default view
|
||||
add_test(async function() {
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
let aWindow = await open_manager("addons://list/type1");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"type1",
|
||||
"Should be at the custom view"
|
||||
);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type3");
|
||||
await gCategoryUtilities.openType("extension");
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be at the default view"
|
||||
);
|
||||
check_state(false, true);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
||||
|
||||
// Test that when going forward we skip all missing categories and when we can't
|
||||
// go back any any further then we just display the default view
|
||||
add_test(async function() {
|
||||
AddonManagerPrivate.registerProvider(gProvider, gTypes);
|
||||
|
||||
let aWindow = await open_manager("addons://list/extension");
|
||||
gManagerWindow = aWindow;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
|
||||
ok(gCategoryUtilities.get("type1"), "Type 1 should be present");
|
||||
ok(gCategoryUtilities.isTypeVisible("type1"), "Type 1 should be visible");
|
||||
|
||||
await gCategoryUtilities.openType("type1");
|
||||
await gCategoryUtilities.openType("type3");
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
go_back(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"Should be at the extension view"
|
||||
);
|
||||
|
||||
AddonManagerPrivate.unregisterProvider(gProvider);
|
||||
|
||||
ok(!gCategoryUtilities.get("type1", true), "Type 1 should not be present");
|
||||
|
||||
go_forward(gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"discover",
|
||||
"Should be at the default view"
|
||||
);
|
||||
check_state(true, false);
|
||||
|
||||
close_manager(gManagerWindow, run_next_test);
|
||||
});
|
|
@ -1,666 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var gManagerWindow;
|
||||
var gDocument;
|
||||
var gCategoryUtilities;
|
||||
var gProvider;
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons has its
|
||||
// own test files for these test cases).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
async function setup_manager(...args) {
|
||||
let aWindow = await open_manager(...args);
|
||||
gManagerWindow = aWindow;
|
||||
gDocument = gManagerWindow.document;
|
||||
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
|
||||
}
|
||||
|
||||
async function test() {
|
||||
requestLongerTimeout(2);
|
||||
waitForExplicitFinish();
|
||||
|
||||
gProvider = new MockProvider();
|
||||
|
||||
gProvider.createAddons([
|
||||
{
|
||||
id: "addon2@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 1",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon3@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 2",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon4@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 3",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon5@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 4",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon6@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 5",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon7@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 6",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon8@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 7",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
{
|
||||
id: "addon9@tests.mozilla.org",
|
||||
name: "Uninstall doesn't need restart 8",
|
||||
type: "extension",
|
||||
operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE,
|
||||
},
|
||||
]);
|
||||
|
||||
await setup_manager(null);
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
async function end_test() {
|
||||
await close_manager(gManagerWindow);
|
||||
finish();
|
||||
}
|
||||
|
||||
function get_item_in_list(aId, aList) {
|
||||
var item = aList.firstChild;
|
||||
while (item) {
|
||||
if ("mAddon" in item && item.mAddon.id == aId) {
|
||||
aList.ensureElementIsVisible(item);
|
||||
return item;
|
||||
}
|
||||
item = item.nextSibling;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Tests that uninstalling a restartless add-on from the list view can be undone
|
||||
add_test(async function() {
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
var button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
|
||||
ok(
|
||||
aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL,
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Tests that uninstalling a disabled restartless add-on from the list view can
|
||||
// be undone and doesn't re-enable
|
||||
add_test(async function() {
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
await aAddon.disable();
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
var button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
|
||||
ok(
|
||||
aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL,
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
await aAddon.enable();
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
async function test_uninstall_details(aAddon, ID) {
|
||||
is(
|
||||
get_current_view(gManagerWindow).id,
|
||||
"detail-view",
|
||||
"Should be in the detail view"
|
||||
);
|
||||
|
||||
var button = gDocument.getElementById("detail-uninstall-btn");
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
|
||||
ok(
|
||||
!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
// Tests that uninstalling a restartless add-on from the details view switches
|
||||
// back to the list view and can be undone
|
||||
add_test(async function() {
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
item.click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
|
||||
// Test the uninstall.
|
||||
return test_uninstall_details(aAddon, ID);
|
||||
});
|
||||
|
||||
// Tests that uninstalling a restartless add-on from directly loading the
|
||||
// details view switches back to the list view and can be undone
|
||||
add_test(async function() {
|
||||
// Close this about:addons and open a new one in a new tab.
|
||||
await close_manager(gManagerWindow);
|
||||
|
||||
// Load the detail view directly.
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
await setup_manager(`addons://detail/${ID}`);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
// Test the uninstall.
|
||||
return test_uninstall_details(aAddon, ID);
|
||||
});
|
||||
|
||||
// Tests that uninstalling a restartless add-on from the details view switches
|
||||
// back to the list view and can be undone and doesn't re-enable
|
||||
add_test(async function() {
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
await aAddon.disable();
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
item.click();
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
get_current_view(gManagerWindow).id,
|
||||
"detail-view",
|
||||
"Should be in the detail view"
|
||||
);
|
||||
|
||||
var button = gDocument.getElementById("detail-uninstall-btn");
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
await wait_for_view_load(gManagerWindow);
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
|
||||
ok(
|
||||
!!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
await aAddon.enable();
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Tests that switching away from the list view finalises the uninstall of
|
||||
// multiple restartless add-ons
|
||||
add_test(async function() {
|
||||
var ID = "addon2@tests.mozilla.org";
|
||||
var ID2 = "addon6@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
var button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
ok(
|
||||
aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL,
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
item = get_item_in_list(ID2, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
await gCategoryUtilities.openType("plugin");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"plugin",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let [bAddon, bAddon2] = await AddonManager.getAddonsByIDs([ID, ID2]);
|
||||
is(bAddon, null, "Add-on should no longer be installed");
|
||||
is(bAddon2, null, "Second add-on should no longer be installed");
|
||||
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
item = get_item_in_list(ID, list);
|
||||
is(item, null, "Should not have found the add-on in the list");
|
||||
item = get_item_in_list(ID2, list);
|
||||
is(item, null, "Should not have found the second add-on in the list");
|
||||
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
// Tests that closing the manager from the list view finalises the uninstall of
|
||||
// multiple restartless add-ons
|
||||
add_test(async function() {
|
||||
var ID = "addon4@tests.mozilla.org";
|
||||
var ID2 = "addon8@tests.mozilla.org";
|
||||
var list = gDocument.getElementById("addon-list");
|
||||
|
||||
// Select the extensions category
|
||||
await gCategoryUtilities.openType("extension");
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID(ID);
|
||||
ok(aAddon.isActive, "Add-on should be active");
|
||||
ok(
|
||||
!(
|
||||
aAddon.operationsRequiringRestart &
|
||||
AddonManager.OP_NEEDS_RESTART_UNINSTALL
|
||||
),
|
||||
"Add-on should not require a restart to uninstall"
|
||||
);
|
||||
ok(
|
||||
!(aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL),
|
||||
"Add-on should not be pending uninstall"
|
||||
);
|
||||
|
||||
var item = get_item_in_list(ID, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
var button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
// Force XBL to apply
|
||||
item.clientTop;
|
||||
|
||||
is(
|
||||
item.getAttribute("pending"),
|
||||
"uninstall",
|
||||
"Add-on should be uninstalling"
|
||||
);
|
||||
|
||||
ok(
|
||||
aAddon.pendingOperations & AddonManager.PENDING_UNINSTALL,
|
||||
"Add-on should be pending uninstall"
|
||||
);
|
||||
ok(!aAddon.isActive, "Add-on should be inactive");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(item, "anonid", "undo-btn");
|
||||
isnot(button, null, "Should have an undo button");
|
||||
|
||||
item = get_item_in_list(ID2, list);
|
||||
isnot(item, null, "Should have found the add-on in the list");
|
||||
|
||||
button = gDocument.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"remove-btn"
|
||||
);
|
||||
isnot(button, null, "Should have a remove button");
|
||||
ok(!button.disabled, "Button should not be disabled");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, {}, gManagerWindow);
|
||||
|
||||
await close_manager(gManagerWindow);
|
||||
let [bAddon, bAddon2] = await AddonManager.getAddonsByIDs([ID, ID2]);
|
||||
is(bAddon, null, "Add-on should no longer be installed");
|
||||
is(bAddon2, null, "Second add-on should no longer be installed");
|
||||
|
||||
await setup_manager(null);
|
||||
list = gDocument.getElementById("addon-list");
|
||||
|
||||
is(
|
||||
gCategoryUtilities.selectedCategory,
|
||||
"extension",
|
||||
"View should have changed to extension"
|
||||
);
|
||||
|
||||
item = get_item_in_list(ID, list);
|
||||
is(item, null, "Should not have found the add-on in the list");
|
||||
item = get_item_in_list(ID2, list);
|
||||
is(item, null, "Should not have found the second add-on in the list");
|
||||
|
||||
run_next_test();
|
||||
});
|
|
@ -9,33 +9,19 @@ var gManagerWindow;
|
|||
var gCategoryUtilities;
|
||||
|
||||
function getName(item) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return item.querySelector(".addon-name").textContent;
|
||||
}
|
||||
return gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"name"
|
||||
).textContent;
|
||||
return item.querySelector(".addon-name").textContent;
|
||||
}
|
||||
|
||||
async function getUpdateButton(item) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
let button = item.querySelector('[action="install-update"]');
|
||||
let panel = button.closest("panel-list");
|
||||
let shown = BrowserTestUtils.waitForEvent(panel, "shown");
|
||||
panel.show();
|
||||
await shown;
|
||||
return button;
|
||||
}
|
||||
return gManagerWindow.document.getAnonymousElementByAttribute(
|
||||
item,
|
||||
"anonid",
|
||||
"update-btn"
|
||||
);
|
||||
let button = item.querySelector('[action="install-update"]');
|
||||
let panel = button.closest("panel-list");
|
||||
let shown = BrowserTestUtils.waitForEvent(panel, "shown");
|
||||
panel.show();
|
||||
await shown;
|
||||
return button;
|
||||
}
|
||||
|
||||
async function test_updateid() {
|
||||
add_task(async function test_updateid() {
|
||||
// Close the existing about:addons tab and unrestier the existing MockProvider
|
||||
// instance if a previous failed test has not been able to clear them.
|
||||
if (gManagerWindow) {
|
||||
|
@ -97,24 +83,4 @@ async function test_updateid() {
|
|||
gManagerWindow = null;
|
||||
gProvider.unregister();
|
||||
gProvider = null;
|
||||
}
|
||||
|
||||
add_task(async function test_XUL_updateid() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
await test_updateid();
|
||||
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function test_HTML_updateid() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
await test_updateid();
|
||||
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
|
|
@ -66,36 +66,6 @@ add_task(async function test_addon_icon() {
|
|||
const extension = ExtensionTestUtils.loadExtension(extensionDefinition);
|
||||
await extension.startup();
|
||||
|
||||
info(`Testing XUL about:addons`);
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
await checkIconInView("addons://list/extension", "list", doc => {
|
||||
const addon = get_addon_element(doc.defaultView, id);
|
||||
const content = doc.getAnonymousElementByAttribute(
|
||||
addon,
|
||||
"class",
|
||||
"content-container"
|
||||
);
|
||||
return content.querySelector(".icon");
|
||||
});
|
||||
|
||||
await checkIconInView(
|
||||
"addons://detail/" + encodeURIComponent(id),
|
||||
"details",
|
||||
doc => {
|
||||
return doc.getElementById("detail-icon");
|
||||
}
|
||||
);
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
info(`Testing HTML about:addons`);
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
|
||||
await checkIconInView("addons://list/extension", "list", doc => {
|
||||
return get_addon_element(doc.defaultView, id).querySelector(".addon-icon");
|
||||
});
|
||||
|
@ -110,7 +80,5 @@ add_task(async function test_addon_icon() {
|
|||
}
|
||||
);
|
||||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
|
|
|
@ -16,26 +16,15 @@ AddonTestUtils.initMochitest(this);
|
|||
function get_test_items() {
|
||||
var items = {};
|
||||
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
for (let item of gManagerWindow
|
||||
.getHtmlBrowser()
|
||||
.contentDocument.querySelectorAll("addon-card")) {
|
||||
items[item.getAttribute("addon-id")] = item;
|
||||
}
|
||||
} else {
|
||||
for (let item of gManagerWindow.document.getElementById("addon-list")
|
||||
.childNodes) {
|
||||
items[item.mAddon.id] = item;
|
||||
}
|
||||
for (let item of gManagerWindow
|
||||
.getHtmlBrowser()
|
||||
.contentDocument.querySelectorAll("addon-card")) {
|
||||
items[item.getAttribute("addon-id")] = item;
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
function get(aId) {
|
||||
return gManagerWindow.document.getElementById(aId);
|
||||
}
|
||||
|
||||
function getHtmlElem(selector) {
|
||||
return gManagerWindow
|
||||
.getHtmlBrowser()
|
||||
|
@ -43,184 +32,88 @@ function getHtmlElem(selector) {
|
|||
}
|
||||
|
||||
function getPrivateBrowsingBadge(card) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return card.querySelector(".addon-badge-private-browsing-allowed");
|
||||
}
|
||||
return card.ownerDocument.getAnonymousElementByAttribute(
|
||||
card,
|
||||
"anonid",
|
||||
"privateBrowsing"
|
||||
);
|
||||
return card.querySelector(".addon-badge-private-browsing-allowed");
|
||||
}
|
||||
|
||||
function getPreferencesButtonAtListView(card) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return card.querySelector("panel-item[action='preferences']");
|
||||
}
|
||||
return card._preferencesBtn;
|
||||
return card.querySelector("panel-item[action='preferences']");
|
||||
}
|
||||
|
||||
function getPreferencesButtonAtDetailsView() {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return getHtmlElem("panel-item[action='preferences']");
|
||||
}
|
||||
return gManagerWindow.document.getElementById("detail-prefs-btn");
|
||||
return getHtmlElem("panel-item[action='preferences']");
|
||||
}
|
||||
|
||||
function isInlineOptionsVisible() {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
// The following button is used to open the inline options browser.
|
||||
return !getHtmlElem("named-deck-button[name='preferences']").hidden;
|
||||
}
|
||||
return !!gManagerWindow.document.getElementById("addon-options");
|
||||
// The following button is used to open the inline options browser.
|
||||
return !getHtmlElem("named-deck-button[name='preferences']").hidden;
|
||||
}
|
||||
|
||||
function getPrivateBrowsingValue() {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
return getHtmlElem("input[type='radio'][name='private-browsing']:checked")
|
||||
.value;
|
||||
}
|
||||
return gManagerWindow.document.getElementById("detail-privateBrowsing").value;
|
||||
return getHtmlElem("input[type='radio'][name='private-browsing']:checked")
|
||||
.value;
|
||||
}
|
||||
|
||||
async function setPrivateBrowsingValue(value) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
let radio = getHtmlElem(
|
||||
`input[type="radio"][name="private-browsing"][value="${value}"]`
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
radio,
|
||||
{ clickCount: 1 },
|
||||
radio.ownerGlobal
|
||||
);
|
||||
return TestUtils.waitForCondition(
|
||||
() => radio.checked,
|
||||
`Waiting for privateBrowsing=${value}`
|
||||
);
|
||||
}
|
||||
let privateBrowsing = gManagerWindow.document.getElementById(
|
||||
"detail-privateBrowsing"
|
||||
let radio = getHtmlElem(
|
||||
`input[type="radio"][name="private-browsing"][value="${value}"]`
|
||||
);
|
||||
EventUtils.synthesizeMouseAtCenter(
|
||||
radio,
|
||||
{ clickCount: 1 },
|
||||
radio.ownerGlobal
|
||||
);
|
||||
let radio = privateBrowsing.querySelector(`radio[value="${value}"]`);
|
||||
EventUtils.synthesizeMouseAtCenter(radio, { clickCount: 1 }, gManagerWindow);
|
||||
return TestUtils.waitForCondition(
|
||||
() => privateBrowsing.value == value,
|
||||
() => radio.checked,
|
||||
`Waiting for privateBrowsing=${value}`
|
||||
);
|
||||
}
|
||||
|
||||
// Check whether the private browsing inputs are visible in the details view.
|
||||
function checkIsModifiable(expected) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
getHtmlElem(".addon-detail-row-private-browsing"),
|
||||
"Private browsing should be visible"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
getHtmlElem(".addon-detail-row-private-browsing"),
|
||||
"Private browsing should be hidden"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-row"),
|
||||
getHtmlElem(".addon-detail-row-private-browsing"),
|
||||
"Private browsing should be visible"
|
||||
);
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-row-footer"),
|
||||
"Private browsing footer should be visible"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-row"),
|
||||
getHtmlElem(".addon-detail-row-private-browsing"),
|
||||
"Private browsing should be hidden"
|
||||
);
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-row-footer"),
|
||||
"Private browsing footer should be hidden"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing", expected);
|
||||
}
|
||||
|
||||
// Check whether the details view shows that private browsing is forcibly disallowed.
|
||||
function checkIsDisallowed(expected) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
getHtmlElem(".addon-detail-row-private-browsing-disallowed"),
|
||||
"Private browsing should be disallowed"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
getHtmlElem(".addon-detail-row-private-browsing-disallowed"),
|
||||
"Private browsing should not be disallowed"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-disallowed", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-disallowed"),
|
||||
getHtmlElem(".addon-detail-row-private-browsing-disallowed"),
|
||||
"Private browsing should be disallowed"
|
||||
);
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-disallowed-footer"),
|
||||
"Private browsing footer should be disallowed"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-disallowed"),
|
||||
getHtmlElem(".addon-detail-row-private-browsing-disallowed"),
|
||||
"Private browsing should not be disallowed"
|
||||
);
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-disallowed-footer"),
|
||||
"Private browsing footer should not be disallowed"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-disallowed", expected);
|
||||
}
|
||||
|
||||
// Check whether the details view shows that private browsing is forcibly allowed.
|
||||
function checkIsRequired(expected) {
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
getHtmlElem(".addon-detail-row-private-browsing-required"),
|
||||
"Private browsing should be required"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
getHtmlElem(".addon-detail-row-private-browsing-required"),
|
||||
"Private browsing should not be required"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-required", expected);
|
||||
return;
|
||||
}
|
||||
if (expected) {
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-required"),
|
||||
"Private required should be visible"
|
||||
);
|
||||
is_element_visible(
|
||||
get("detail-privateBrowsing-required-footer"),
|
||||
"Private required footer should be visible"
|
||||
getHtmlElem(".addon-detail-row-private-browsing-required"),
|
||||
"Private browsing should be required"
|
||||
);
|
||||
} else {
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-required"),
|
||||
"Private required should be hidden"
|
||||
);
|
||||
is_element_hidden(
|
||||
get("detail-privateBrowsing-required-footer"),
|
||||
"Private required footer should be hidden"
|
||||
getHtmlElem(".addon-detail-row-private-browsing-required"),
|
||||
"Private browsing should not be required"
|
||||
);
|
||||
}
|
||||
checkHelpRow(".addon-detail-row-private-browsing-required", expected);
|
||||
}
|
||||
|
||||
function checkHelpRow(selector, expected) {
|
||||
|
@ -249,7 +142,7 @@ add_task(function clearInitialTelemetry() {
|
|||
Services.telemetry.clearEvents();
|
||||
});
|
||||
|
||||
async function test_badge_and_toggle_incognito() {
|
||||
add_task(async function test_badge_and_toggle_incognito() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.allowPrivateBrowsingByDefault", false]],
|
||||
});
|
||||
|
@ -393,9 +286,9 @@ async function test_badge_and_toggle_incognito() {
|
|||
);
|
||||
|
||||
Services.prefs.clearUserPref("extensions.allowPrivateBrowsingByDefault");
|
||||
}
|
||||
});
|
||||
|
||||
async function test_addon_preferences_button() {
|
||||
add_task(async function test_addon_preferences_button() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.allowPrivateBrowsingByDefault", false]],
|
||||
});
|
||||
|
@ -468,18 +361,10 @@ async function test_addon_preferences_button() {
|
|||
};
|
||||
|
||||
const setAddonPrivateBrowsingAccess = async (id, allowPrivateBrowsing) => {
|
||||
let cardUpdatedPromise;
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
cardUpdatedPromise = BrowserTestUtils.waitForEvent(
|
||||
getHtmlElem("addon-card"),
|
||||
"update"
|
||||
);
|
||||
} else {
|
||||
cardUpdatedPromise = BrowserTestUtils.waitForEvent(
|
||||
gManagerWindow,
|
||||
"ViewChanged"
|
||||
);
|
||||
}
|
||||
const cardUpdatedPromise = BrowserTestUtils.waitForEvent(
|
||||
getHtmlElem("addon-card"),
|
||||
"update"
|
||||
);
|
||||
is(
|
||||
getPrivateBrowsingValue(),
|
||||
allowPrivateBrowsing ? "0" : "1",
|
||||
|
@ -510,14 +395,12 @@ async function test_addon_preferences_button() {
|
|||
allowPrivateBrowsing ? "added" : "removed"
|
||||
}`
|
||||
);
|
||||
if (gManagerWindow.useHtmlViews) {
|
||||
let badge = getPrivateBrowsingBadge(getHtmlElem("addon-card"));
|
||||
is(
|
||||
!badge.hidden,
|
||||
allowPrivateBrowsing,
|
||||
`Expected private browsing badge at ${id}`
|
||||
);
|
||||
}
|
||||
let badge = getPrivateBrowsingBadge(getHtmlElem("addon-card"));
|
||||
is(
|
||||
!badge.hidden,
|
||||
allowPrivateBrowsing,
|
||||
`Expected private browsing badge at ${id}`
|
||||
);
|
||||
};
|
||||
|
||||
const extensions = [];
|
||||
|
@ -574,14 +457,13 @@ async function test_addon_preferences_button() {
|
|||
// run tests in private and non-private windows.
|
||||
await runTest(true);
|
||||
await runTest(false);
|
||||
}
|
||||
});
|
||||
|
||||
async function test_addon_postinstall_incognito_hidden_checkbox(withHtmlViews) {
|
||||
add_task(async function test_addon_postinstall_incognito_hidden_checkbox() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.allowPrivateBrowsingByDefault", false],
|
||||
["extensions.langpacks.signatures.required", false],
|
||||
["extensions.htmlaboutaddons.enabled", withHtmlViews],
|
||||
],
|
||||
});
|
||||
|
||||
|
@ -708,9 +590,7 @@ async function test_addon_postinstall_incognito_hidden_checkbox(withHtmlViews) {
|
|||
// It is not possible to create a privileged add-on and install it, so just
|
||||
// simulate an installed privileged add-on and check the UI.
|
||||
await test_incognito_of_privileged_addons();
|
||||
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
}
|
||||
});
|
||||
|
||||
// Checks that the private browsing flag of privileged add-ons cannot be modified.
|
||||
async function test_incognito_of_privileged_addons() {
|
||||
|
@ -753,53 +633,3 @@ async function test_incognito_of_privileged_addons() {
|
|||
|
||||
provider.unregister();
|
||||
}
|
||||
|
||||
add_task(async function test_badge_and_toggle_incognito_on_XUL_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
await test_badge_and_toggle_incognito();
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function test_badge_and_toggle_incognito_on_HTML_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", true]],
|
||||
});
|
||||
await test_badge_and_toggle_incognito();
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function test_addon_preferences_button_on_XUL_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", false],
|
||||
["extensions.htmlaboutaddons.inline-options.enabled", false],
|
||||
],
|
||||
});
|
||||
await test_addon_preferences_button();
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(async function test_addon_preferences_button_on_HTML_aboutaddons() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["extensions.htmlaboutaddons.enabled", true],
|
||||
["extensions.htmlaboutaddons.inline-options.enabled", true],
|
||||
],
|
||||
});
|
||||
await test_addon_preferences_button();
|
||||
// No popPrefEnv because of bug 1557397.
|
||||
});
|
||||
|
||||
add_task(
|
||||
async function test_addon_postinstall_incognito_hidden_checkbox_on_XUL_aboutaddons() {
|
||||
await test_addon_postinstall_incognito_hidden_checkbox(false);
|
||||
}
|
||||
);
|
||||
|
||||
add_task(
|
||||
async function test_addon_postinstall_incognito_hidden_checkbox_on_HTML_aboutaddons() {
|
||||
await test_addon_postinstall_incognito_hidden_checkbox(true);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
ChromeUtils.import("resource://testing-common/ContentTask.jsm", {});
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons preferences
|
||||
// panel is already tested in browser_html_options_ui.js).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
// Wrapper to run a test that consists of:
|
||||
// 1. opening the add-ons manager viewing the list of extensions
|
||||
// 2. installing an extension (using the provider installer callable)
|
||||
// 3. opening the preferences panel for the new extension and verifying
|
||||
// that it opens cleanly
|
||||
async function runTest(installer) {
|
||||
let mgrWindow = await open_manager("addons://list/extension");
|
||||
|
||||
let { addon, id } = await installer();
|
||||
isnot(addon, null, "Extension is installed");
|
||||
|
||||
let element = get_addon_element(mgrWindow, id);
|
||||
element.parentNode.ensureElementIsVisible(element);
|
||||
|
||||
let button = mgrWindow.document.getAnonymousElementByAttribute(
|
||||
element,
|
||||
"anonid",
|
||||
"preferences-btn"
|
||||
);
|
||||
is_element_visible(button, "Preferences button should be visible");
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(button, { clickCount: 1 }, mgrWindow);
|
||||
|
||||
await TestUtils.topicObserved(
|
||||
AddonManager.OPTIONS_NOTIFICATION_DISPLAYED,
|
||||
(subject, data) => data == id
|
||||
);
|
||||
|
||||
is(
|
||||
mgrWindow.gViewController.currentViewId,
|
||||
`addons://detail/${encodeURIComponent(id)}/preferences`,
|
||||
"Current view should scroll to preferences"
|
||||
);
|
||||
|
||||
var browser = mgrWindow.document.querySelector(
|
||||
"#detail-grid > rows > stack > .inline-options-browser"
|
||||
);
|
||||
ok(browser, "Grid should have a browser descendant");
|
||||
is(browser.localName, "browser", "Grid should have a browser descendant");
|
||||
|
||||
var rows = browser.parentNode;
|
||||
|
||||
await ContentTask.spawn(browser, element.mAddon.optionsURL, async url => {
|
||||
await ContentTaskUtils.waitForCondition(
|
||||
() => content.location.href == url,
|
||||
"Browser has the expected options URL loaded"
|
||||
);
|
||||
});
|
||||
|
||||
is(
|
||||
browser.clientWidth,
|
||||
browser.parentNode.clientWidth,
|
||||
"Browser should be the same width as its direct parent"
|
||||
);
|
||||
is(
|
||||
browser.clientWidth,
|
||||
rows.clientWidth,
|
||||
"Browser should be the same width as its rows ancestor"
|
||||
);
|
||||
|
||||
button = mgrWindow.document.getElementById("detail-prefs-btn");
|
||||
is_element_hidden(button, "Preferences button should not be visible");
|
||||
|
||||
await close_manager(mgrWindow);
|
||||
|
||||
addon.uninstall();
|
||||
}
|
||||
|
||||
function promiseWebExtensionStartup() {
|
||||
const { Management } = ChromeUtils.import(
|
||||
"resource://gre/modules/Extension.jsm",
|
||||
null
|
||||
);
|
||||
|
||||
return new Promise(resolve => {
|
||||
let listener = (event, extension) => {
|
||||
Management.off("startup", listener);
|
||||
resolve(extension);
|
||||
};
|
||||
|
||||
Management.on("startup", listener);
|
||||
});
|
||||
}
|
||||
|
||||
// Test that deferred handling of optionsURL works for a signed webextension
|
||||
add_task(async function test_options_signed() {
|
||||
await runTest(async function() {
|
||||
// The extension in-tree is signed with this ID:
|
||||
const ID = "{9792932b-32b2-4567-998c-e7bf6c4c5e35}";
|
||||
|
||||
await Promise.all([
|
||||
promiseWebExtensionStartup(),
|
||||
install_addon("addons/options_signed.xpi"),
|
||||
]);
|
||||
let addon = await promiseAddonByID(ID);
|
||||
|
||||
return { addon, id: ID };
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_options_temporary() {
|
||||
await runTest(async function() {
|
||||
let dir = get_addon_file_url("options_signed").file;
|
||||
let [addon] = await Promise.all([
|
||||
AddonManager.installTemporaryAddon(dir),
|
||||
promiseWebExtensionStartup(),
|
||||
]);
|
||||
isnot(addon, null, "Extension is installed (temporarily)");
|
||||
|
||||
return { addon, id: addon.id };
|
||||
});
|
||||
});
|
|
@ -1,126 +0,0 @@
|
|||
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set sts=2 sw=2 et tw=80: */
|
||||
"use strict";
|
||||
|
||||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
);
|
||||
const { ExtensionParent } = ChromeUtils.import(
|
||||
"resource://gre/modules/ExtensionParent.jsm"
|
||||
);
|
||||
|
||||
// This test is testing XUL about:addons UI (the HTML about:addons options page
|
||||
// is tested by the testCardRerender test in browser_html_options_ui.js).
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [["extensions.htmlaboutaddons.enabled", false]],
|
||||
});
|
||||
|
||||
// This test function helps to detect when an addon options browser have been inserted
|
||||
// in the about:addons page.
|
||||
function waitOptionsBrowserInserted() {
|
||||
return new Promise(resolve => {
|
||||
async function listener(eventName, browser) {
|
||||
// wait for a webextension XUL browser element that is owned by the "about:addons" page.
|
||||
if (browser.ownerDocument.location.href == "about:addons") {
|
||||
ExtensionParent.apiManager.off("extension-browser-inserted", listener);
|
||||
|
||||
resolve(browser);
|
||||
}
|
||||
}
|
||||
ExtensionParent.apiManager.on("extension-browser-inserted", listener);
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function test_options_on_addon_reload() {
|
||||
const ID = "@test-options-on-addon-reload";
|
||||
|
||||
function backgroundScript() {
|
||||
const { browser } = window;
|
||||
browser.runtime.openOptionsPage();
|
||||
}
|
||||
|
||||
let extensionDefinition = {
|
||||
useAddonManager: "temporary",
|
||||
|
||||
manifest: {
|
||||
options_ui: {
|
||||
page: "options.html",
|
||||
},
|
||||
applications: {
|
||||
gecko: {
|
||||
id: ID,
|
||||
},
|
||||
},
|
||||
},
|
||||
files: {
|
||||
"options.html": `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
Extension Options UI
|
||||
</body>
|
||||
</html>`,
|
||||
},
|
||||
background: backgroundScript,
|
||||
};
|
||||
|
||||
await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:addons");
|
||||
|
||||
const extension = ExtensionTestUtils.loadExtension(extensionDefinition);
|
||||
|
||||
const onceOptionsBrowserInserted = waitOptionsBrowserInserted();
|
||||
|
||||
await extension.startup();
|
||||
|
||||
info("Wait for the options_ui page XUL browser to be created");
|
||||
await onceOptionsBrowserInserted;
|
||||
|
||||
const aboutAddonsDocument = gBrowser.selectedBrowser.contentDocument;
|
||||
|
||||
Assert.equal(
|
||||
aboutAddonsDocument.location.href,
|
||||
"about:addons",
|
||||
"The about:addons page is the currently selected tab"
|
||||
);
|
||||
|
||||
const optionsBrowsers = aboutAddonsDocument.querySelectorAll(
|
||||
"#addon-options"
|
||||
);
|
||||
Assert.equal(
|
||||
optionsBrowsers.length,
|
||||
1,
|
||||
"Got a single XUL browser for the addon options_ui page"
|
||||
);
|
||||
|
||||
// Reload the addon five times in a row, and then check that there is still one addon options browser.
|
||||
|
||||
let addon = await AddonManager.getAddonByID(ID);
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const onceOptionsReloaded = Promise.all([
|
||||
AddonTestUtils.promiseWebExtensionStartup(),
|
||||
waitOptionsBrowserInserted(),
|
||||
]);
|
||||
|
||||
await addon.reload();
|
||||
|
||||
info("Wait for the new options_ui page XUL browser to be created");
|
||||
await onceOptionsReloaded;
|
||||
|
||||
let optionsBrowsers = aboutAddonsDocument.querySelectorAll(
|
||||
"#addon-options"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
optionsBrowsers.length,
|
||||
1,
|
||||
"Got a single XUL browser for the addon options_ui page"
|
||||
);
|
||||
}
|
||||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
|
||||
await extension.unload();
|
||||
});
|
|
@ -248,63 +248,23 @@ function run_next_test() {
|
|||
}
|
||||
|
||||
var get_tooltip_info = async function(addonEl, managerWindow) {
|
||||
if (managerWindow && managerWindow.useHtmlViews) {
|
||||
// Extract from title attribute.
|
||||
const { addon } = addonEl;
|
||||
const name = addon.name;
|
||||
const nameEl = addonEl.querySelector(".addon-name");
|
||||
// Extract from title attribute.
|
||||
const { addon } = addonEl;
|
||||
const name = addon.name;
|
||||
const nameEl = addonEl.querySelector(".addon-name");
|
||||
|
||||
let nameWithVersion = nameEl.title;
|
||||
if (addonEl.addon.userDisabled) {
|
||||
// TODO - Bug 1558077: Currently Fluent is clearing the addon title
|
||||
// when the addon is disabled, fixing it requires changes to the
|
||||
// HTML about:addons localized strings, and then remove this
|
||||
// workaround.
|
||||
nameWithVersion = `${name} ${addon.version}`;
|
||||
}
|
||||
|
||||
return {
|
||||
name,
|
||||
version: nameWithVersion.substring(name.length + 1),
|
||||
};
|
||||
let nameWithVersion = nameEl.title;
|
||||
if (addonEl.addon.userDisabled) {
|
||||
// TODO - Bug 1558077: Currently Fluent is clearing the addon title
|
||||
// when the addon is disabled, fixing it requires changes to the
|
||||
// HTML about:addons localized strings, and then remove this
|
||||
// workaround.
|
||||
nameWithVersion = `${name} ${addon.version}`;
|
||||
}
|
||||
|
||||
// Retrieve the tooltip from the XUL about:addons view,
|
||||
// the popup code uses a triggering event's target to set the
|
||||
// document.tooltipNode property.
|
||||
let doc = addonEl.ownerDocument;
|
||||
let nameNode = doc.getAnonymousElementByAttribute(addonEl, "anonid", "name");
|
||||
let event = new doc.ownerGlobal.CustomEvent("TriggerEvent");
|
||||
nameNode.dispatchEvent(event);
|
||||
|
||||
let tooltip = doc.getElementById("addonitem-tooltip");
|
||||
|
||||
let promise = BrowserTestUtils.waitForEvent(tooltip, "popupshown");
|
||||
tooltip.openPopup(nameNode, "after_start", 0, 0, false, false, event);
|
||||
await promise;
|
||||
|
||||
let tiptext = tooltip.label;
|
||||
|
||||
promise = BrowserTestUtils.waitForEvent(tooltip, "popuphidden");
|
||||
tooltip.hidePopup();
|
||||
await promise;
|
||||
|
||||
let expectedName = addonEl.getAttribute("name");
|
||||
is(
|
||||
tiptext.substring(0, expectedName.length),
|
||||
expectedName,
|
||||
"Tooltip should always start with the expected name"
|
||||
);
|
||||
|
||||
if (expectedName.length == tiptext.length) {
|
||||
return {
|
||||
name: tiptext,
|
||||
version: undefined,
|
||||
};
|
||||
}
|
||||
return {
|
||||
name: tiptext.substring(0, expectedName.length),
|
||||
version: tiptext.substring(expectedName.length + 1),
|
||||
name,
|
||||
version: nameWithVersion.substring(name.length + 1),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -371,28 +331,8 @@ function check_all_in_list(aManager, aIds, aIgnoreExtras) {
|
|||
}
|
||||
|
||||
function get_addon_element(aManager, aId) {
|
||||
if (aManager.useHtmlViews) {
|
||||
const doc = aManager.getHtmlBrowser().contentDocument;
|
||||
return doc.querySelector(`addon-card[addon-id="${aId}"]`);
|
||||
}
|
||||
|
||||
const doc = aManager.document;
|
||||
const view = get_current_view(aManager);
|
||||
let listid = "addon-list";
|
||||
if (view.id == "updates-view") {
|
||||
listid = "updates-list";
|
||||
}
|
||||
const list = doc.getElementById(listid);
|
||||
|
||||
let node = list.firstChild;
|
||||
while (node) {
|
||||
if (node.value == aId) {
|
||||
return node;
|
||||
}
|
||||
node = node.nextSibling;
|
||||
}
|
||||
|
||||
return null;
|
||||
const doc = aManager.getHtmlBrowser().contentDocument;
|
||||
return doc.querySelector(`addon-card[addon-id="${aId}"]`);
|
||||
}
|
||||
|
||||
function wait_for_view_load(
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
--green-90: #003706;
|
||||
--orange-50: #ff9400;
|
||||
--purple-70: #6200a4;
|
||||
--purple-70-a40: rgba(98, 0, 164, 0.4);
|
||||
--red-50: #ff0039;
|
||||
--red-50-a30: rgba(255, 0, 57, 0.3);
|
||||
--red-60: #d70022;
|
||||
|
|
Загрузка…
Ссылка в новой задаче