summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js27
1 files changed, 19 insertions, 8 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
index ebc330cdd..90cf29753 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js
@@ -3,12 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-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;
@@ -19,7 +18,7 @@ mapFile("/data/test_bug393285.xml", testserver);
const profileDir = gProfD.clone();
profileDir.append("extensions");
-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_3b@tests.mozilla.org",
@@ -37,18 +36,18 @@ var addonIDs = ["test_bug393285_1@tests.mozilla.org",
// 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);
},
@@ -62,7 +61,19 @@ 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) {
@@ -258,7 +269,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();