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 targetPlatform entries are checked when deciding |
michael@0 | 6 | // if an add-on is incompatible. |
michael@0 | 7 | |
michael@0 | 8 | // No targetPlatforms so should be compatible |
michael@0 | 9 | var addon1 = { |
michael@0 | 10 | id: "addon1@tests.mozilla.org", |
michael@0 | 11 | version: "1.0", |
michael@0 | 12 | name: "Test 1", |
michael@0 | 13 | targetApplications: [{ |
michael@0 | 14 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 15 | minVersion: "1", |
michael@0 | 16 | maxVersion: "1" |
michael@0 | 17 | }] |
michael@0 | 18 | }; |
michael@0 | 19 | |
michael@0 | 20 | // Matches the OS |
michael@0 | 21 | var addon2 = { |
michael@0 | 22 | id: "addon2@tests.mozilla.org", |
michael@0 | 23 | version: "1.0", |
michael@0 | 24 | name: "Test 2", |
michael@0 | 25 | targetPlatforms: [ |
michael@0 | 26 | "XPCShell", |
michael@0 | 27 | "WINNT_x86", |
michael@0 | 28 | "XPCShell" |
michael@0 | 29 | ], |
michael@0 | 30 | targetApplications: [{ |
michael@0 | 31 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 32 | minVersion: "1", |
michael@0 | 33 | maxVersion: "1" |
michael@0 | 34 | }] |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | // Matches the OS and ABI |
michael@0 | 38 | var addon3 = { |
michael@0 | 39 | id: "addon3@tests.mozilla.org", |
michael@0 | 40 | version: "1.0", |
michael@0 | 41 | name: "Test 3", |
michael@0 | 42 | targetPlatforms: [ |
michael@0 | 43 | "WINNT", |
michael@0 | 44 | "XPCShell_noarch-spidermonkey" |
michael@0 | 45 | ], |
michael@0 | 46 | targetApplications: [{ |
michael@0 | 47 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 48 | minVersion: "1", |
michael@0 | 49 | maxVersion: "1" |
michael@0 | 50 | }] |
michael@0 | 51 | }; |
michael@0 | 52 | |
michael@0 | 53 | // Doesn't match |
michael@0 | 54 | var addon4 = { |
michael@0 | 55 | id: "addon4@tests.mozilla.org", |
michael@0 | 56 | version: "1.0", |
michael@0 | 57 | name: "Test 4", |
michael@0 | 58 | targetPlatforms: [ |
michael@0 | 59 | "WINNT_noarch-spidermonkey", |
michael@0 | 60 | "Darwin", |
michael@0 | 61 | "WINNT_noarch-spidermonkey" |
michael@0 | 62 | ], |
michael@0 | 63 | targetApplications: [{ |
michael@0 | 64 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 65 | minVersion: "1", |
michael@0 | 66 | maxVersion: "1" |
michael@0 | 67 | }] |
michael@0 | 68 | }; |
michael@0 | 69 | |
michael@0 | 70 | // Matches the OS but since a different entry specifies ABI this doesn't match. |
michael@0 | 71 | var addon5 = { |
michael@0 | 72 | id: "addon5@tests.mozilla.org", |
michael@0 | 73 | version: "1.0", |
michael@0 | 74 | name: "Test 5", |
michael@0 | 75 | targetPlatforms: [ |
michael@0 | 76 | "XPCShell", |
michael@0 | 77 | "XPCShell_foo" |
michael@0 | 78 | ], |
michael@0 | 79 | targetApplications: [{ |
michael@0 | 80 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 81 | minVersion: "1", |
michael@0 | 82 | maxVersion: "1" |
michael@0 | 83 | }] |
michael@0 | 84 | }; |
michael@0 | 85 | |
michael@0 | 86 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); |
michael@0 | 87 | |
michael@0 | 88 | const profileDir = gProfD.clone(); |
michael@0 | 89 | profileDir.append("extensions"); |
michael@0 | 90 | |
michael@0 | 91 | // Set up the profile |
michael@0 | 92 | function run_test() { |
michael@0 | 93 | do_test_pending(); |
michael@0 | 94 | |
michael@0 | 95 | writeInstallRDFForExtension(addon1, profileDir); |
michael@0 | 96 | writeInstallRDFForExtension(addon2, profileDir); |
michael@0 | 97 | writeInstallRDFForExtension(addon3, profileDir); |
michael@0 | 98 | writeInstallRDFForExtension(addon4, profileDir); |
michael@0 | 99 | writeInstallRDFForExtension(addon5, profileDir); |
michael@0 | 100 | |
michael@0 | 101 | restartManager(); |
michael@0 | 102 | AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 103 | "addon2@tests.mozilla.org", |
michael@0 | 104 | "addon3@tests.mozilla.org", |
michael@0 | 105 | "addon4@tests.mozilla.org", |
michael@0 | 106 | "addon5@tests.mozilla.org"], |
michael@0 | 107 | function([a1, a2, a3, a4, a5]) { |
michael@0 | 108 | |
michael@0 | 109 | do_check_neq(a1, null); |
michael@0 | 110 | do_check_false(a1.appDisabled); |
michael@0 | 111 | do_check_true(a1.isPlatformCompatible); |
michael@0 | 112 | do_check_true(a1.isActive); |
michael@0 | 113 | do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
michael@0 | 114 | do_check_in_crash_annotation(addon1.id, addon1.version); |
michael@0 | 115 | |
michael@0 | 116 | do_check_neq(a2, null); |
michael@0 | 117 | do_check_false(a2.appDisabled); |
michael@0 | 118 | do_check_true(a2.isPlatformCompatible); |
michael@0 | 119 | do_check_true(a2.isActive); |
michael@0 | 120 | do_check_true(isExtensionInAddonsList(profileDir, a2.id)); |
michael@0 | 121 | do_check_in_crash_annotation(addon2.id, addon2.version); |
michael@0 | 122 | |
michael@0 | 123 | do_check_neq(a3, null); |
michael@0 | 124 | do_check_false(a3.appDisabled); |
michael@0 | 125 | do_check_true(a3.isPlatformCompatible); |
michael@0 | 126 | do_check_true(a3.isActive); |
michael@0 | 127 | do_check_true(isExtensionInAddonsList(profileDir, a3.id)); |
michael@0 | 128 | do_check_in_crash_annotation(addon3.id, addon3.version); |
michael@0 | 129 | |
michael@0 | 130 | do_check_neq(a4, null); |
michael@0 | 131 | do_check_true(a4.appDisabled); |
michael@0 | 132 | do_check_false(a4.isPlatformCompatible); |
michael@0 | 133 | do_check_false(a4.isActive); |
michael@0 | 134 | do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
michael@0 | 135 | do_check_not_in_crash_annotation(addon4.id, addon4.version); |
michael@0 | 136 | |
michael@0 | 137 | do_check_neq(a5, null); |
michael@0 | 138 | do_check_true(a5.appDisabled); |
michael@0 | 139 | do_check_false(a5.isPlatformCompatible); |
michael@0 | 140 | do_check_false(a5.isActive); |
michael@0 | 141 | do_check_false(isExtensionInAddonsList(profileDir, a5.id)); |
michael@0 | 142 | do_check_not_in_crash_annotation(addon5.id, addon5.version); |
michael@0 | 143 | |
michael@0 | 144 | do_execute_soon(do_test_finished); |
michael@0 | 145 | }); |
michael@0 | 146 | } |