diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-18 08:24:24 +0200 |
commit | fc61780b35af913801d72086456f493f63197da6 (patch) | |
tree | f85891288a7bd988da9f0f15ae64e5c63f00d493 /toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js | |
parent | 69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff) | |
parent | 50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff) | |
download | UXP-2018.07.18.tar UXP-2018.07.18.tar.gz UXP-2018.07.18.tar.lz UXP-2018.07.18.tar.xz UXP-2018.07.18.zip |
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts:
# browser/app/profile/firefox.js
# browser/components/preferences/jar.mn
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js')
-rw-r--r-- | toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js b/toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js deleted file mode 100644 index f7e3e21e5..000000000 --- a/toolkit/mozapps/webextensions/test/xpcshell/test_updateid.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// This verifies that updating an add-on to a new ID works - -// The test extension uses an insecure update url. -Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -function promiseInstallUpdate(install) { - return new Promise((resolve, reject) => { - install.addListener({ - onDownloadFailed: () => { - let err = new Error("download error"); - err.code = install.error; - reject(err); - }, - onInstallFailed: () => { - let err = new Error("install error"); - err.code = install.error; - reject(err); - }, - onInstallEnded: resolve, - }); - - install.install(); - }); -} - -// Create and configure the HTTP server. -let testserver = createHttpServer(4444); -testserver.registerDirectory("/data/", do_get_file("data")); -testserver.registerDirectory("/addons/", do_get_file("addons")); - -function run_test() { - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); - startupManager(); - run_next_test(); -} - -// Verify that an update to an add-on with a new ID fails -add_task(function* test_update_new_id() { - yield promiseInstallFile(do_get_addon("test_updateid1")); - - let addon = yield promiseAddonByID("addon1@tests.mozilla.org"); - do_check_neq(addon, null); - do_check_eq(addon.version, "1.0"); - - let update = yield promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); - let install = update.updateAvailable; - do_check_eq(install.name, addon.name); - do_check_eq(install.version, "2.0"); - do_check_eq(install.state, AddonManager.STATE_AVAILABLE); - do_check_eq(install.existingAddon, addon); - - yield Assert.rejects(promiseInstallUpdate(install), - function(err) { return err.code == AddonManager.ERROR_INCORRECT_ID }, - "Upgrade to a different ID fails"); - - addon.uninstall(); -}); - -// Verify that an update to a multi-package xpi fails -add_task(function* test_update_new_id() { - yield promiseInstallFile(do_get_addon("test_update_multi1")); - - let addon = yield promiseAddonByID("updatemulti@tests.mozilla.org"); - do_check_neq(addon, null); - do_check_eq(addon.version, "1.0"); - - let update = yield promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED); - let install = update.updateAvailable; - do_check_eq(install.name, addon.name); - do_check_eq(install.version, "2.0"); - do_check_eq(install.state, AddonManager.STATE_AVAILABLE); - do_check_eq(install.existingAddon, addon); - - yield Assert.rejects(promiseInstallUpdate(install), - function(err) { return err.code == AddonManager.ERROR_UNEXPECTED_ADDON_TYPE }, - "Upgrade to a multipackage xpi fails"); - - addon.uninstall(); -}); |