toolkit/mozapps/extensions/test/xpcshell/test_bug542391.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 4 */
michael@0 5
michael@0 6 const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
michael@0 7 const PREF_EM_SHOW_MISMATCH_UI = "extensions.showMismatchUI";
michael@0 8
michael@0 9 // The test extension uses an insecure update url.
michael@0 10 Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
michael@0 11
michael@0 12 const Cc = Components.classes;
michael@0 13 const Ci = Components.interfaces;
michael@0 14 const Cu = Components.utils;
michael@0 15 const Cr = Components.results;
michael@0 16
michael@0 17 Cu.import("resource://testing-common/httpd.js");
michael@0 18 var testserver;
michael@0 19
michael@0 20 const profileDir = gProfD.clone();
michael@0 21 profileDir.append("extensions");
michael@0 22
michael@0 23 var gInstallUpdate = false;
michael@0 24 var gCheckUpdates = false;
michael@0 25
michael@0 26 // This will be called to show the compatibility update dialog.
michael@0 27 var WindowWatcher = {
michael@0 28 expected: false,
michael@0 29 arguments: null,
michael@0 30
michael@0 31 openWindow: function(parent, url, name, features, arguments) {
michael@0 32 do_check_true(Services.startup.interrupted);
michael@0 33 do_check_eq(url, URI_EXTENSION_UPDATE_DIALOG);
michael@0 34 do_check_true(this.expected);
michael@0 35 this.expected = false;
michael@0 36 this.arguments = arguments.QueryInterface(AM_Ci.nsIVariant);
michael@0 37
michael@0 38 var updated = !gCheckUpdates;
michael@0 39 if (gCheckUpdates) {
michael@0 40 AddonManager.getAddonByID("bug542391_6@tests.mozilla.org", function(a6) {
michael@0 41 a6.findUpdates({
michael@0 42 onUpdateFinished: function() {
michael@0 43 AddonManagerPrivate.removeStartupChange("disabled", "bug542391_6@tests.mozilla.org");
michael@0 44 updated = true;
michael@0 45 }
michael@0 46 }, AddonManager.UPDATE_WHEN_NEW_APP_INSTALLED);
michael@0 47 });
michael@0 48 }
michael@0 49
michael@0 50 var installed = !gInstallUpdate;
michael@0 51 if (gInstallUpdate) {
michael@0 52 // Simulate installing an update while in the dialog
michael@0 53 installAllFiles([do_get_addon("test_bug542391_3_2")], function() {
michael@0 54 AddonManagerPrivate.removeStartupChange("disabled", "bug542391_3@tests.mozilla.org");
michael@0 55 AddonManagerPrivate.addStartupChange("updated", "bug542391_3@tests.mozilla.org");
michael@0 56 installed = true;
michael@0 57 });
michael@0 58 }
michael@0 59
michael@0 60 // The dialog is meant to be opened modally and the install operation can be
michael@0 61 // asynchronous, so we must spin an event loop (like the modal window does)
michael@0 62 // until the install is complete
michael@0 63 let thr = AM_Cc["@mozilla.org/thread-manager;1"].
michael@0 64 getService(AM_Ci.nsIThreadManager).
michael@0 65 mainThread;
michael@0 66
michael@0 67 while (!installed || !updated)
michael@0 68 thr.processNextEvent(false);
michael@0 69 },
michael@0 70
michael@0 71 QueryInterface: function(iid) {
michael@0 72 if (iid.equals(Ci.nsIWindowWatcher)
michael@0 73 || iid.equals(Ci.nsISupports))
michael@0 74 return this;
michael@0 75
michael@0 76 throw Cr.NS_ERROR_NO_INTERFACE;
michael@0 77 }
michael@0 78 }
michael@0 79
michael@0 80 var WindowWatcherFactory = {
michael@0 81 createInstance: function createInstance(outer, iid) {
michael@0 82 if (outer != null)
michael@0 83 throw Components.results.NS_ERROR_NO_AGGREGATION;
michael@0 84 return WindowWatcher.QueryInterface(iid);
michael@0 85 }
michael@0 86 };
michael@0 87
michael@0 88 var registrar = Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
michael@0 89 registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"),
michael@0 90 "Fake Window Watcher",
michael@0 91 "@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory);
michael@0 92
michael@0 93 function check_state_v1([a1, a2, a3, a4, a5, a6]) {
michael@0 94 do_check_neq(a1, null);
michael@0 95 do_check_false(a1.appDisabled);
michael@0 96 do_check_false(a1.userDisabled);
michael@0 97 do_check_true(a1.isActive);
michael@0 98 do_check_true(isExtensionInAddonsList(profileDir, a1.id));
michael@0 99
michael@0 100 do_check_neq(a2, null);
michael@0 101 do_check_false(a2.appDisabled);
michael@0 102 do_check_true(a2.userDisabled);
michael@0 103 do_check_false(a2.isActive);
michael@0 104 do_check_false(isExtensionInAddonsList(profileDir, a2.id));
michael@0 105
michael@0 106 do_check_neq(a3, null);
michael@0 107 do_check_false(a3.appDisabled);
michael@0 108 do_check_false(a3.userDisabled);
michael@0 109 do_check_true(a3.isActive);
michael@0 110 do_check_true(isExtensionInAddonsList(profileDir, a3.id));
michael@0 111 do_check_eq(a3.version, "1.0");
michael@0 112
michael@0 113 do_check_neq(a4, null);
michael@0 114 do_check_false(a4.appDisabled);
michael@0 115 do_check_true(a4.userDisabled);
michael@0 116 do_check_false(a4.isActive);
michael@0 117 do_check_false(isExtensionInAddonsList(profileDir, a4.id));
michael@0 118
michael@0 119 do_check_neq(a5, null);
michael@0 120 do_check_false(a5.appDisabled);
michael@0 121 do_check_false(a5.userDisabled);
michael@0 122 do_check_true(a5.isActive);
michael@0 123 do_check_true(isExtensionInAddonsList(profileDir, a5.id));
michael@0 124
michael@0 125 do_check_neq(a6, null);
michael@0 126 do_check_false(a6.appDisabled);
michael@0 127 do_check_false(a6.userDisabled);
michael@0 128 do_check_true(a6.isActive);
michael@0 129 do_check_true(isExtensionInAddonsList(profileDir, a6.id));
michael@0 130 }
michael@0 131
michael@0 132 function check_state_v1_2([a1, a2, a3, a4, a5, a6]) {
michael@0 133 do_check_neq(a1, null);
michael@0 134 do_check_false(a1.appDisabled);
michael@0 135 do_check_false(a1.userDisabled);
michael@0 136 do_check_true(a1.isActive);
michael@0 137 do_check_true(isExtensionInAddonsList(profileDir, a1.id));
michael@0 138
michael@0 139 do_check_neq(a2, null);
michael@0 140 do_check_false(a2.appDisabled);
michael@0 141 do_check_true(a2.userDisabled);
michael@0 142 do_check_false(a2.isActive);
michael@0 143 do_check_false(isExtensionInAddonsList(profileDir, a2.id));
michael@0 144
michael@0 145 do_check_neq(a3, null);
michael@0 146 do_check_true(a3.appDisabled);
michael@0 147 do_check_false(a3.userDisabled);
michael@0 148 do_check_false(a3.isActive);
michael@0 149 do_check_false(isExtensionInAddonsList(profileDir, a3.id));
michael@0 150 do_check_eq(a3.version, "2.0");
michael@0 151
michael@0 152 do_check_neq(a4, null);
michael@0 153 do_check_false(a4.appDisabled);
michael@0 154 do_check_true(a4.userDisabled);
michael@0 155 do_check_false(a4.isActive);
michael@0 156 do_check_false(isExtensionInAddonsList(profileDir, a4.id));
michael@0 157
michael@0 158 do_check_neq(a5, null);
michael@0 159 do_check_false(a5.appDisabled);
michael@0 160 do_check_false(a5.userDisabled);
michael@0 161 do_check_true(a5.isActive);
michael@0 162 do_check_true(isExtensionInAddonsList(profileDir, a5.id));
michael@0 163
michael@0 164 do_check_neq(a6, null);
michael@0 165 do_check_false(a6.appDisabled);
michael@0 166 do_check_false(a6.userDisabled);
michael@0 167 do_check_true(a6.isActive);
michael@0 168 do_check_true(isExtensionInAddonsList(profileDir, a6.id));
michael@0 169 }
michael@0 170
michael@0 171 function check_state_v2([a1, a2, a3, a4, a5, a6]) {
michael@0 172 do_check_neq(a1, null);
michael@0 173 do_check_true(a1.appDisabled);
michael@0 174 do_check_false(a1.userDisabled);
michael@0 175 do_check_false(a1.isActive);
michael@0 176 do_check_false(isExtensionInAddonsList(profileDir, a1.id));
michael@0 177
michael@0 178 do_check_neq(a2, null);
michael@0 179 do_check_false(a2.appDisabled);
michael@0 180 do_check_true(a2.userDisabled);
michael@0 181 do_check_false(a2.isActive);
michael@0 182 do_check_false(isExtensionInAddonsList(profileDir, a2.id));
michael@0 183
michael@0 184 do_check_neq(a3, null);
michael@0 185 do_check_false(a3.appDisabled);
michael@0 186 do_check_false(a3.userDisabled);
michael@0 187 do_check_true(a3.isActive);
michael@0 188 do_check_true(isExtensionInAddonsList(profileDir, a3.id));
michael@0 189 do_check_eq(a3.version, "1.0");
michael@0 190
michael@0 191 do_check_neq(a4, null);
michael@0 192 do_check_false(a4.appDisabled);
michael@0 193 do_check_true(a4.userDisabled);
michael@0 194 do_check_false(a4.isActive);
michael@0 195 do_check_false(isExtensionInAddonsList(profileDir, a4.id));
michael@0 196
michael@0 197 do_check_neq(a5, null);
michael@0 198 do_check_false(a5.appDisabled);
michael@0 199 do_check_false(a5.userDisabled);
michael@0 200 do_check_true(a5.isActive);
michael@0 201 do_check_true(isExtensionInAddonsList(profileDir, a5.id));
michael@0 202
michael@0 203 do_check_neq(a6, null);
michael@0 204 do_check_false(a6.appDisabled);
michael@0 205 do_check_false(a6.userDisabled);
michael@0 206 do_check_true(a6.isActive);
michael@0 207 do_check_true(isExtensionInAddonsList(profileDir, a6.id));
michael@0 208 }
michael@0 209
michael@0 210 function check_state_v3([a1, a2, a3, a4, a5, a6]) {
michael@0 211 do_check_neq(a1, null);
michael@0 212 do_check_true(a1.appDisabled);
michael@0 213 do_check_false(a1.userDisabled);
michael@0 214 do_check_false(a1.isActive);
michael@0 215 do_check_false(isExtensionInAddonsList(profileDir, a1.id));
michael@0 216
michael@0 217 do_check_neq(a2, null);
michael@0 218 do_check_true(a2.appDisabled);
michael@0 219 do_check_true(a2.userDisabled);
michael@0 220 do_check_false(a2.isActive);
michael@0 221 do_check_false(isExtensionInAddonsList(profileDir, a2.id));
michael@0 222
michael@0 223 do_check_neq(a3, null);
michael@0 224 do_check_true(a3.appDisabled);
michael@0 225 do_check_false(a3.userDisabled);
michael@0 226 do_check_false(a3.isActive);
michael@0 227 do_check_false(isExtensionInAddonsList(profileDir, a3.id));
michael@0 228 do_check_eq(a3.version, "1.0");
michael@0 229
michael@0 230 do_check_neq(a4, null);
michael@0 231 do_check_false(a4.appDisabled);
michael@0 232 do_check_true(a4.userDisabled);
michael@0 233 do_check_false(a4.isActive);
michael@0 234 do_check_false(isExtensionInAddonsList(profileDir, a4.id));
michael@0 235
michael@0 236 do_check_neq(a5, null);
michael@0 237 do_check_false(a5.appDisabled);
michael@0 238 do_check_false(a5.userDisabled);
michael@0 239 do_check_true(a5.isActive);
michael@0 240 do_check_true(isExtensionInAddonsList(profileDir, a5.id));
michael@0 241
michael@0 242 do_check_neq(a6, null);
michael@0 243 do_check_false(a6.appDisabled);
michael@0 244 do_check_false(a6.userDisabled);
michael@0 245 do_check_true(a6.isActive);
michael@0 246 do_check_true(isExtensionInAddonsList(profileDir, a6.id));
michael@0 247 }
michael@0 248
michael@0 249 function check_state_v3_2([a1, a2, a3, a4, a5, a6]) {
michael@0 250 do_check_neq(a1, null);
michael@0 251 do_check_true(a1.appDisabled);
michael@0 252 do_check_false(a1.userDisabled);
michael@0 253 do_check_false(a1.isActive);
michael@0 254 do_check_false(isExtensionInAddonsList(profileDir, a1.id));
michael@0 255
michael@0 256 do_check_neq(a2, null);
michael@0 257 do_check_true(a2.appDisabled);
michael@0 258 do_check_true(a2.userDisabled);
michael@0 259 do_check_false(a2.isActive);
michael@0 260 do_check_false(isExtensionInAddonsList(profileDir, a2.id));
michael@0 261
michael@0 262 do_check_neq(a3, null);
michael@0 263 do_check_false(a3.appDisabled);
michael@0 264 do_check_false(a3.userDisabled);
michael@0 265 do_check_true(a3.isActive);
michael@0 266 do_check_true(isExtensionInAddonsList(profileDir, a3.id));
michael@0 267 do_check_eq(a3.version, "2.0");
michael@0 268
michael@0 269 do_check_neq(a4, null);
michael@0 270 do_check_false(a4.appDisabled);
michael@0 271 do_check_true(a4.userDisabled);
michael@0 272 do_check_false(a4.isActive);
michael@0 273 do_check_false(isExtensionInAddonsList(profileDir, a4.id));
michael@0 274
michael@0 275 do_check_neq(a5, null);
michael@0 276 do_check_false(a5.appDisabled);
michael@0 277 do_check_false(a5.userDisabled);
michael@0 278 do_check_true(a5.isActive);
michael@0 279 do_check_true(isExtensionInAddonsList(profileDir, a5.id));
michael@0 280
michael@0 281 do_check_neq(a6, null);
michael@0 282 do_check_false(a6.appDisabled);
michael@0 283 do_check_false(a6.userDisabled);
michael@0 284 do_check_true(a6.isActive);
michael@0 285 do_check_true(isExtensionInAddonsList(profileDir, a6.id));
michael@0 286 }
michael@0 287
michael@0 288 // Install all the test add-ons, disable two of them and "upgrade" the app to
michael@0 289 // version 2 which will appDisable one.
michael@0 290 function run_test() {
michael@0 291 do_test_pending();
michael@0 292 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
michael@0 293
michael@0 294 Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, true);
michael@0 295
michael@0 296 // Add an extension to the profile to make sure the dialog doesn't show up
michael@0 297 // on new profiles
michael@0 298 var dest = writeInstallRDFForExtension({
michael@0 299 id: "addon1@tests.mozilla.org",
michael@0 300 version: "1.0",
michael@0 301 targetApplications: [{
michael@0 302 id: "xpcshell@tests.mozilla.org",
michael@0 303 minVersion: "1",
michael@0 304 maxVersion: "1"
michael@0 305 }],
michael@0 306 name: "Test Addon 1",
michael@0 307 }, profileDir);
michael@0 308
michael@0 309 // Create and configure the HTTP server.
michael@0 310 testserver = new HttpServer();
michael@0 311 testserver.registerDirectory("/data/", do_get_file("data"));
michael@0 312 testserver.registerDirectory("/addons/", do_get_file("addons"));
michael@0 313 testserver.start(4444);
michael@0 314
michael@0 315 startupManager();
michael@0 316
michael@0 317 dest.remove(true);
michael@0 318
michael@0 319 installAllFiles([do_get_addon("test_bug542391_1"),
michael@0 320 do_get_addon("test_bug542391_2"),
michael@0 321 do_get_addon("test_bug542391_3_1"),
michael@0 322 do_get_addon("test_bug542391_4"),
michael@0 323 do_get_addon("test_bug542391_5"),
michael@0 324 do_get_addon("test_bug542391_6")], function install_and_restart() {
michael@0 325
michael@0 326 restartManager();
michael@0 327 check_startup_changes("installed", []);
michael@0 328 check_startup_changes("updated", []);
michael@0 329 check_startup_changes("uninstalled", ["addon1@tests.mozilla.org"]);
michael@0 330 check_startup_changes("disabled", []);
michael@0 331 check_startup_changes("enabled", []);
michael@0 332
michael@0 333 AddonManager.getAddonsByIDs(["bug542391_2@tests.mozilla.org",
michael@0 334 "bug542391_4@tests.mozilla.org"],
michael@0 335 callback_soon(function disable_and_restart([a2, a4]) {
michael@0 336 do_check_true(a2 != null && a4 != null);
michael@0 337 a2.userDisabled = true;
michael@0 338 a4.userDisabled = true;
michael@0 339 restartManager();
michael@0 340 check_startup_changes("installed", []);
michael@0 341 check_startup_changes("updated", []);
michael@0 342 check_startup_changes("uninstalled", []);
michael@0 343 check_startup_changes("disabled", []);
michael@0 344 check_startup_changes("enabled", []);
michael@0 345
michael@0 346 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 347 "bug542391_2@tests.mozilla.org",
michael@0 348 "bug542391_3@tests.mozilla.org",
michael@0 349 "bug542391_4@tests.mozilla.org",
michael@0 350 "bug542391_5@tests.mozilla.org",
michael@0 351 "bug542391_6@tests.mozilla.org"],
michael@0 352 callback_soon(function(addons) {
michael@0 353 check_state_v1(addons);
michael@0 354
michael@0 355 WindowWatcher.expected = true;
michael@0 356 restartManager("2");
michael@0 357 check_startup_changes("installed", []);
michael@0 358 check_startup_changes("updated", []);
michael@0 359 check_startup_changes("uninstalled", []);
michael@0 360 check_startup_changes("disabled", ["bug542391_1@tests.mozilla.org"]);
michael@0 361 check_startup_changes("enabled", []);
michael@0 362 do_check_false(WindowWatcher.expected);
michael@0 363
michael@0 364 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 365 "bug542391_2@tests.mozilla.org",
michael@0 366 "bug542391_3@tests.mozilla.org",
michael@0 367 "bug542391_4@tests.mozilla.org",
michael@0 368 "bug542391_5@tests.mozilla.org",
michael@0 369 "bug542391_6@tests.mozilla.org"],
michael@0 370 function(addons) {
michael@0 371 check_state_v2(addons);
michael@0 372
michael@0 373 do_execute_soon(run_test_1);
michael@0 374 });
michael@0 375 }));
michael@0 376 }));
michael@0 377 });
michael@0 378 }
michael@0 379
michael@0 380 function end_test() {
michael@0 381 testserver.stop(do_test_finished);
michael@0 382 }
michael@0 383
michael@0 384 // Upgrade to version 3 which will appDisable two more add-ons. Check that the
michael@0 385 // 3 already disabled add-ons were passed to the mismatch dialog.
michael@0 386 function run_test_1() {
michael@0 387 gCheckUpdates = true;
michael@0 388 WindowWatcher.expected = true;
michael@0 389 restartManager("3");
michael@0 390 check_startup_changes("installed", []);
michael@0 391 check_startup_changes("updated", []);
michael@0 392 check_startup_changes("uninstalled", []);
michael@0 393 check_startup_changes("disabled", ["bug542391_3@tests.mozilla.org"]);
michael@0 394 check_startup_changes("enabled", []);
michael@0 395 do_check_false(WindowWatcher.expected);
michael@0 396 gCheckUpdates = false;
michael@0 397
michael@0 398 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 399 "bug542391_2@tests.mozilla.org",
michael@0 400 "bug542391_3@tests.mozilla.org",
michael@0 401 "bug542391_4@tests.mozilla.org",
michael@0 402 "bug542391_5@tests.mozilla.org",
michael@0 403 "bug542391_6@tests.mozilla.org"],
michael@0 404 function(addons) {
michael@0 405 check_state_v3(addons);
michael@0 406
michael@0 407 do_check_eq(WindowWatcher.arguments.length, 3);
michael@0 408 do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
michael@0 409 do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
michael@0 410 do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
michael@0 411
michael@0 412 do_execute_soon(run_test_2);
michael@0 413 });
michael@0 414 }
michael@0 415
michael@0 416 // Downgrade to version 2 which will remove appDisable from two add-ons and
michael@0 417 // should pass all 4 previously disabled add-ons.
michael@0 418 function run_test_2() {
michael@0 419 WindowWatcher.expected = true;
michael@0 420 restartManager("2");
michael@0 421 check_startup_changes("installed", []);
michael@0 422 check_startup_changes("updated", []);
michael@0 423 check_startup_changes("uninstalled", []);
michael@0 424 check_startup_changes("disabled", []);
michael@0 425 check_startup_changes("enabled", ["bug542391_3@tests.mozilla.org"]);
michael@0 426 do_check_false(WindowWatcher.expected);
michael@0 427
michael@0 428 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 429 "bug542391_2@tests.mozilla.org",
michael@0 430 "bug542391_3@tests.mozilla.org",
michael@0 431 "bug542391_4@tests.mozilla.org",
michael@0 432 "bug542391_5@tests.mozilla.org",
michael@0 433 "bug542391_6@tests.mozilla.org"],
michael@0 434 function(addons) {
michael@0 435 check_state_v2(addons);
michael@0 436
michael@0 437 do_check_eq(WindowWatcher.arguments.length, 4);
michael@0 438 do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
michael@0 439 do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
michael@0 440 do_check_true(WindowWatcher.arguments.indexOf("bug542391_3@tests.mozilla.org") >= 0);
michael@0 441 do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
michael@0 442
michael@0 443 do_execute_soon(run_test_5);
michael@0 444 });
michael@0 445 }
michael@0 446
michael@0 447 // Upgrade to version 3 which will appDisable two more add-ons. Check that when
michael@0 448 // the upgrade dialog updates an add-on no restart is necessary
michael@0 449 function run_test_5() {
michael@0 450 Services.prefs.setBoolPref(PREF_EM_SHOW_MISMATCH_UI, true);
michael@0 451 gInstallUpdate = true;
michael@0 452
michael@0 453 WindowWatcher.expected = true;
michael@0 454 restartManager("3");
michael@0 455 check_startup_changes("installed", []);
michael@0 456 check_startup_changes("updated", ["bug542391_3@tests.mozilla.org"]);
michael@0 457 check_startup_changes("uninstalled", []);
michael@0 458 check_startup_changes("disabled", []);
michael@0 459 check_startup_changes("enabled", []);
michael@0 460 do_check_false(WindowWatcher.expected);
michael@0 461 gInstallUpdate = false;
michael@0 462
michael@0 463 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 464 "bug542391_2@tests.mozilla.org",
michael@0 465 "bug542391_3@tests.mozilla.org",
michael@0 466 "bug542391_4@tests.mozilla.org",
michael@0 467 "bug542391_5@tests.mozilla.org",
michael@0 468 "bug542391_6@tests.mozilla.org"],
michael@0 469 function(addons) {
michael@0 470 check_state_v3_2(addons);
michael@0 471
michael@0 472 do_check_eq(WindowWatcher.arguments.length, 3);
michael@0 473 do_check_true(WindowWatcher.arguments.indexOf("bug542391_1@tests.mozilla.org") >= 0);
michael@0 474 do_check_true(WindowWatcher.arguments.indexOf("bug542391_2@tests.mozilla.org") >= 0);
michael@0 475 do_check_true(WindowWatcher.arguments.indexOf("bug542391_4@tests.mozilla.org") >= 0);
michael@0 476
michael@0 477 do_execute_soon(run_test_6);
michael@0 478 });
michael@0 479 }
michael@0 480
michael@0 481 // Downgrade to version 1 which will appEnable all the add-ons
michael@0 482 function run_test_6() {
michael@0 483 WindowWatcher.expected = true;
michael@0 484 restartManager("1");
michael@0 485 check_startup_changes("installed", []);
michael@0 486 check_startup_changes("updated", []);
michael@0 487 check_startup_changes("uninstalled", []);
michael@0 488 check_startup_changes("disabled", ["bug542391_3@tests.mozilla.org"]);
michael@0 489 check_startup_changes("enabled", ["bug542391_1@tests.mozilla.org"]);
michael@0 490 do_check_false(WindowWatcher.expected);
michael@0 491
michael@0 492 AddonManager.getAddonsByIDs(["bug542391_1@tests.mozilla.org",
michael@0 493 "bug542391_2@tests.mozilla.org",
michael@0 494 "bug542391_3@tests.mozilla.org",
michael@0 495 "bug542391_4@tests.mozilla.org",
michael@0 496 "bug542391_5@tests.mozilla.org",
michael@0 497 "bug542391_6@tests.mozilla.org"],
michael@0 498 function(addons) {
michael@0 499 check_state_v1_2(addons);
michael@0 500
michael@0 501 end_test();
michael@0 502 });
michael@0 503 }

mercurial