Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merge mozilla-central to autoland.
Browse files Browse the repository at this point in the history
  • Loading branch information
CosminSabou committed Jul 11, 2019
2 parents 361d486 + 1d625b7 commit 9af9ddf
Show file tree
Hide file tree
Showing 90 changed files with 968 additions and 14,529 deletions.
1 change: 0 additions & 1 deletion browser/base/content/test/webextensions/browser.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down Expand Up @@ -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 });
});
Original file line number Diff line number Diff line change
Expand Up @@ -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));

This file was deleted.

34 changes: 11 additions & 23 deletions browser/base/content/test/webextensions/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
Loading

0 comments on commit 9af9ddf

Please sign in to comment.