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 | // This verifies that the (temporary) |
michael@0 | 6 | // extensions.checkCompatibility.temporaryThemeOverride_minAppVersion |
michael@0 | 7 | // preference works. |
michael@0 | 8 | |
michael@0 | 9 | var ADDONS = [{ |
michael@0 | 10 | id: "addon1@tests.mozilla.org", |
michael@0 | 11 | type: 4, |
michael@0 | 12 | internalName: "theme1/1.0", |
michael@0 | 13 | version: "1.0", |
michael@0 | 14 | name: "Test 1", |
michael@0 | 15 | targetApplications: [{ |
michael@0 | 16 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 17 | minVersion: "1.0", |
michael@0 | 18 | maxVersion: "1.0" |
michael@0 | 19 | }] |
michael@0 | 20 | }, { |
michael@0 | 21 | id: "addon2@tests.mozilla.org", |
michael@0 | 22 | type: 4, |
michael@0 | 23 | internalName: "theme2/1.0", |
michael@0 | 24 | version: "1.0", |
michael@0 | 25 | name: "Test 2", |
michael@0 | 26 | targetApplications: [{ |
michael@0 | 27 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 28 | minVersion: "2.0", |
michael@0 | 29 | maxVersion: "2.0" |
michael@0 | 30 | }] |
michael@0 | 31 | }]; |
michael@0 | 32 | |
michael@0 | 33 | const profileDir = gProfD.clone(); |
michael@0 | 34 | profileDir.append("extensions"); |
michael@0 | 35 | |
michael@0 | 36 | |
michael@0 | 37 | function run_test() { |
michael@0 | 38 | do_test_pending(); |
michael@0 | 39 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3.0", "1"); |
michael@0 | 40 | |
michael@0 | 41 | for (let a of ADDONS) { |
michael@0 | 42 | writeInstallRDFForExtension(a, profileDir); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | startupManager(); |
michael@0 | 46 | |
michael@0 | 47 | run_test_1(); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | function run_test_1() { |
michael@0 | 51 | AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 52 | "addon2@tests.mozilla.org"], |
michael@0 | 53 | function([a1, a2]) { |
michael@0 | 54 | |
michael@0 | 55 | do_check_neq(a1, null); |
michael@0 | 56 | do_check_false(a1.isActive); |
michael@0 | 57 | do_check_false(a1.isCompatible); |
michael@0 | 58 | do_check_true(a1.appDisabled); |
michael@0 | 59 | |
michael@0 | 60 | do_check_neq(a2, null); |
michael@0 | 61 | do_check_false(a2.isActive); |
michael@0 | 62 | do_check_false(a2.isCompatible); |
michael@0 | 63 | do_check_true(a1.appDisabled); |
michael@0 | 64 | |
michael@0 | 65 | do_execute_soon(run_test_2); |
michael@0 | 66 | }); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | function run_test_2() { |
michael@0 | 70 | Services.prefs.setCharPref("extensions.checkCompatibility.temporaryThemeOverride_minAppVersion", "2.0"); |
michael@0 | 71 | if (isNightlyChannel()) |
michael@0 | 72 | Services.prefs.setBoolPref("extensions.checkCompatibility.nightly", false); |
michael@0 | 73 | else |
michael@0 | 74 | Services.prefs.setBoolPref("extensions.checkCompatibility.3.0", false); |
michael@0 | 75 | restartManager(); |
michael@0 | 76 | |
michael@0 | 77 | AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 78 | "addon2@tests.mozilla.org"], |
michael@0 | 79 | function([a1, a2]) { |
michael@0 | 80 | |
michael@0 | 81 | do_check_neq(a1, null); |
michael@0 | 82 | do_check_false(a1.isActive); |
michael@0 | 83 | do_check_false(a1.isCompatible); |
michael@0 | 84 | do_check_true(a1.appDisabled); |
michael@0 | 85 | |
michael@0 | 86 | do_check_neq(a2, null); |
michael@0 | 87 | do_check_false(a2.isActive); |
michael@0 | 88 | do_check_false(a2.isCompatible); |
michael@0 | 89 | do_check_false(a2.appDisabled); |
michael@0 | 90 | |
michael@0 | 91 | do_execute_soon(do_test_finished); |
michael@0 | 92 | }); |
michael@0 | 93 | } |