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