1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
5 // This verifies that add-on update check failures are propagated correctly
7 // The test extension uses an insecure update url.
8 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
12 add_task(async function setup() {
13 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
15 // Create and configure the HTTP server.
16 testserver = createHttpServer({ hosts: ["example.com"] });
17 testserver.registerDirectory("/data/", do_get_file("data"));
19 await promiseStartupManager();
22 // Verify that an update check returns the correct errors.
23 add_task(async function () {
24 await promiseInstallWebExtension({
28 browser_specific_settings: {
30 id: "addon1@tests.mozilla.org",
31 update_url: "http://example.com/data/test_missing.json",
37 let addon = await promiseAddonByID("addon1@tests.mozilla.org");
38 equal(addon.version, "1.0");
40 // We're expecting an error, so resolve when the promise is rejected.
41 let update = await promiseFindAddonUpdates(
43 AddonManager.UPDATE_WHEN_USER_REQUESTED
46 ok(!update.compatibilityUpdate, "not expecting a compatibility update");
47 ok(!update.updateAvailable, "not expecting a compatibility update");
49 equal(update.error, AddonManager.UPDATE_STATUS_DOWNLOAD_ERROR);
51 await addon.uninstall();