Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
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 | // Checks that we rebuild something sensible from a corrupt database |
michael@0 | 6 | |
michael@0 | 7 | Components.utils.import("resource://testing-common/httpd.js"); |
michael@0 | 8 | Components.utils.import("resource://gre/modules/osfile.jsm"); |
michael@0 | 9 | |
michael@0 | 10 | var testserver = new HttpServer(); |
michael@0 | 11 | testserver.start(-1); |
michael@0 | 12 | gPort = testserver.identity.primaryPort; |
michael@0 | 13 | mapFile("/data/test_corrupt.rdf", testserver); |
michael@0 | 14 | testserver.registerDirectory("/addons/", do_get_file("addons")); |
michael@0 | 15 | |
michael@0 | 16 | // The test extension uses an insecure update url. |
michael@0 | 17 | Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false); |
michael@0 | 18 | Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false); |
michael@0 | 19 | |
michael@0 | 20 | // Will be enabled |
michael@0 | 21 | var addon1 = { |
michael@0 | 22 | id: "addon1@tests.mozilla.org", |
michael@0 | 23 | version: "1.0", |
michael@0 | 24 | name: "Test 1", |
michael@0 | 25 | targetApplications: [{ |
michael@0 | 26 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 27 | minVersion: "2", |
michael@0 | 28 | maxVersion: "2" |
michael@0 | 29 | }] |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | // Will be disabled |
michael@0 | 33 | var addon2 = { |
michael@0 | 34 | id: "addon2@tests.mozilla.org", |
michael@0 | 35 | version: "1.0", |
michael@0 | 36 | name: "Test 2", |
michael@0 | 37 | targetApplications: [{ |
michael@0 | 38 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 39 | minVersion: "2", |
michael@0 | 40 | maxVersion: "2" |
michael@0 | 41 | }] |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | // Will get a compatibility update and stay enabled |
michael@0 | 45 | var addon3 = { |
michael@0 | 46 | id: "addon3@tests.mozilla.org", |
michael@0 | 47 | version: "1.0", |
michael@0 | 48 | name: "Test 3", |
michael@0 | 49 | updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf", |
michael@0 | 50 | targetApplications: [{ |
michael@0 | 51 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 52 | minVersion: "1", |
michael@0 | 53 | maxVersion: "1" |
michael@0 | 54 | }] |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | // Will get a compatibility update and be enabled |
michael@0 | 58 | var addon4 = { |
michael@0 | 59 | id: "addon4@tests.mozilla.org", |
michael@0 | 60 | version: "1.0", |
michael@0 | 61 | name: "Test 4", |
michael@0 | 62 | updateURL: "http://localhost:" + gPort + "/data/test_corrupt.rdf", |
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 | // Would stay incompatible with strict compat |
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 | targetApplications: [{ |
michael@0 | 76 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 77 | minVersion: "1", |
michael@0 | 78 | maxVersion: "1" |
michael@0 | 79 | }] |
michael@0 | 80 | }; |
michael@0 | 81 | |
michael@0 | 82 | // Enabled bootstrapped |
michael@0 | 83 | var addon6 = { |
michael@0 | 84 | id: "addon6@tests.mozilla.org", |
michael@0 | 85 | version: "1.0", |
michael@0 | 86 | name: "Test 6", |
michael@0 | 87 | bootstrap: "true", |
michael@0 | 88 | targetApplications: [{ |
michael@0 | 89 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 90 | minVersion: "2", |
michael@0 | 91 | maxVersion: "2" |
michael@0 | 92 | }] |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | // Disabled bootstrapped |
michael@0 | 96 | var addon7 = { |
michael@0 | 97 | id: "addon7@tests.mozilla.org", |
michael@0 | 98 | version: "1.0", |
michael@0 | 99 | name: "Test 7", |
michael@0 | 100 | bootstrap: "true", |
michael@0 | 101 | targetApplications: [{ |
michael@0 | 102 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 103 | minVersion: "2", |
michael@0 | 104 | maxVersion: "2" |
michael@0 | 105 | }] |
michael@0 | 106 | }; |
michael@0 | 107 | |
michael@0 | 108 | // The default theme |
michael@0 | 109 | var theme1 = { |
michael@0 | 110 | id: "theme1@tests.mozilla.org", |
michael@0 | 111 | version: "1.0", |
michael@0 | 112 | name: "Theme 1", |
michael@0 | 113 | internalName: "classic/1.0", |
michael@0 | 114 | targetApplications: [{ |
michael@0 | 115 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 116 | minVersion: "2", |
michael@0 | 117 | maxVersion: "2" |
michael@0 | 118 | }] |
michael@0 | 119 | }; |
michael@0 | 120 | |
michael@0 | 121 | // The selected theme |
michael@0 | 122 | var theme2 = { |
michael@0 | 123 | id: "theme2@tests.mozilla.org", |
michael@0 | 124 | version: "1.0", |
michael@0 | 125 | name: "Theme 2", |
michael@0 | 126 | internalName: "test/1.0", |
michael@0 | 127 | targetApplications: [{ |
michael@0 | 128 | id: "xpcshell@tests.mozilla.org", |
michael@0 | 129 | minVersion: "2", |
michael@0 | 130 | maxVersion: "2" |
michael@0 | 131 | }] |
michael@0 | 132 | }; |
michael@0 | 133 | |
michael@0 | 134 | const profileDir = gProfD.clone(); |
michael@0 | 135 | profileDir.append("extensions"); |
michael@0 | 136 | |
michael@0 | 137 | add_task(function* init() { |
michael@0 | 138 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2"); |
michael@0 | 139 | |
michael@0 | 140 | writeInstallRDFForExtension(addon1, profileDir); |
michael@0 | 141 | writeInstallRDFForExtension(addon2, profileDir); |
michael@0 | 142 | writeInstallRDFForExtension(addon3, profileDir); |
michael@0 | 143 | writeInstallRDFForExtension(addon4, profileDir); |
michael@0 | 144 | writeInstallRDFForExtension(addon5, profileDir); |
michael@0 | 145 | writeInstallRDFForExtension(addon6, profileDir); |
michael@0 | 146 | writeInstallRDFForExtension(addon7, profileDir); |
michael@0 | 147 | writeInstallRDFForExtension(theme1, profileDir); |
michael@0 | 148 | writeInstallRDFForExtension(theme2, profileDir); |
michael@0 | 149 | |
michael@0 | 150 | // Startup the profile and setup the initial state |
michael@0 | 151 | startupManager(); |
michael@0 | 152 | |
michael@0 | 153 | // New profile so new add-ons are ignored |
michael@0 | 154 | check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []); |
michael@0 | 155 | |
michael@0 | 156 | let [a2, a3, a4, a7, t2] = |
michael@0 | 157 | yield promiseAddonsByIDs(["addon2@tests.mozilla.org", |
michael@0 | 158 | "addon3@tests.mozilla.org", |
michael@0 | 159 | "addon4@tests.mozilla.org", |
michael@0 | 160 | "addon7@tests.mozilla.org", |
michael@0 | 161 | "theme2@tests.mozilla.org"]); |
michael@0 | 162 | let deferredUpdateFinished = Promise.defer(); |
michael@0 | 163 | // Set up the initial state |
michael@0 | 164 | a2.userDisabled = true; |
michael@0 | 165 | a4.userDisabled = true; |
michael@0 | 166 | a7.userDisabled = true; |
michael@0 | 167 | t2.userDisabled = false; |
michael@0 | 168 | a3.findUpdates({ |
michael@0 | 169 | onUpdateFinished: function() { |
michael@0 | 170 | a4.findUpdates({ |
michael@0 | 171 | onUpdateFinished: function() { |
michael@0 | 172 | // Let the updates finish before restarting the manager |
michael@0 | 173 | deferredUpdateFinished.resolve(); |
michael@0 | 174 | } |
michael@0 | 175 | }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE); |
michael@0 | 176 | } |
michael@0 | 177 | }, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE); |
michael@0 | 178 | |
michael@0 | 179 | yield deferredUpdateFinished.promise; |
michael@0 | 180 | }); |
michael@0 | 181 | |
michael@0 | 182 | |
michael@0 | 183 | add_task(function* run_test_1() { |
michael@0 | 184 | restartManager(); |
michael@0 | 185 | let [a1, a2, a3, a4, a5, a6, a7, t1, t2] = |
michael@0 | 186 | yield promiseAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 187 | "addon2@tests.mozilla.org", |
michael@0 | 188 | "addon3@tests.mozilla.org", |
michael@0 | 189 | "addon4@tests.mozilla.org", |
michael@0 | 190 | "addon5@tests.mozilla.org", |
michael@0 | 191 | "addon6@tests.mozilla.org", |
michael@0 | 192 | "addon7@tests.mozilla.org", |
michael@0 | 193 | "theme1@tests.mozilla.org", |
michael@0 | 194 | "theme2@tests.mozilla.org"]); |
michael@0 | 195 | |
michael@0 | 196 | do_check_neq(a1, null); |
michael@0 | 197 | do_check_true(a1.isActive); |
michael@0 | 198 | do_check_false(a1.userDisabled); |
michael@0 | 199 | do_check_false(a1.appDisabled); |
michael@0 | 200 | do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 201 | do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
michael@0 | 202 | |
michael@0 | 203 | do_check_neq(a2, null); |
michael@0 | 204 | do_check_false(a2.isActive); |
michael@0 | 205 | do_check_true(a2.userDisabled); |
michael@0 | 206 | do_check_false(a2.appDisabled); |
michael@0 | 207 | do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 208 | do_check_false(isExtensionInAddonsList(profileDir, a2.id)); |
michael@0 | 209 | |
michael@0 | 210 | do_check_neq(a3, null); |
michael@0 | 211 | do_check_true(a3.isActive); |
michael@0 | 212 | do_check_false(a3.userDisabled); |
michael@0 | 213 | do_check_false(a3.appDisabled); |
michael@0 | 214 | do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 215 | do_check_true(isExtensionInAddonsList(profileDir, a3.id)); |
michael@0 | 216 | |
michael@0 | 217 | do_check_neq(a4, null); |
michael@0 | 218 | do_check_false(a4.isActive); |
michael@0 | 219 | do_check_true(a4.userDisabled); |
michael@0 | 220 | do_check_false(a4.appDisabled); |
michael@0 | 221 | do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 222 | do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
michael@0 | 223 | |
michael@0 | 224 | do_check_neq(a5, null); |
michael@0 | 225 | do_check_true(a5.isActive); |
michael@0 | 226 | do_check_false(a5.userDisabled); |
michael@0 | 227 | do_check_false(a5.appDisabled); |
michael@0 | 228 | do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 229 | do_check_true(isExtensionInAddonsList(profileDir, a5.id)); |
michael@0 | 230 | |
michael@0 | 231 | do_check_neq(a6, null); |
michael@0 | 232 | do_check_true(a6.isActive); |
michael@0 | 233 | do_check_false(a6.userDisabled); |
michael@0 | 234 | do_check_false(a6.appDisabled); |
michael@0 | 235 | do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 236 | |
michael@0 | 237 | do_check_neq(a7, null); |
michael@0 | 238 | do_check_false(a7.isActive); |
michael@0 | 239 | do_check_true(a7.userDisabled); |
michael@0 | 240 | do_check_false(a7.appDisabled); |
michael@0 | 241 | do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 242 | |
michael@0 | 243 | do_check_neq(t1, null); |
michael@0 | 244 | do_check_false(t1.isActive); |
michael@0 | 245 | do_check_true(t1.userDisabled); |
michael@0 | 246 | do_check_false(t1.appDisabled); |
michael@0 | 247 | do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 248 | do_check_false(isThemeInAddonsList(profileDir, t1.id)); |
michael@0 | 249 | |
michael@0 | 250 | do_check_neq(t2, null); |
michael@0 | 251 | do_check_true(t2.isActive); |
michael@0 | 252 | do_check_false(t2.userDisabled); |
michael@0 | 253 | do_check_false(t2.appDisabled); |
michael@0 | 254 | do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 255 | do_check_true(isThemeInAddonsList(profileDir, t2.id)); |
michael@0 | 256 | |
michael@0 | 257 | // Open another handle on the JSON DB with as much Unix and Windows locking |
michael@0 | 258 | // as we can to simulate some other process interfering with it |
michael@0 | 259 | shutdownManager(); |
michael@0 | 260 | do_print("Locking " + gExtensionsJSON.path); |
michael@0 | 261 | let options = { |
michael@0 | 262 | winShare: 0 |
michael@0 | 263 | }; |
michael@0 | 264 | if (OS.Constants.libc.O_EXLOCK) |
michael@0 | 265 | options.unixFlags = OS.Constants.libc.O_EXLOCK; |
michael@0 | 266 | |
michael@0 | 267 | let file = yield OS.File.open(gExtensionsJSON.path, {read:true, write:true, existing:true}, options); |
michael@0 | 268 | |
michael@0 | 269 | let filePermissions = gExtensionsJSON.permissions; |
michael@0 | 270 | if (!OS.Constants.Win) { |
michael@0 | 271 | gExtensionsJSON.permissions = 0; |
michael@0 | 272 | } |
michael@0 | 273 | startupManager(false); |
michael@0 | 274 | |
michael@0 | 275 | // Shouldn't have seen any startup changes |
michael@0 | 276 | check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []); |
michael@0 | 277 | |
michael@0 | 278 | // Accessing the add-ons should open and recover the database |
michael@0 | 279 | [a1, a2, a3, a4, a5, a6, a7, t1, t2] = |
michael@0 | 280 | yield promiseAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 281 | "addon2@tests.mozilla.org", |
michael@0 | 282 | "addon3@tests.mozilla.org", |
michael@0 | 283 | "addon4@tests.mozilla.org", |
michael@0 | 284 | "addon5@tests.mozilla.org", |
michael@0 | 285 | "addon6@tests.mozilla.org", |
michael@0 | 286 | "addon7@tests.mozilla.org", |
michael@0 | 287 | "theme1@tests.mozilla.org", |
michael@0 | 288 | "theme2@tests.mozilla.org"]); |
michael@0 | 289 | |
michael@0 | 290 | // Should be correctly recovered |
michael@0 | 291 | do_check_neq(a1, null); |
michael@0 | 292 | do_check_true(a1.isActive); |
michael@0 | 293 | do_check_false(a1.userDisabled); |
michael@0 | 294 | do_check_false(a1.appDisabled); |
michael@0 | 295 | do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 296 | do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
michael@0 | 297 | |
michael@0 | 298 | // Should be correctly recovered |
michael@0 | 299 | do_check_neq(a2, null); |
michael@0 | 300 | do_check_false(a2.isActive); |
michael@0 | 301 | do_check_true(a2.userDisabled); |
michael@0 | 302 | do_check_false(a2.appDisabled); |
michael@0 | 303 | do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 304 | do_check_false(isExtensionInAddonsList(profileDir, a2.id)); |
michael@0 | 305 | |
michael@0 | 306 | // The compatibility update won't be recovered but it should still be |
michael@0 | 307 | // active for this session |
michael@0 | 308 | do_check_neq(a3, null); |
michael@0 | 309 | do_check_true(a3.isActive); |
michael@0 | 310 | do_check_false(a3.userDisabled); |
michael@0 | 311 | do_check_false(a3.appDisabled); |
michael@0 | 312 | do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 313 | do_check_true(isExtensionInAddonsList(profileDir, a3.id)); |
michael@0 | 314 | |
michael@0 | 315 | // The compatibility update won't be recovered and with strict |
michael@0 | 316 | // compatibility it would not have been able to tell that it was |
michael@0 | 317 | // previously userDisabled. However, without strict compat, it wasn't |
michael@0 | 318 | // appDisabled, so it knows it must have been userDisabled. |
michael@0 | 319 | do_check_neq(a4, null); |
michael@0 | 320 | do_check_false(a4.isActive); |
michael@0 | 321 | do_check_true(a4.userDisabled); |
michael@0 | 322 | do_check_false(a4.appDisabled); |
michael@0 | 323 | do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 324 | do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
michael@0 | 325 | |
michael@0 | 326 | do_check_neq(a5, null); |
michael@0 | 327 | do_check_true(a5.isActive); |
michael@0 | 328 | do_check_false(a5.userDisabled); |
michael@0 | 329 | do_check_false(a5.appDisabled); |
michael@0 | 330 | do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 331 | do_check_true(isExtensionInAddonsList(profileDir, a5.id)); |
michael@0 | 332 | |
michael@0 | 333 | do_check_neq(a6, null); |
michael@0 | 334 | do_check_true(a6.isActive); |
michael@0 | 335 | do_check_false(a6.userDisabled); |
michael@0 | 336 | do_check_false(a6.appDisabled); |
michael@0 | 337 | do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 338 | |
michael@0 | 339 | do_check_neq(a7, null); |
michael@0 | 340 | do_check_false(a7.isActive); |
michael@0 | 341 | do_check_true(a7.userDisabled); |
michael@0 | 342 | do_check_false(a7.appDisabled); |
michael@0 | 343 | do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 344 | |
michael@0 | 345 | // Should be correctly recovered |
michael@0 | 346 | do_check_neq(t1, null); |
michael@0 | 347 | do_check_false(t1.isActive); |
michael@0 | 348 | do_check_true(t1.userDisabled); |
michael@0 | 349 | do_check_false(t1.appDisabled); |
michael@0 | 350 | do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 351 | do_check_false(isThemeInAddonsList(profileDir, t1.id)); |
michael@0 | 352 | |
michael@0 | 353 | // Should be correctly recovered |
michael@0 | 354 | do_check_neq(t2, null); |
michael@0 | 355 | do_check_true(t2.isActive); |
michael@0 | 356 | do_check_false(t2.userDisabled); |
michael@0 | 357 | do_check_false(t2.appDisabled); |
michael@0 | 358 | do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 359 | do_check_true(isThemeInAddonsList(profileDir, t2.id)); |
michael@0 | 360 | |
michael@0 | 361 | // Restarting will actually apply changes to extensions.ini which will |
michael@0 | 362 | // then be put into the in-memory database when we next fail to load the |
michael@0 | 363 | // real thing |
michael@0 | 364 | restartManager(); |
michael@0 | 365 | |
michael@0 | 366 | // Shouldn't have seen any startup changes |
michael@0 | 367 | check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []); |
michael@0 | 368 | |
michael@0 | 369 | [a1, a2, a3, a4, a5, a6, a7, t1, t2] = |
michael@0 | 370 | yield promiseAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 371 | "addon2@tests.mozilla.org", |
michael@0 | 372 | "addon3@tests.mozilla.org", |
michael@0 | 373 | "addon4@tests.mozilla.org", |
michael@0 | 374 | "addon5@tests.mozilla.org", |
michael@0 | 375 | "addon6@tests.mozilla.org", |
michael@0 | 376 | "addon7@tests.mozilla.org", |
michael@0 | 377 | "theme1@tests.mozilla.org", |
michael@0 | 378 | "theme2@tests.mozilla.org"]); |
michael@0 | 379 | |
michael@0 | 380 | do_check_neq(a1, null); |
michael@0 | 381 | do_check_true(a1.isActive); |
michael@0 | 382 | do_check_false(a1.userDisabled); |
michael@0 | 383 | do_check_false(a1.appDisabled); |
michael@0 | 384 | do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 385 | do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
michael@0 | 386 | |
michael@0 | 387 | do_check_neq(a2, null); |
michael@0 | 388 | do_check_false(a2.isActive); |
michael@0 | 389 | do_check_true(a2.userDisabled); |
michael@0 | 390 | do_check_false(a2.appDisabled); |
michael@0 | 391 | do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 392 | do_check_false(isExtensionInAddonsList(profileDir, a2.id)); |
michael@0 | 393 | |
michael@0 | 394 | do_check_neq(a3, null); |
michael@0 | 395 | do_check_true(a3.isActive); |
michael@0 | 396 | do_check_false(a3.userDisabled); |
michael@0 | 397 | do_check_false(a3.appDisabled); |
michael@0 | 398 | do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 399 | do_check_true(isExtensionInAddonsList(profileDir, a3.id)); |
michael@0 | 400 | |
michael@0 | 401 | do_check_neq(a4, null); |
michael@0 | 402 | do_check_false(a4.isActive); |
michael@0 | 403 | do_check_true(a4.userDisabled); |
michael@0 | 404 | do_check_false(a4.appDisabled); |
michael@0 | 405 | do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 406 | do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
michael@0 | 407 | |
michael@0 | 408 | do_check_neq(a5, null); |
michael@0 | 409 | do_check_true(a5.isActive); |
michael@0 | 410 | do_check_false(a5.userDisabled); |
michael@0 | 411 | do_check_false(a5.appDisabled); |
michael@0 | 412 | do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 413 | do_check_true(isExtensionInAddonsList(profileDir, a5.id)); |
michael@0 | 414 | |
michael@0 | 415 | do_check_neq(a6, null); |
michael@0 | 416 | do_check_true(a6.isActive); |
michael@0 | 417 | do_check_false(a6.userDisabled); |
michael@0 | 418 | do_check_false(a6.appDisabled); |
michael@0 | 419 | do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 420 | |
michael@0 | 421 | do_check_neq(a7, null); |
michael@0 | 422 | do_check_false(a7.isActive); |
michael@0 | 423 | do_check_true(a7.userDisabled); |
michael@0 | 424 | do_check_false(a7.appDisabled); |
michael@0 | 425 | do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 426 | |
michael@0 | 427 | do_check_neq(t1, null); |
michael@0 | 428 | do_check_false(t1.isActive); |
michael@0 | 429 | do_check_true(t1.userDisabled); |
michael@0 | 430 | do_check_false(t1.appDisabled); |
michael@0 | 431 | do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 432 | do_check_false(isThemeInAddonsList(profileDir, t1.id)); |
michael@0 | 433 | |
michael@0 | 434 | do_check_neq(t2, null); |
michael@0 | 435 | do_check_true(t2.isActive); |
michael@0 | 436 | do_check_false(t2.userDisabled); |
michael@0 | 437 | do_check_false(t2.appDisabled); |
michael@0 | 438 | do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 439 | do_check_true(isThemeInAddonsList(profileDir, t2.id)); |
michael@0 | 440 | |
michael@0 | 441 | // After allowing access to the original DB things should go back to as |
michael@0 | 442 | // they were previously |
michael@0 | 443 | shutdownManager(); |
michael@0 | 444 | do_print("Unlocking " + gExtensionsJSON.path); |
michael@0 | 445 | yield file.close(); |
michael@0 | 446 | gExtensionsJSON.permissions = filePermissions; |
michael@0 | 447 | startupManager(); |
michael@0 | 448 | |
michael@0 | 449 | |
michael@0 | 450 | // Shouldn't have seen any startup changes |
michael@0 | 451 | check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []); |
michael@0 | 452 | |
michael@0 | 453 | [a1, a2, a3, a4, a5, a6, a7, t1, t2] = |
michael@0 | 454 | yield promiseAddonsByIDs(["addon1@tests.mozilla.org", |
michael@0 | 455 | "addon2@tests.mozilla.org", |
michael@0 | 456 | "addon3@tests.mozilla.org", |
michael@0 | 457 | "addon4@tests.mozilla.org", |
michael@0 | 458 | "addon5@tests.mozilla.org", |
michael@0 | 459 | "addon6@tests.mozilla.org", |
michael@0 | 460 | "addon7@tests.mozilla.org", |
michael@0 | 461 | "theme1@tests.mozilla.org", |
michael@0 | 462 | "theme2@tests.mozilla.org"]); |
michael@0 | 463 | |
michael@0 | 464 | do_check_neq(a1, null); |
michael@0 | 465 | do_check_true(a1.isActive); |
michael@0 | 466 | do_check_false(a1.userDisabled); |
michael@0 | 467 | do_check_false(a1.appDisabled); |
michael@0 | 468 | do_check_eq(a1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 469 | do_check_true(isExtensionInAddonsList(profileDir, a1.id)); |
michael@0 | 470 | |
michael@0 | 471 | do_check_neq(a2, null); |
michael@0 | 472 | do_check_false(a2.isActive); |
michael@0 | 473 | do_check_true(a2.userDisabled); |
michael@0 | 474 | do_check_false(a2.appDisabled); |
michael@0 | 475 | do_check_eq(a2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 476 | do_check_false(isExtensionInAddonsList(profileDir, a2.id)); |
michael@0 | 477 | |
michael@0 | 478 | do_check_neq(a3, null); |
michael@0 | 479 | do_check_true(a3.isActive); |
michael@0 | 480 | do_check_false(a3.userDisabled); |
michael@0 | 481 | do_check_false(a3.appDisabled); |
michael@0 | 482 | do_check_eq(a3.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 483 | do_check_true(isExtensionInAddonsList(profileDir, a3.id)); |
michael@0 | 484 | |
michael@0 | 485 | do_check_neq(a4, null); |
michael@0 | 486 | do_check_false(a4.isActive); |
michael@0 | 487 | do_check_true(a4.userDisabled); |
michael@0 | 488 | do_check_false(a4.appDisabled); |
michael@0 | 489 | do_check_eq(a4.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 490 | do_check_false(isExtensionInAddonsList(profileDir, a4.id)); |
michael@0 | 491 | |
michael@0 | 492 | do_check_neq(a5, null); |
michael@0 | 493 | do_check_true(a5.isActive); |
michael@0 | 494 | do_check_false(a5.userDisabled); |
michael@0 | 495 | do_check_false(a5.appDisabled); |
michael@0 | 496 | do_check_eq(a5.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 497 | do_check_true(isExtensionInAddonsList(profileDir, a5.id)); |
michael@0 | 498 | |
michael@0 | 499 | do_check_neq(a6, null); |
michael@0 | 500 | do_check_true(a6.isActive); |
michael@0 | 501 | do_check_false(a6.userDisabled); |
michael@0 | 502 | do_check_false(a6.appDisabled); |
michael@0 | 503 | do_check_eq(a6.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 504 | |
michael@0 | 505 | do_check_neq(a7, null); |
michael@0 | 506 | do_check_false(a7.isActive); |
michael@0 | 507 | do_check_true(a7.userDisabled); |
michael@0 | 508 | do_check_false(a7.appDisabled); |
michael@0 | 509 | do_check_eq(a7.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 510 | |
michael@0 | 511 | do_check_neq(t1, null); |
michael@0 | 512 | do_check_false(t1.isActive); |
michael@0 | 513 | do_check_true(t1.userDisabled); |
michael@0 | 514 | do_check_false(t1.appDisabled); |
michael@0 | 515 | do_check_eq(t1.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 516 | do_check_false(isThemeInAddonsList(profileDir, t1.id)); |
michael@0 | 517 | |
michael@0 | 518 | do_check_neq(t2, null); |
michael@0 | 519 | do_check_true(t2.isActive); |
michael@0 | 520 | do_check_false(t2.userDisabled); |
michael@0 | 521 | do_check_false(t2.appDisabled); |
michael@0 | 522 | do_check_eq(t2.pendingOperations, AddonManager.PENDING_NONE); |
michael@0 | 523 | do_check_true(isThemeInAddonsList(profileDir, t2.id)); |
michael@0 | 524 | }); |
michael@0 | 525 | |
michael@0 | 526 | |
michael@0 | 527 | function run_test() { |
michael@0 | 528 | run_next_test(); |
michael@0 | 529 | } |