Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 3 | */ |
michael@0 | 4 | |
michael@0 | 5 | // Tests that we recover gracefully from an extension directory disappearing |
michael@0 | 6 | // when we were expecting to uninstall it. |
michael@0 | 7 | |
michael@0 | 8 | var addon1 = { |
michael@0 | 9 | id: "addon1@tests.mozilla.org", |
michael@0 | 10 | version: "1.0", |
michael@0 | 11 | name: "Test 1", |
michael@0 | 12 | targetApplications: [{ |
michael@0 | 13 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 14 | minVersion: "1", |
michael@0 | 15 | maxVersion: "1" |
michael@0 | 16 | }] |
michael@0 | 17 | }; |
michael@0 | 18 | |
michael@0 | 19 | var addon2 = { |
michael@0 | 20 | id: "addon2@tests.mozilla.org", |
michael@0 | 21 | version: "2.0", |
michael@0 | 22 | name: "Test 2", |
michael@0 | 23 | targetApplications: [{ |
michael@0 | 24 | id: "toolkit@mozilla.org", |
michael@0 | 25 | minVersion: "1", |
michael@0 | 26 | maxVersion: "1" |
michael@0 | 27 | }] |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | const profileDir = gProfD.clone(); |
michael@0 | 31 | profileDir.append("extensions"); |
michael@0 | 32 | |
michael@0 | 33 | function run_test() { |
michael@0 | 34 | do_test_pending(); |
michael@0 | 35 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "2"); |
michael@0 | 36 | |
michael@0 | 37 | writeInstallRDFForExtension(addon1, profileDir); |
michael@0 | 38 | |
michael@0 | 39 | startupManager(); |
michael@0 | 40 | |
michael@0 | 41 | AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a1) { |
michael@0 | 42 | a1.uninstall(); |
michael@0 | 43 | |
michael@0 | 44 | shutdownManager(); |
michael@0 | 45 | |
michael@0 | 46 | var dest = profileDir.clone(); |
michael@0 | 47 | dest.append(do_get_expected_addon_name("addon1@tests.mozilla.org")); |
michael@0 | 48 | dest.remove(true); |
michael@0 | 49 | |
michael@0 | 50 | writeInstallRDFForExtension(addon2, profileDir); |
michael@0 | 51 | |
michael@0 | 52 | startupManager(); |
michael@0 | 53 | |
michael@0 | 54 | AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 55 | "addon2@tests.mozilla.org"], |
michael@0 | 56 | function([a1, a2]) { |
michael@0 | 57 | // Addon1 should no longer be installed |
michael@0 | 58 | do_check_eq(a1, null); |
michael@0 | 59 | |
michael@0 | 60 | // Addon2 should have been detected |
michael@0 | 61 | do_check_neq(a2, null); |
michael@0 | 62 | |
michael@0 | 63 | do_execute_soon(do_test_finished); |
michael@0 | 64 | }); |
michael@0 | 65 | })); |
michael@0 | 66 | } |