--- a/testing/profiles/common/user.js
+++ b/testing/profiles/common/user.js
@@ -79,18 +79,16 @@ user_pref("browser.tabs.disableBackgroun
// Only load extensions from the application and user profile
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
user_pref("extensions.enabledScopes", 5);
user_pref("extensions.autoDisableScopes", 0);
// Disable metadata caching for installed add-ons by default
user_pref("extensions.getAddons.cache.enabled", false);
// Disable intalling any distribution add-ons
user_pref("extensions.installDistroAddons", false);
-// XPI extensions are required for test harnesses to load
-user_pref("extensions.defaultProviders.enabled", true);
user_pref("xpinstall.signatures.required", false);
user_pref("extensions.legacy.enabled", true);
user_pref("geo.wifi.uri", "http://{server}/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs");
user_pref("geo.wifi.timeToWaitBeforeSending", 2000);
user_pref("geo.wifi.scan", false);
user_pref("geo.wifi.logging.enabled", true);
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -18,17 +18,16 @@ if ("@mozilla.org/xre/app-info;1" in Cc)
}
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
Cu.importGlobalProperties(["DOMParser", "Element"]);
const MOZ_COMPATIBILITY_NIGHTLY = !["aurora", "beta", "release", "esr"].includes(AppConstants.MOZ_UPDATE_CHANNEL);
const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion";
-const PREF_DEFAULT_PROVIDERS_ENABLED = "extensions.defaultProviders.enabled";
const PREF_EM_UPDATE_ENABLED = "extensions.update.enabled";
const PREF_EM_LAST_APP_VERSION = "extensions.lastAppVersion";
const PREF_EM_LAST_PLATFORM_VERSION = "extensions.lastPlatformVersion";
const PREF_EM_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
const PREF_EM_STRICT_COMPATIBILITY = "extensions.strictCompatibility";
const PREF_EM_CHECK_UPDATE_SECURITY = "extensions.checkUpdateSecurity";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
const PREF_APP_UPDATE_AUTO = "app.update.auto";
@@ -758,38 +757,33 @@ var AddonManagerInternal = {
gAutoUpdateDefault);
Services.prefs.addObserver(PREF_EM_AUTOUPDATE_DEFAULT, this);
gWebExtensionsMinPlatformVersion =
Services.prefs.getCharPref(PREF_MIN_WEBEXT_PLATFORM_VERSION,
gWebExtensionsMinPlatformVersion);
Services.prefs.addObserver(PREF_MIN_WEBEXT_PLATFORM_VERSION, this);
- let defaultProvidersEnabled = Services.prefs.getBoolPref(PREF_DEFAULT_PROVIDERS_ENABLED, true);
- AddonManagerPrivate.recordSimpleMeasure("default_providers", defaultProvidersEnabled);
-
// Ensure all default providers have had a chance to register themselves
- if (defaultProvidersEnabled) {
- for (let url of DEFAULT_PROVIDERS) {
- try {
- let scope = {};
- ChromeUtils.import(url, scope);
- // Sanity check - make sure the provider exports a symbol that
- // has a 'startup' method
- let syms = Object.keys(scope);
- if ((syms.length < 1) ||
- (typeof scope[syms[0]].startup != "function")) {
- logger.warn("Provider " + url + " has no startup()");
- AddonManagerPrivate.recordException("AMI", "provider " + url, "no startup()");
- }
- logger.debug("Loaded provider scope for " + url + ": " + Object.keys(scope).toSource());
- } catch (e) {
- AddonManagerPrivate.recordException("AMI", "provider " + url + " load failed", e);
- logger.error("Exception loading default provider \"" + url + "\"", e);
+ for (let url of DEFAULT_PROVIDERS) {
+ try {
+ let scope = {};
+ ChromeUtils.import(url, scope);
+ // Sanity check - make sure the provider exports a symbol that
+ // has a 'startup' method
+ let syms = Object.keys(scope);
+ if ((syms.length < 1) ||
+ (typeof scope[syms[0]].startup != "function")) {
+ logger.warn("Provider " + url + " has no startup()");
+ AddonManagerPrivate.recordException("AMI", "provider " + url, "no startup()");
}
+ logger.debug("Loaded provider scope for " + url + ": " + Object.keys(scope).toSource());
+ } catch (e) {
+ AddonManagerPrivate.recordException("AMI", "provider " + url + " load failed", e);
+ logger.error("Exception loading default provider \"" + url + "\"", e);
}
}
// Load any providers registered in the category manager
let catman = Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager);
let entries = catman.enumerateCategory(CATEGORY_PROVIDER_MODULE);
while (entries.hasMoreElements()) {
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -67,17 +67,16 @@ ChromeUtils.defineModuleGetter(this, "Pr
ChromeUtils.defineModuleGetter(this, "TestUtils",
"resource://testing-common/TestUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "aomStartup",
"@mozilla.org/addons/addon-manager-startup;1",
"amIAddonManagerStartup");
const {
- awaitPromise,
createAppInfo,
createHttpServer,
createInstallRDF,
createTempWebExtensionFile,
createUpdateRDF,
getFileForAddon,
manuallyInstall,
manuallyUninstall,
@@ -662,41 +661,16 @@ function do_check_compatibilityoverride(
}
function do_check_icons(aActual, aExpected) {
for (var size in aExpected) {
Assert.equal(aActual[size], aExpected[size]);
}
}
-function startupManager() {
- // promiseStartupManager() does not actually do any asynchronous
- // work so we don't need to wait for it here. Unfortunately, wrapping
- // this wait awaitPromise() creates other unrelated failures, rather
- // than going through those we should just get rid of this wrapper,
- // see bug 1459998.
- promiseStartupManager();
-}
-
-/**
- * Restarts the add-on manager as if the host application was restarted.
- *
- * @param aNewVersion
- * An optional new version to use for the application. Passing this
- * will change nsIXULAppInfo.version and make the startup appear as if
- * the application version has changed.
- */
-function restartManager(aNewVersion) {
- awaitPromise(promiseRestartManager(aNewVersion));
-}
-
-function shutdownManager() {
- awaitPromise(promiseShutdownManager());
-}
-
function isThemeInAddonsList(aDir, aId) {
return AddonTestUtils.addonsList.hasTheme(aDir, aId);
}
function isExtensionInAddonsList(aDir, aId) {
return AddonTestUtils.addonsList.hasExtension(aDir, aId);
}
@@ -726,19 +700,16 @@ function check_startup_changes(aType, aI
* @param aDir
* The directory to add the install.rdf to
* @param aId
* An optional string to override the default installation aId
* @param aExtraFile
* An optional dummy file to create in the directory
* @return An nsIFile for the directory in which the add-on is installed.
*/
-function writeInstallRDFToDir(aData, aDir, aId = aData.id, aExtraFile = null) {
- return awaitPromise(promiseWriteInstallRDFToDir(aData, aDir, aId, aExtraFile));
-}
async function promiseWriteInstallRDFToDir(aData, aDir, aId = aData.id, aExtraFile = null) {
let files = {
"install.rdf": AddonTestUtils.createInstallRDF(aData),
};
if (typeof aExtraFile === "object")
Object.assign(files, aExtraFile);
else
files[aExtraFile] = "";
@@ -762,17 +733,17 @@ async function promiseWriteInstallRDFToD
* @param aDir
* The install directory to add the extension to
* @param aId
* An optional string to override the default installation aId
* @param aExtraFile
* An optional dummy file to create in the extension
* @return A file pointing to where the extension was installed
*/
-function writeInstallRDFToXPI(aData, aDir, aId = aData.id, aExtraFile = null) {
+async function promiseWriteInstallRDFToXPI(aData, aDir, aId = aData.id, aExtraFile = null) {
let files = {
"install.rdf": AddonTestUtils.createInstallRDF(aData),
};
if (typeof aExtraFile === "object")
Object.assign(files, aExtraFile);
else
if (aExtraFile)
files[aExtraFile] = "";
@@ -782,19 +753,16 @@ function writeInstallRDFToXPI(aData, aDi
var file = aDir.clone();
file.append(`${aId}.xpi`);
AddonTestUtils.writeFilesToZip(file.path, files);
return file;
}
-async function promiseWriteInstallRDFToXPI(aData, aDir, aId = aData.id, aExtraFile = null) {
- return writeInstallRDFToXPI(aData, aDir, aId, aExtraFile);
-}
/**
* Writes an install.rdf manifest into an extension using the properties passed
* in a JS object. The objects should contain a property for each property to
* appear in the RDF. The object may contain an array of objects with id,
* minVersion and maxVersion in the targetApplications property to give target
* application compatibility.
*
@@ -803,23 +771,16 @@ async function promiseWriteInstallRDFToX
* @param aDir
* The install directory to add the extension to
* @param aId
* An optional string to override the default installation aId
* @param aExtraFile
* An optional dummy file to create in the extension
* @return A file pointing to where the extension was installed
*/
-function writeInstallRDFForExtension(aData, aDir, aId, aExtraFile) {
- if (TEST_UNPACKED) {
- return writeInstallRDFToDir(aData, aDir, aId, aExtraFile);
- }
- return writeInstallRDFToXPI(aData, aDir, aId, aExtraFile);
-}
-
function promiseWriteInstallRDFForExtension(aData, aDir, aId, aExtraFile) {
if (TEST_UNPACKED) {
return promiseWriteInstallRDFToDir(aData, aDir, aId, aExtraFile);
}
return promiseWriteInstallRDFToXPI(aData, aDir, aId, aExtraFile);
}
/**
@@ -1266,24 +1227,16 @@ async function saveJSON(aData, aFile) {
function callback_soon(aFunction) {
return function(...args) {
executeSoon(function() {
aFunction.apply(null, args);
}, aFunction.name ? "delayed callback " + aFunction.name : "delayed callback");
};
}
-function writeProxyFileToDir(aDir, aAddon, aId) {
- awaitPromise(promiseWriteProxyFileToDir(aDir, aAddon, aId));
-
- let file = aDir.clone();
- file.append(aId);
- return file;
-}
-
async function serveSystemUpdate(xml, perform_update, testserver) {
testserver.registerPathHandler("/data/update.xml", (request, response) => {
response.write(xml);
});
try {
await perform_update();
} finally {
@@ -1500,31 +1453,31 @@ async function getSystemAddonDirectories
* @param {nsIFile} distroDir - the system add-on distribution directory (the "features" dir in the app directory)
*/
async function setupSystemAddonConditions(setup, distroDir) {
info("Clearing existing database.");
Services.prefs.clearUserPref(PREF_SYSTEM_ADDON_SET);
distroDir.leafName = "empty";
let updateList = [];
- awaitPromise(overrideBuiltIns({ "system": updateList }));
+ await overrideBuiltIns({ "system": updateList });
await promiseStartupManager();
await promiseShutdownManager();
info("Setting up conditions.");
await setup.setup();
if (distroDir) {
if (distroDir.path.endsWith("hidden")) {
updateList = ["system1@tests.mozilla.org", "system2@tests.mozilla.org"];
} else if (distroDir.path.endsWith("prefilled")) {
updateList = ["system2@tests.mozilla.org", "system3@tests.mozilla.org"];
}
}
- awaitPromise(overrideBuiltIns({ "system": updateList }));
+ await overrideBuiltIns({ "system": updateList });
await promiseStartupManager();
// Make sure the initial state is correct
info("Checking initial state.");
await checkInstalledSystemAddons(setup.initialState, distroDir);
}
/**
@@ -1571,17 +1524,17 @@ async function verifySystemAddonState(in
if (distroDir) {
if (distroDir.path.endsWith("hidden")) {
updateList = ["system1@tests.mozilla.org", "system2@tests.mozilla.org"];
} else if (distroDir.path.endsWith("prefilled")) {
updateList = ["system2@tests.mozilla.org", "system3@tests.mozilla.org"];
}
}
- awaitPromise(overrideBuiltIns({ "system": updateList }));
+ await overrideBuiltIns({ "system": updateList });
await promiseStartupManager();
await checkInstalledSystemAddons(finalState, distroDir);
}
/**
* Run system add-on tests and compare the results against a set of expected conditions.
*
* @param {String} setupName - name of the current setup conditions.
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
@@ -1,16 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
-startupManager();
add_task(async function() {
+ await promiseStartupManager();
+
let sawInstall = false;
Services.obs.addObserver(function() {
sawInstall = true;
}, "addon-install");
await promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]);
ok(sawInstall);
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_default_providers_pref.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// Tests the extensions.defaultProviders.enabled pref which turns
-// off the default XPIProvider and LightweightThemeManager.
-
-async function run_test() {
- Services.prefs.setBoolPref("extensions.defaultProviders.enabled", false);
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
- await promiseStartupManager();
- Assert.ok(!AddonManager.isInstallEnabled("application/x-xpinstall"));
- Services.prefs.clearUserPref("extensions.defaultProviders.enabled");
-}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_dependencies.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_dependencies.js
@@ -1,17 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const profileDir = gProfD.clone();
profileDir.append("extensions");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
-startupManager();
const BOOTSTRAP = String.raw`
Components.utils.import("resource://gre/modules/Services.jsm");
function startup(data) {
Services.obs.notifyObservers(null, "test-addon-bootstrap-startup", data.id);
}
function shutdown(data) {
@@ -41,16 +40,18 @@ const ADDONS = [
dependencies: ["addon2@dependency-test.mozilla.org"],
},
];
let addonFiles = [];
let events = [];
add_task(async function setup() {
+ await promiseStartupManager();
+
let startupObserver = (subject, topic, data) => {
events.push(["startup", data]);
};
let shutdownObserver = (subject, topic, data) => {
events.push(["shutdown", data]);
};
Services.obs.addObserver(startupObserver, "test-addon-bootstrap-startup");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_from_sources.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_from_sources.js
@@ -1,28 +1,29 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const ID = "bootstrap1@tests.mozilla.org";
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
BootstrapMonitor.init();
// Partial list of bootstrap reasons from XPIProvider.jsm
const BOOTSTRAP_REASONS = {
ADDON_INSTALL: 5,
ADDON_UPGRADE: 7,
ADDON_DOWNGRADE: 8,
};
// Install an unsigned add-on with no existing add-on present.
// Restart and make sure it is still around.
add_task(async function() {
+ await promiseStartupManager();
+
let extInstallCalled = false;
AddonManager.addInstallListener({
onExternalInstall: (aInstall) => {
Assert.equal(aInstall.id, ID);
Assert.equal(aInstall.version, "1.0");
extInstallCalled = true;
},
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_legacy.js
@@ -1,15 +1,16 @@
const LEGACY_PREF = "extensions.legacy.enabled";
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
-startupManager();
add_task(async function test_disable() {
+ await promiseStartupManager();
+
let legacy = [
{
id: "bootstrap@tests.mozilla.org",
name: "Bootstrap add-on",
version: "1.0",
bootstrap: true,
},
];
--- a/toolkit/mozapps/extensions/test/xpcshell/test_pass_symbol.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_pass_symbol.js
@@ -3,22 +3,23 @@
*/
const PASS_PREF = "symboltest.instanceid.pass";
const FAIL_BOGUS_PREF = "symboltest.instanceid.fail_bogus";
const FAIL_ID_PREF = "symboltest.instanceid.fail_bogus";
const ADDON_ID = "test_symbol@tests.mozilla.org";
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
BootstrapMonitor.init();
// symbol is passed when add-on is installed
add_task(async function() {
+ await promiseStartupManager();
+
PromiseTestUtils.expectUncaughtRejection(/no addon found for symbol/);
for (let pref of [PASS_PREF, FAIL_BOGUS_PREF, FAIL_ID_PREF])
Services.prefs.clearUserPref(pref);
await promiseInstallAllFiles([do_get_addon("test_symbol")], true);
let addon = await promiseAddonByID(ADDON_ID);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_proxy.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_proxy.js
@@ -1,21 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const ID = "proxy1@tests.mozilla.org";
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
BootstrapMonitor.init();
// Ensure that a proxy file to an add-on with a valid manifest works.
add_task(async function() {
+ await promiseStartupManager();
+
let tempdir = gTmpD.clone();
await promiseWriteInstallRDFToDir({
id: ID,
version: "1.0",
bootstrap: true,
unpack: true,
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js
@@ -5,22 +5,23 @@
BootstrapMonitor.init();
const PREF_DB_SCHEMA = "extensions.databaseSchema";
const profileDir = gProfD.clone();
profileDir.append("extensions");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "49");
-startupManager();
/**
* Schema change with no application update reloads metadata.
*/
add_task(async function schema_change() {
+ await promiseStartupManager();
+
const ID = "schema-change@tests.mozilla.org";
let xpiFile = createTempXPIFile({
id: ID,
name: "Test Add-on",
version: "1.0",
bootstrap: true,
targetApplications: [{
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_repository.js
@@ -22,17 +22,17 @@ add_task(async function test_app_addons(
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, `http://localhost:${gServer.identity.primaryPort}/get?%IDS%`);
Services.prefs.setCharPref(PREF_COMPAT_OVERRIDES, `http://localhost:${gServer.identity.primaryPort}/get?%IDS%`);
gServer.registerPathHandler("/get", (request, response) => {
do_throw("Unexpected request to server.");
});
- awaitPromise(overrideBuiltIns({ "system": ["system1@tests.mozilla.org", "system2@tests.mozilla.org", "system3@tests.mozilla.org"] }));
+ await overrideBuiltIns({ "system": ["system1@tests.mozilla.org", "system2@tests.mozilla.org", "system3@tests.mozilla.org"] });
await promiseStartupManager();
await AddonRepository.cacheAddons(["system1@tests.mozilla.org",
"system2@tests.mozilla.org",
"system3@tests.mozilla.org"]);
let cached = await AddonRepository.getCachedAddonByID("system1@tests.mozilla.org");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_blank.js
@@ -102,17 +102,17 @@ const TESTS = {
// Test that a blank response does nothing
blank: {
updateList: null,
}
};
add_task(async function setup() {
// Initialise the profile
- awaitPromise(overrideBuiltIns({ "system": [] }));
+ await overrideBuiltIns({ "system": [] });
await promiseStartupManager();
await promiseShutdownManager();
});
add_task(async function() {
for (let setupName of Object.keys(TEST_CONDITIONS)) {
for (let testName of Object.keys(TESTS)) {
info("Running test " + setupName + " " + testName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_checkSizeHash.js
@@ -136,17 +136,17 @@ const TESTS = {
{ isUpgrade: true, version: "1.0"}
]
}
}
};
add_task(async function setup() {
// Initialise the profile
- awaitPromise(overrideBuiltIns({ "system": [] }));
+ await overrideBuiltIns({ "system": [] });
await promiseStartupManager();
await promiseShutdownManager();
});
add_task(async function() {
for (let setupName of Object.keys(TEST_CONDITIONS)) {
for (let testName of Object.keys(TESTS)) {
info("Running test " + setupName + " " + testName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_newset.js
@@ -135,17 +135,17 @@ const TESTS = {
{ isUpgrade: true, version: "1.0"}
]
}
}
};
add_task(async function setup() {
// Initialise the profile
- awaitPromise(overrideBuiltIns({ "system": [] }));
+ await overrideBuiltIns({ "system": [] });
await promiseStartupManager();
await promiseShutdownManager();
});
add_task(async function() {
for (let setupName of Object.keys(TEST_CONDITIONS)) {
for (let testName of Object.keys(TESTS)) {
info("Running test " + setupName + " " + testName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_overlapping.js
@@ -137,17 +137,17 @@ const TESTS = {
{ isUpgrade: false, version: null}
]
}
}
};
add_task(async function setup() {
// Initialise the profile
- awaitPromise(overrideBuiltIns({ "system": [] }));
+ await overrideBuiltIns({ "system": [] });
await promiseStartupManager();
await promiseShutdownManager();
});
add_task(async function() {
for (let setupName of Object.keys(TEST_CONDITIONS)) {
for (let testName of Object.keys(TESTS)) {
info("Running test " + setupName + " " + testName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update_upgrades.js
@@ -135,17 +135,17 @@ const TESTS = {
{ isUpgrade: false, version: null}
]
}
}
};
add_task(async function setup() {
// Initialise the profile
- awaitPromise(overrideBuiltIns({ "system": [] }));
+ await overrideBuiltIns({ "system": [] });
await promiseStartupManager();
await promiseShutdownManager();
});
add_task(async function() {
for (let setupName of Object.keys(TEST_CONDITIONS)) {
for (let testName of Object.keys(TESTS)) {
info("Running test " + setupName + " " + testName);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -13,17 +13,16 @@ const sampleRDFManifest = {
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
maxVersion: "1"
}],
name: "Test Bootstrap 1 (temporary)",
};
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
BootstrapMonitor.init();
// Partial list of bootstrap reasons from XPIProvider.jsm
const BOOTSTRAP_REASONS = {
APP_STARTUP: 1,
ADDON_INSTALL: 5,
ADDON_UNINSTALL: 6,
@@ -48,16 +47,18 @@ function waitForBootstrapEvent(expectedE
};
Services.obs.addObserver(observer, "bootstrapmonitor-event");
});
}
// Install a temporary add-on with no existing add-on present.
// Restart and make sure it has gone away.
add_task(async function() {
+ await promiseStartupManager();
+
let extInstallCalled = false;
AddonManager.addInstallListener({
onExternalInstall: (aInstall) => {
Assert.equal(aInstall.id, ID);
Assert.equal(aInstall.version, "1.0");
extInstallCalled = true;
},
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
@@ -5,21 +5,22 @@
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const ID = "webextension1@tests.mozilla.org";
const profileDir = gProfD.clone();
profileDir.append("extensions");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
const { GlobalManager } = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
add_task(async function() {
+ await promiseStartupManager();
+
equal(GlobalManager.extensionMap.size, 0);
await Promise.all([
promiseInstallAllFiles([do_get_addon("webextension_1")], true),
promiseWebExtensionStartup()
]);
equal(GlobalManager.extensionMap.size, 1);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
@@ -3,17 +3,16 @@
*/
BootstrapMonitor.init();
const profileDir = gProfD.clone();
profileDir.append("extensions");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "49");
-startupManager();
// NOTE: the following import needs to be called after the `createAppInfo`
// or it will fail Extension.jsm internally imports AddonManager.jsm and
// AddonManager will raise a ReferenceError exception because it tried to
// access an undefined `Services.appinfo` object.
const { Management } = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
const {
@@ -47,16 +46,17 @@ const EMBEDDED_WEBEXT_MANIFEST = JSON.st
version: "1.0",
});
/**
* This test case checks that an hasEmbeddedWebExtension addon property
* is persisted and restored correctly across restarts.
*/
add_task(async function has_embedded_webextension_persisted() {
+ await promiseStartupManager();
const ID = "embedded-webextension-addon-persist@tests.mozilla.org";
const xpiFile = createTempXPIFile({
id: ID,
name: "Test Add-on",
version: "1.0",
bootstrap: true,
hasEmbeddedWebExtension: true,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
@@ -4,17 +4,16 @@
const ID = "webextension1@tests.mozilla.org";
const profileDir = gProfD.clone();
profileDir.append("extensions");
profileDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "42");
-startupManager();
async function testSimpleIconsetParsing(manifest) {
await promiseWriteWebManifestForExtension(manifest, profileDir);
await Promise.all([
promiseRestartManager(),
manifest.theme || promiseWebExtensionStartup(ID),
]);
@@ -108,16 +107,17 @@ async function testNoIconsParsing(manife
equal(AddonManager.getPreferredIconURL(addon, 128), null);
addon.uninstall();
}
// Test simple icon set parsing
add_task(async function() {
+ await promiseStartupManager();
await testSimpleIconsetParsing({
name: "Web Extension Name",
version: "1.0",
manifest_version: 2,
applications: {
gecko: {
id: ID
}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_langpack.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_langpack.js
@@ -8,17 +8,16 @@ const { Services } = ChromeUtils.import(
const { L10nRegistry } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", {});
const ID = "langpack-und@test.mozilla.org";
const profileDir = gProfD.clone();
profileDir.append("extensions");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "58");
-startupManager();
function promiseLangpackStartup() {
return new Promise(resolve => {
const EVENT = "webextension-langpack-startup";
Services.obs.addObserver(function observer() {
Services.obs.removeObserver(observer, EVENT);
resolve();
}, EVENT);
@@ -26,16 +25,18 @@ function promiseLangpackStartup() {
}
/**
* This is a basic life-cycle test which verifies that
* the language pack registers and unregisters correct
* languages at various stages.
*/
add_task(async function() {
+ await promiseStartupManager();
+
// Make sure that `und` locale is not installed.
equal(L10nRegistry.getAvailableLocales().includes("und"), false);
equal(Services.locale.getAvailableLocales().includes("und"), false);
let [, {addon}] = await Promise.all([
promiseLangpackStartup(),
promiseInstallFile(do_get_addon("langpack_1"), true),
]);
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -80,17 +80,16 @@ run-if = addon_signing
[test_cacheflush.js]
[test_childprocess.js]
[test_compatoverrides.js]
[test_corrupt.js]
[test_corruptfile.js]
[test_crash_annotation_quoting.js]
[test_db_path.js]
head =
-[test_default_providers_pref.js]
[test_delay_update.js]
[test_delay_update_webextension.js]
skip-if = appname == "thunderbird"
tags = webextensions
[test_dependencies.js]
[test_dictionary_webextension.js]
[test_distribution.js]
[test_duplicateplugins.js]