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 upgrading an incompatible add-on to a compatible one forces an |
michael@0 | 6 | // EM restart |
michael@0 | 7 | |
michael@0 | 8 | const profileDir = gProfD.clone(); |
michael@0 | 9 | profileDir.append("extensions"); |
michael@0 | 10 | |
michael@0 | 11 | function run_test() { |
michael@0 | 12 | do_test_pending(); |
michael@0 | 13 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "1.9.2"); |
michael@0 | 14 | |
michael@0 | 15 | var dest = writeInstallRDFForExtension({ |
michael@0 | 16 | id: "addon1@tests.mozilla.org", |
michael@0 | 17 | version: "1.0", |
michael@0 | 18 | name: "Test", |
michael@0 | 19 | targetApplications: [{ |
michael@0 | 20 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 21 | minVersion: "1", |
michael@0 | 22 | maxVersion: "1" |
michael@0 | 23 | }] |
michael@0 | 24 | }, profileDir); |
michael@0 | 25 | // Attempt to make this look like it was added some time in the past so |
michael@0 | 26 | // the update makes the last modified time change. |
michael@0 | 27 | setExtensionModifiedTime(dest, dest.lastModifiedTime - 5000); |
michael@0 | 28 | |
michael@0 | 29 | startupManager(); |
michael@0 | 30 | |
michael@0 | 31 | AddonManager.getAddonByID("addon1@tests.mozilla.org", callback_soon(function(a) { |
michael@0 | 32 | do_check_neq(a, null); |
michael@0 | 33 | do_check_eq(a.version, "1.0"); |
michael@0 | 34 | do_check_false(a.userDisabled); |
michael@0 | 35 | do_check_true(a.appDisabled); |
michael@0 | 36 | do_check_false(a.isActive); |
michael@0 | 37 | do_check_false(isExtensionInAddonsList(profileDir, a.id)); |
michael@0 | 38 | |
michael@0 | 39 | writeInstallRDFForExtension({ |
michael@0 | 40 | id: "addon1@tests.mozilla.org", |
michael@0 | 41 | version: "2.0", |
michael@0 | 42 | name: "Test", |
michael@0 | 43 | targetApplications: [{ |
michael@0 | 44 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 45 | minVersion: "1", |
michael@0 | 46 | maxVersion: "2" |
michael@0 | 47 | }] |
michael@0 | 48 | }, profileDir); |
michael@0 | 49 | |
michael@0 | 50 | restartManager(); |
michael@0 | 51 | |
michael@0 | 52 | AddonManager.getAddonByID("addon1@tests.mozilla.org", function(a) { |
michael@0 | 53 | do_check_neq(a, null); |
michael@0 | 54 | do_check_eq(a.version, "2.0"); |
michael@0 | 55 | do_check_false(a.userDisabled); |
michael@0 | 56 | do_check_false(a.appDisabled); |
michael@0 | 57 | do_check_true(a.isActive); |
michael@0 | 58 | do_check_true(isExtensionInAddonsList(profileDir, a.id)); |
michael@0 | 59 | |
michael@0 | 60 | do_execute_soon(do_test_finished); |
michael@0 | 61 | }); |
michael@0 | 62 | })); |
michael@0 | 63 | } |