diff options
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js index e22ab87c9..724b48dd5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js @@ -3,17 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -var addonIDs = ["test_bug393285_1@tests.mozilla.org", +let addonIDs = ["test_bug393285_1@tests.mozilla.org", "test_bug393285_2@tests.mozilla.org", "test_bug393285_3a@tests.mozilla.org", "test_bug393285_4@tests.mozilla.org"]; -var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; +const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; const URI_EXTENSION_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"; Cu.import("resource://testing-common/httpd.js"); -Cu.import("resource://testing-common/MockRegistrar.jsm"); var testserver = new HttpServer(); testserver.start(-1); gPort = testserver.identity.primaryPort; @@ -26,18 +25,18 @@ profileDir.append("extensions"); // A window watcher to deal with the blocklist UI dialog. var WindowWatcher = { - openWindow: function(parent, url, name, features, args) { + openWindow: function(parent, url, name, features, arguments) { // Should be called to list the newly blocklisted items do_check_eq(url, URI_EXTENSION_BLOCKLIST_DIALOG); // Simulate auto-disabling any softblocks - var list = args.wrappedJSObject.list; + var list = arguments.wrappedJSObject.list; list.forEach(function(aItem) { if (!aItem.blocked) aItem.disable = true; }); - // run the code after the blocklist is closed + //run the code after the blocklist is closed Services.obs.notifyObservers(null, "addon-blocklist-closed", null); }, @@ -51,7 +50,20 @@ var WindowWatcher = { } }; -MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher); +var WindowWatcherFactory = { + createInstance: function createInstance(outer, iid) { + if (outer != null) + throw Cr.NS_ERROR_NO_AGGREGATION; + return WindowWatcher.QueryInterface(iid); + } +}; + +var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar); +registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), + "Fake Window Watcher", + "@mozilla.org/embedcomp/window-watcher;1", + WindowWatcherFactory); + function load_blocklist(aFile, aCallback) { Services.obs.addObserver(function() { @@ -125,7 +137,7 @@ function run_test() { startupManager(); AddonManager.getAddonsByIDs(addonIDs, function(addons) { - for (let addon of addons) { + for (addon of addons) { do_check_eq(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); } run_test_1(); |