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 | /* 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 | const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; |
michael@0 | 6 | |
michael@0 | 7 | const Ci = Components.interfaces; |
michael@0 | 8 | const Cu = Components.utils; |
michael@0 | 9 | |
michael@0 | 10 | Cu.import("resource://testing-common/httpd.js"); |
michael@0 | 11 | |
michael@0 | 12 | var ADDONS = [{ |
michael@0 | 13 | id: "test_bug449027_1@tests.mozilla.org", |
michael@0 | 14 | name: "Bug 449027 Addon Test 1", |
michael@0 | 15 | version: "5", |
michael@0 | 16 | start: false, |
michael@0 | 17 | appBlocks: false, |
michael@0 | 18 | toolkitBlocks: false |
michael@0 | 19 | }, { |
michael@0 | 20 | id: "test_bug449027_2@tests.mozilla.org", |
michael@0 | 21 | name: "Bug 449027 Addon Test 2", |
michael@0 | 22 | version: "5", |
michael@0 | 23 | start: false, |
michael@0 | 24 | appBlocks: true, |
michael@0 | 25 | toolkitBlocks: false |
michael@0 | 26 | }, { |
michael@0 | 27 | id: "test_bug449027_3@tests.mozilla.org", |
michael@0 | 28 | name: "Bug 449027 Addon Test 3", |
michael@0 | 29 | version: "5", |
michael@0 | 30 | start: false, |
michael@0 | 31 | appBlocks: true, |
michael@0 | 32 | toolkitBlocks: false |
michael@0 | 33 | }, { |
michael@0 | 34 | id: "test_bug449027_4@tests.mozilla.org", |
michael@0 | 35 | name: "Bug 449027 Addon Test 4", |
michael@0 | 36 | version: "5", |
michael@0 | 37 | start: false, |
michael@0 | 38 | appBlocks: false, |
michael@0 | 39 | toolkitBlocks: false |
michael@0 | 40 | }, { |
michael@0 | 41 | id: "test_bug449027_5@tests.mozilla.org", |
michael@0 | 42 | name: "Bug 449027 Addon Test 5", |
michael@0 | 43 | version: "5", |
michael@0 | 44 | start: false, |
michael@0 | 45 | appBlocks: false, |
michael@0 | 46 | toolkitBlocks: false |
michael@0 | 47 | }, { |
michael@0 | 48 | id: "test_bug449027_6@tests.mozilla.org", |
michael@0 | 49 | name: "Bug 449027 Addon Test 6", |
michael@0 | 50 | version: "5", |
michael@0 | 51 | start: false, |
michael@0 | 52 | appBlocks: true, |
michael@0 | 53 | toolkitBlocks: false |
michael@0 | 54 | }, { |
michael@0 | 55 | id: "test_bug449027_7@tests.mozilla.org", |
michael@0 | 56 | name: "Bug 449027 Addon Test 7", |
michael@0 | 57 | version: "5", |
michael@0 | 58 | start: false, |
michael@0 | 59 | appBlocks: true, |
michael@0 | 60 | toolkitBlocks: false |
michael@0 | 61 | }, { |
michael@0 | 62 | id: "test_bug449027_8@tests.mozilla.org", |
michael@0 | 63 | name: "Bug 449027 Addon Test 8", |
michael@0 | 64 | version: "5", |
michael@0 | 65 | start: false, |
michael@0 | 66 | appBlocks: true, |
michael@0 | 67 | toolkitBlocks: false |
michael@0 | 68 | }, { |
michael@0 | 69 | id: "test_bug449027_9@tests.mozilla.org", |
michael@0 | 70 | name: "Bug 449027 Addon Test 9", |
michael@0 | 71 | version: "5", |
michael@0 | 72 | start: false, |
michael@0 | 73 | appBlocks: true, |
michael@0 | 74 | toolkitBlocks: false |
michael@0 | 75 | }, { |
michael@0 | 76 | id: "test_bug449027_10@tests.mozilla.org", |
michael@0 | 77 | name: "Bug 449027 Addon Test 10", |
michael@0 | 78 | version: "5", |
michael@0 | 79 | start: false, |
michael@0 | 80 | appBlocks: true, |
michael@0 | 81 | toolkitBlocks: false |
michael@0 | 82 | }, { |
michael@0 | 83 | id: "test_bug449027_11@tests.mozilla.org", |
michael@0 | 84 | name: "Bug 449027 Addon Test 11", |
michael@0 | 85 | version: "5", |
michael@0 | 86 | start: false, |
michael@0 | 87 | appBlocks: true, |
michael@0 | 88 | toolkitBlocks: false |
michael@0 | 89 | }, { |
michael@0 | 90 | id: "test_bug449027_12@tests.mozilla.org", |
michael@0 | 91 | name: "Bug 449027 Addon Test 12", |
michael@0 | 92 | version: "5", |
michael@0 | 93 | start: false, |
michael@0 | 94 | appBlocks: true, |
michael@0 | 95 | toolkitBlocks: false |
michael@0 | 96 | }, { |
michael@0 | 97 | id: "test_bug449027_13@tests.mozilla.org", |
michael@0 | 98 | name: "Bug 449027 Addon Test 13", |
michael@0 | 99 | version: "5", |
michael@0 | 100 | start: false, |
michael@0 | 101 | appBlocks: true, |
michael@0 | 102 | toolkitBlocks: false |
michael@0 | 103 | }, { |
michael@0 | 104 | id: "test_bug449027_14@tests.mozilla.org", |
michael@0 | 105 | name: "Bug 449027 Addon Test 14", |
michael@0 | 106 | version: "5", |
michael@0 | 107 | start: false, |
michael@0 | 108 | appBlocks: false, |
michael@0 | 109 | toolkitBlocks: false |
michael@0 | 110 | }, { |
michael@0 | 111 | id: "test_bug449027_15@tests.mozilla.org", |
michael@0 | 112 | name: "Bug 449027 Addon Test 15", |
michael@0 | 113 | version: "5", |
michael@0 | 114 | start: false, |
michael@0 | 115 | appBlocks: true, |
michael@0 | 116 | toolkitBlocks: true |
michael@0 | 117 | }, { |
michael@0 | 118 | id: "test_bug449027_16@tests.mozilla.org", |
michael@0 | 119 | name: "Bug 449027 Addon Test 16", |
michael@0 | 120 | version: "5", |
michael@0 | 121 | start: false, |
michael@0 | 122 | appBlocks: true, |
michael@0 | 123 | toolkitBlocks: true |
michael@0 | 124 | }, { |
michael@0 | 125 | id: "test_bug449027_17@tests.mozilla.org", |
michael@0 | 126 | name: "Bug 449027 Addon Test 17", |
michael@0 | 127 | version: "5", |
michael@0 | 128 | start: false, |
michael@0 | 129 | appBlocks: false, |
michael@0 | 130 | toolkitBlocks: false |
michael@0 | 131 | }, { |
michael@0 | 132 | id: "test_bug449027_18@tests.mozilla.org", |
michael@0 | 133 | name: "Bug 449027 Addon Test 18", |
michael@0 | 134 | version: "5", |
michael@0 | 135 | start: false, |
michael@0 | 136 | appBlocks: false, |
michael@0 | 137 | toolkitBlocks: false |
michael@0 | 138 | }, { |
michael@0 | 139 | id: "test_bug449027_19@tests.mozilla.org", |
michael@0 | 140 | name: "Bug 449027 Addon Test 19", |
michael@0 | 141 | version: "5", |
michael@0 | 142 | start: false, |
michael@0 | 143 | appBlocks: true, |
michael@0 | 144 | toolkitBlocks: true |
michael@0 | 145 | }, { |
michael@0 | 146 | id: "test_bug449027_20@tests.mozilla.org", |
michael@0 | 147 | name: "Bug 449027 Addon Test 20", |
michael@0 | 148 | version: "5", |
michael@0 | 149 | start: false, |
michael@0 | 150 | appBlocks: true, |
michael@0 | 151 | toolkitBlocks: true |
michael@0 | 152 | }, { |
michael@0 | 153 | id: "test_bug449027_21@tests.mozilla.org", |
michael@0 | 154 | name: "Bug 449027 Addon Test 21", |
michael@0 | 155 | version: "5", |
michael@0 | 156 | start: false, |
michael@0 | 157 | appBlocks: true, |
michael@0 | 158 | toolkitBlocks: true |
michael@0 | 159 | }, { |
michael@0 | 160 | id: "test_bug449027_22@tests.mozilla.org", |
michael@0 | 161 | name: "Bug 449027 Addon Test 22", |
michael@0 | 162 | version: "5", |
michael@0 | 163 | start: false, |
michael@0 | 164 | appBlocks: true, |
michael@0 | 165 | toolkitBlocks: true |
michael@0 | 166 | }, { |
michael@0 | 167 | id: "test_bug449027_23@tests.mozilla.org", |
michael@0 | 168 | name: "Bug 449027 Addon Test 23", |
michael@0 | 169 | version: "5", |
michael@0 | 170 | start: false, |
michael@0 | 171 | appBlocks: true, |
michael@0 | 172 | toolkitBlocks: true |
michael@0 | 173 | }, { |
michael@0 | 174 | id: "test_bug449027_24@tests.mozilla.org", |
michael@0 | 175 | name: "Bug 449027 Addon Test 24", |
michael@0 | 176 | version: "5", |
michael@0 | 177 | start: false, |
michael@0 | 178 | appBlocks: true, |
michael@0 | 179 | toolkitBlocks: true |
michael@0 | 180 | }, { |
michael@0 | 181 | id: "test_bug449027_25@tests.mozilla.org", |
michael@0 | 182 | name: "Bug 449027 Addon Test 25", |
michael@0 | 183 | version: "5", |
michael@0 | 184 | start: false, |
michael@0 | 185 | appBlocks: true, |
michael@0 | 186 | toolkitBlocks: true |
michael@0 | 187 | }]; |
michael@0 | 188 | |
michael@0 | 189 | function MockPluginTag(name, version, start, appBlocks, toolkitBlocks) |
michael@0 | 190 | { |
michael@0 | 191 | this.name = name; |
michael@0 | 192 | this.version = version; |
michael@0 | 193 | this.start = start; |
michael@0 | 194 | this.appBlocks = appBlocks; |
michael@0 | 195 | this.toolkitBlocks = toolkitBlocks; |
michael@0 | 196 | } |
michael@0 | 197 | Object.defineProperty(MockPluginTag.prototype, "blocklisted", { |
michael@0 | 198 | get: function MockPluginTag_getBlocklisted() { |
michael@0 | 199 | let bls = AM_Cc["@mozilla.org/extensions/blocklist;1"].getService(Ci.nsIBlocklistService); |
michael@0 | 200 | return bls.getPluginBlocklistState(this) == bls.STATE_BLOCKED; |
michael@0 | 201 | } |
michael@0 | 202 | }); |
michael@0 | 203 | |
michael@0 | 204 | var PLUGINS = [ |
michael@0 | 205 | new MockPluginTag("test_bug449027_1", "5", false, false, false), |
michael@0 | 206 | new MockPluginTag("test_bug449027_2", "5", false, true, false), |
michael@0 | 207 | new MockPluginTag("test_bug449027_3", "5", false, true, false), |
michael@0 | 208 | new MockPluginTag("test_bug449027_4", "5", false, false, false), |
michael@0 | 209 | new MockPluginTag("test_bug449027_5", "5", false, false, false), |
michael@0 | 210 | new MockPluginTag("test_bug449027_6", "5", false, true, false), |
michael@0 | 211 | new MockPluginTag("test_bug449027_7", "5", false, true, false), |
michael@0 | 212 | new MockPluginTag("test_bug449027_8", "5", false, true, false), |
michael@0 | 213 | new MockPluginTag("test_bug449027_9", "5", false, true, false), |
michael@0 | 214 | new MockPluginTag("test_bug449027_10", "5", false, true, false), |
michael@0 | 215 | new MockPluginTag("test_bug449027_11", "5", false, true, false), |
michael@0 | 216 | new MockPluginTag("test_bug449027_12", "5", false, true, false), |
michael@0 | 217 | new MockPluginTag("test_bug449027_13", "5", false, true, false), |
michael@0 | 218 | new MockPluginTag("test_bug449027_14", "5", false, false, false), |
michael@0 | 219 | new MockPluginTag("test_bug449027_15", "5", false, true, true), |
michael@0 | 220 | new MockPluginTag("test_bug449027_16", "5", false, true, true), |
michael@0 | 221 | new MockPluginTag("test_bug449027_17", "5", false, false, false), |
michael@0 | 222 | new MockPluginTag("test_bug449027_18", "5", false, false, false), |
michael@0 | 223 | new MockPluginTag("test_bug449027_19", "5", false, true, true), |
michael@0 | 224 | new MockPluginTag("test_bug449027_20", "5", false, true, true), |
michael@0 | 225 | new MockPluginTag("test_bug449027_21", "5", false, true, true), |
michael@0 | 226 | new MockPluginTag("test_bug449027_22", "5", false, true, true), |
michael@0 | 227 | new MockPluginTag("test_bug449027_23", "5", false, true, true), |
michael@0 | 228 | new MockPluginTag("test_bug449027_24", "5", false, true, true), |
michael@0 | 229 | new MockPluginTag("test_bug449027_25", "5", false, true, true) |
michael@0 | 230 | ]; |
michael@0 | 231 | |
michael@0 | 232 | var gCallback = null; |
michael@0 | 233 | var gTestserver = null; |
michael@0 | 234 | var gNewBlocks = []; |
michael@0 | 235 | |
michael@0 | 236 | // A fake plugin host for the blocklist service to use |
michael@0 | 237 | var PluginHost = { |
michael@0 | 238 | getPluginTags: function(countRef) { |
michael@0 | 239 | countRef.value = PLUGINS.length; |
michael@0 | 240 | return PLUGINS; |
michael@0 | 241 | }, |
michael@0 | 242 | |
michael@0 | 243 | QueryInterface: function(iid) { |
michael@0 | 244 | if (iid.equals(Ci.nsIPluginHost) |
michael@0 | 245 | || iid.equals(Ci.nsISupports)) |
michael@0 | 246 | return this; |
michael@0 | 247 | |
michael@0 | 248 | throw Components.results.NS_ERROR_NO_INTERFACE; |
michael@0 | 249 | } |
michael@0 | 250 | } |
michael@0 | 251 | |
michael@0 | 252 | var PluginHostFactory = { |
michael@0 | 253 | createInstance: function (outer, iid) { |
michael@0 | 254 | if (outer != null) |
michael@0 | 255 | throw Components.results.NS_ERROR_NO_AGGREGATION; |
michael@0 | 256 | return PluginHost.QueryInterface(iid); |
michael@0 | 257 | } |
michael@0 | 258 | }; |
michael@0 | 259 | |
michael@0 | 260 | // Don't need the full interface, attempts to call other methods will just |
michael@0 | 261 | // throw which is just fine |
michael@0 | 262 | var WindowWatcher = { |
michael@0 | 263 | openWindow: function(parent, url, name, features, arguments) { |
michael@0 | 264 | // Should be called to list the newly blocklisted items |
michael@0 | 265 | do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG); |
michael@0 | 266 | do_check_neq(gCallback, null); |
michael@0 | 267 | |
michael@0 | 268 | var args = arguments.wrappedJSObject; |
michael@0 | 269 | |
michael@0 | 270 | gNewBlocks = []; |
michael@0 | 271 | var list = args.list; |
michael@0 | 272 | for (let listItem of list) |
michael@0 | 273 | gNewBlocks.push(listItem.name + " " + listItem.version); |
michael@0 | 274 | |
michael@0 | 275 | // Call the callback after the blocklist has finished up |
michael@0 | 276 | do_timeout(0, gCallback); |
michael@0 | 277 | }, |
michael@0 | 278 | |
michael@0 | 279 | QueryInterface: function(iid) { |
michael@0 | 280 | if (iid.equals(Ci.nsIWindowWatcher) |
michael@0 | 281 | || iid.equals(Ci.nsISupports)) |
michael@0 | 282 | return this; |
michael@0 | 283 | |
michael@0 | 284 | throw Components.results.NS_ERROR_NO_INTERFACE; |
michael@0 | 285 | } |
michael@0 | 286 | } |
michael@0 | 287 | |
michael@0 | 288 | var WindowWatcherFactory = { |
michael@0 | 289 | createInstance: function createInstance(outer, iid) { |
michael@0 | 290 | if (outer != null) |
michael@0 | 291 | throw Components.results.NS_ERROR_NO_AGGREGATION; |
michael@0 | 292 | return WindowWatcher.QueryInterface(iid); |
michael@0 | 293 | } |
michael@0 | 294 | }; |
michael@0 | 295 | var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); |
michael@0 | 296 | registrar.registerFactory(Components.ID("{721c3e73-969e-474b-a6dc-059fd288c428}"), |
michael@0 | 297 | "Fake Plugin Host", |
michael@0 | 298 | "@mozilla.org/plugin/host;1", PluginHostFactory); |
michael@0 | 299 | registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), |
michael@0 | 300 | "Fake Window Watcher", |
michael@0 | 301 | "@mozilla.org/embedcomp/window-watcher;1", WindowWatcherFactory); |
michael@0 | 302 | |
michael@0 | 303 | function create_addon(addon) { |
michael@0 | 304 | var installrdf = "<?xml version=\"1.0\"?>\n" + |
michael@0 | 305 | "\n" + |
michael@0 | 306 | "<RDF xmlns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" + |
michael@0 | 307 | " xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n" + |
michael@0 | 308 | " <Description about=\"urn:mozilla:install-manifest\">\n" + |
michael@0 | 309 | " <em:id>" + addon.id + "</em:id>\n" + |
michael@0 | 310 | " <em:version>" + addon.version + "</em:version>\n" + |
michael@0 | 311 | " <em:targetApplication>\n" + |
michael@0 | 312 | " <Description>\n" + |
michael@0 | 313 | " <em:id>xpcshell@tests.mozilla.org</em:id>\n" + |
michael@0 | 314 | " <em:minVersion>3</em:minVersion>\n" + |
michael@0 | 315 | " <em:maxVersion>3</em:maxVersion>\n" + |
michael@0 | 316 | " </Description>\n" + |
michael@0 | 317 | " </em:targetApplication>\n" + |
michael@0 | 318 | " <em:name>" + addon.name + "</em:name>\n" + |
michael@0 | 319 | " </Description>\n" + |
michael@0 | 320 | "</RDF>\n"; |
michael@0 | 321 | var target = gProfD.clone(); |
michael@0 | 322 | target.append("extensions"); |
michael@0 | 323 | target.append(addon.id); |
michael@0 | 324 | target.append("install.rdf"); |
michael@0 | 325 | target.create(target.NORMAL_FILE_TYPE, 0644); |
michael@0 | 326 | var stream = Components.classes["@mozilla.org/network/file-output-stream;1"] |
michael@0 | 327 | .createInstance(Ci.nsIFileOutputStream); |
michael@0 | 328 | stream.init(target, 0x04 | 0x08 | 0x20, 0664, 0); // write, create, truncate |
michael@0 | 329 | stream.write(installrdf, installrdf.length); |
michael@0 | 330 | stream.close(); |
michael@0 | 331 | } |
michael@0 | 332 | |
michael@0 | 333 | /** |
michael@0 | 334 | * Checks that items are blocklisted correctly according to the current test. |
michael@0 | 335 | * If a lastTest is provided checks that the notification dialog got passed |
michael@0 | 336 | * the newly blocked items compared to the previous test. |
michael@0 | 337 | */ |
michael@0 | 338 | function check_state(test, lastTest, callback) { |
michael@0 | 339 | AddonManager.getAddonsByIDs([a.id for each (a in ADDONS)], function(addons) { |
michael@0 | 340 | for (var i = 0; i < ADDONS.length; i++) { |
michael@0 | 341 | var blocked = addons[i].blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED; |
michael@0 | 342 | if (blocked != ADDONS[i][test]) |
michael@0 | 343 | do_throw("Blocklist state did not match expected for extension " + (i + 1) + ", test " + test); |
michael@0 | 344 | } |
michael@0 | 345 | |
michael@0 | 346 | for (i = 0; i < PLUGINS.length; i++) { |
michael@0 | 347 | if (PLUGINS[i].blocklisted != PLUGINS[i][test]) |
michael@0 | 348 | do_throw("Blocklist state did not match expected for plugin " + (i + 1) + ", test " + test); |
michael@0 | 349 | } |
michael@0 | 350 | |
michael@0 | 351 | if (lastTest) { |
michael@0 | 352 | var expected = 0; |
michael@0 | 353 | for (i = 0; i < ADDONS.length; i++) { |
michael@0 | 354 | if (ADDONS[i][test] && !ADDONS[i][lastTest]) { |
michael@0 | 355 | if (gNewBlocks.indexOf(ADDONS[i].name + " " + ADDONS[i].version) < 0) |
michael@0 | 356 | do_throw("Addon " + (i + 1) + " should have been listed in the blocklist notification for test " + test); |
michael@0 | 357 | expected++; |
michael@0 | 358 | } |
michael@0 | 359 | } |
michael@0 | 360 | |
michael@0 | 361 | for (i = 0; i < PLUGINS.length; i++) { |
michael@0 | 362 | if (PLUGINS[i][test] && !PLUGINS[i][lastTest]) { |
michael@0 | 363 | if (gNewBlocks.indexOf(PLUGINS[i].name + " " + PLUGINS[i].version) < 0) |
michael@0 | 364 | do_throw("Plugin " + (i + 1) + " should have been listed in the blocklist notification for test " + test); |
michael@0 | 365 | expected++; |
michael@0 | 366 | } |
michael@0 | 367 | } |
michael@0 | 368 | |
michael@0 | 369 | do_check_eq(expected, gNewBlocks.length); |
michael@0 | 370 | } |
michael@0 | 371 | do_execute_soon(callback); |
michael@0 | 372 | }); |
michael@0 | 373 | } |
michael@0 | 374 | |
michael@0 | 375 | function load_blocklist(file) { |
michael@0 | 376 | Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + gPort + "/data/" + file); |
michael@0 | 377 | var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"] |
michael@0 | 378 | .getService(Ci.nsITimerCallback); |
michael@0 | 379 | blocklist.notify(null); |
michael@0 | 380 | } |
michael@0 | 381 | |
michael@0 | 382 | function run_test() { |
michael@0 | 383 | // Setup for test |
michael@0 | 384 | dump("Setting up tests\n"); |
michael@0 | 385 | // Rather than keeping lots of identical add-ons in version control, just |
michael@0 | 386 | // write them into the profile. |
michael@0 | 387 | for (let addon of ADDONS) |
michael@0 | 388 | create_addon(addon); |
michael@0 | 389 | |
michael@0 | 390 | createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8"); |
michael@0 | 391 | startupManager(); |
michael@0 | 392 | |
michael@0 | 393 | gTestserver = new HttpServer(); |
michael@0 | 394 | gTestserver.registerDirectory("/data/", do_get_file("data")); |
michael@0 | 395 | gTestserver.start(-1); |
michael@0 | 396 | gPort = gTestserver.identity.primaryPort; |
michael@0 | 397 | |
michael@0 | 398 | do_test_pending(); |
michael@0 | 399 | check_test_pt1(); |
michael@0 | 400 | } |
michael@0 | 401 | |
michael@0 | 402 | /** |
michael@0 | 403 | * Checks the initial state is correct |
michael@0 | 404 | */ |
michael@0 | 405 | function check_test_pt1() { |
michael@0 | 406 | dump("Checking pt 1\n"); |
michael@0 | 407 | |
michael@0 | 408 | AddonManager.getAddonsByIDs([a.id for each (a in ADDONS)], function(addons) { |
michael@0 | 409 | for (var i = 0; i < ADDONS.length; i++) { |
michael@0 | 410 | if (!addons[i]) |
michael@0 | 411 | do_throw("Addon " + (i + 1) + " did not get installed correctly"); |
michael@0 | 412 | } |
michael@0 | 413 | |
michael@0 | 414 | do_execute_soon(function checkstate1() {check_state("start", null, run_test_pt2);}); |
michael@0 | 415 | }); |
michael@0 | 416 | } |
michael@0 | 417 | |
michael@0 | 418 | /** |
michael@0 | 419 | * Load the toolkit based blocks |
michael@0 | 420 | */ |
michael@0 | 421 | function run_test_pt2() { |
michael@0 | 422 | dump("Running test pt 2\n"); |
michael@0 | 423 | gCallback = check_test_pt2; |
michael@0 | 424 | load_blocklist("test_bug449027_toolkit.xml"); |
michael@0 | 425 | } |
michael@0 | 426 | |
michael@0 | 427 | function check_test_pt2() { |
michael@0 | 428 | dump("Checking pt 2\n"); |
michael@0 | 429 | check_state("toolkitBlocks", "start", run_test_pt3); |
michael@0 | 430 | } |
michael@0 | 431 | |
michael@0 | 432 | /** |
michael@0 | 433 | * Load the application based blocks |
michael@0 | 434 | */ |
michael@0 | 435 | function run_test_pt3() { |
michael@0 | 436 | dump("Running test pt 3\n"); |
michael@0 | 437 | gCallback = check_test_pt3; |
michael@0 | 438 | load_blocklist("test_bug449027_app.xml"); |
michael@0 | 439 | } |
michael@0 | 440 | |
michael@0 | 441 | function check_test_pt3() { |
michael@0 | 442 | dump("Checking pt 3\n"); |
michael@0 | 443 | check_state("appBlocks", "toolkitBlocks", end_test); |
michael@0 | 444 | } |
michael@0 | 445 | |
michael@0 | 446 | function end_test() { |
michael@0 | 447 | gTestserver.stop(do_test_finished); |
michael@0 | 448 | } |