diff --git a/browser/base/content/aboutDialog.js b/browser/base/content/aboutDialog.js index 34b46619199..82968beb110 100644 --- a/browser/base/content/aboutDialog.js +++ b/browser/base/content/aboutDialog.js @@ -463,7 +463,7 @@ appUpdater.prototype = * See XPIProvider.jsm */ onUpdateAvailable: function(aAddon, aInstall) { - if (!Services.blocklist.isAddonBlocklisted(aAddon, + if (!Services.blocklist.isAddonBlocklisted(aAddon.id, aInstall.version, this.update.appVersion, this.update.platformVersion)) { // Compatibility or new version updates mean the same thing here. diff --git a/browser/base/content/test/social/browser_blocklist.js b/browser/base/content/test/social/browser_blocklist.js index 2c20dc2dba6..9f6436b13d8 100644 --- a/browser/base/content/test/social/browser_blocklist.js +++ b/browser/base/content/test/social/browser_blocklist.js @@ -36,10 +36,10 @@ var tests = { testSimpleBlocklist: function(next) { // this really just tests adding and clearing our blocklist for later tests setAndUpdateBlocklist(blocklistURL, function() { - ok(Services.blocklist.isAddonBlocklisted(SocialService.createWrapper(manifest_bad)), "blocking 'blocked'"); - ok(!Services.blocklist.isAddonBlocklisted(SocialService.createWrapper(manifest)), "not blocking 'good'"); + ok(Services.blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocking 'blocked'"); + ok(!Services.blocklist.isAddonBlocklisted("example.com@services.mozilla.org", "0", "0", "0"), "not blocking 'good'"); resetBlocklist(function() { - ok(!Services.blocklist.isAddonBlocklisted(SocialService.createWrapper(manifest_bad)), "blocklist cleared"); + ok(!Services.blocklist.isAddonBlocklisted("test1.example.com@services.mozilla.org", "0", "0", "0"), "blocklist cleared"); next(); }); }); diff --git a/browser/metro/base/content/flyoutpanels/AboutFlyoutPanel.js b/browser/metro/base/content/flyoutpanels/AboutFlyoutPanel.js index f1adcc4224e..bb6c0ddc86a 100644 --- a/browser/metro/base/content/flyoutpanels/AboutFlyoutPanel.js +++ b/browser/metro/base/content/flyoutpanels/AboutFlyoutPanel.js @@ -454,7 +454,7 @@ appUpdater.prototype = * See XPIProvider.jsm */ onUpdateAvailable: function(aAddon, aInstall) { - if (!Services.blocklist.isAddonBlocklisted(aAddon, + if (!Services.blocklist.isAddonBlocklisted(aAddon.id, aInstall.version, this.update.appVersion, this.update.platformVersion)) { // Compatibility or new version updates mean the same thing here. diff --git a/toolkit/components/social/SocialService.jsm b/toolkit/components/social/SocialService.jsm index f5f94ee77a6..7672d040204 100644 --- a/toolkit/components/social/SocialService.jsm +++ b/toolkit/components/social/SocialService.jsm @@ -587,12 +587,12 @@ this.SocialService = { installProvider: function(aDOMDocument, data, installCallback) { let installOrigin = aDOMDocument.nodePrincipal.origin; - let addon = new AddonWrapper(data); - if (addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) + let id = getAddonIDFromOrigin(installOrigin); + let version = data && data.version ? data.version : "0"; + if (Services.blocklist.getAddonBlocklistState(id, version) == Ci.nsIBlocklistService.STATE_BLOCKED) throw new Error("installProvider: provider with origin [" + installOrigin + "] is blocklisted"); - let id = getAddonIDFromOrigin(installOrigin); AddonManager.getAddonByID(id, function(aAddon) { if (aAddon && aAddon.userDisabled) { aAddon.cancelUninstall(); @@ -662,10 +662,6 @@ this.SocialService = { } }, - createWrapper: function(manifest) { - return new AddonWrapper(manifest); - }, - /** * updateProvider is used from the worker to self-update. Since we do not * have knowledge of the currently selected provider here, we will notify @@ -720,8 +716,8 @@ function SocialProvider(input) { if (!input.origin) throw new Error("SocialProvider must be passed an origin"); - let addon = new AddonWrapper(input); - if (addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) + let id = getAddonIDFromOrigin(input.origin); + if (Services.blocklist.getAddonBlocklistState(id, input.version || "0") == Ci.nsIBlocklistService.STATE_BLOCKED) throw new Error("SocialProvider: provider with origin [" + input.origin + "] is blocklisted"); @@ -1015,8 +1011,8 @@ var SocialAddonProvider = { for (let manifest of SocialServiceInternal.manifests) { try { if (ActiveProviders.has(manifest.origin)) { - let addon = new AddonWrapper(manifest); - if (addon.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) { + let id = getAddonIDFromOrigin(manifest.origin); + if (Services.blocklist.getAddonBlocklistState(id, manifest.version || "0") != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) { SocialService.removeProvider(manifest.origin); } } @@ -1104,11 +1100,11 @@ AddonWrapper.prototype = { }, get blocklistState() { - return Services.blocklist.getAddonBlocklistState(this); + return Services.blocklist.getAddonBlocklistState(this.id, this.version || "0"); }, get blocklistURL() { - return Services.blocklist.getAddonBlocklistURL(this); + return Services.blocklist.getAddonBlocklistURL(this.id, this.version || "0"); }, get screenshots() { diff --git a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm index f90dc094b35..46d269bb4e1 100644 --- a/toolkit/mozapps/extensions/AddonUpdateChecker.jsm +++ b/toolkit/mozapps/extensions/AddonUpdateChecker.jsm @@ -721,7 +721,8 @@ this.AddonUpdateChecker = { for (let update of aUpdates) { if (!update.updateURL) continue; - let state = blocklist.getAddonBlocklistState(update, aAppVersion, aPlatformVersion); + let state = blocklist.getAddonBlocklistState(update.id, update.version, + aAppVersion, aPlatformVersion); if (state != Ci.nsIBlocklistService.STATE_NOT_BLOCKED) continue; if ((newest == null || (Services.vc.compare(newest.version, update.version) < 0)) && diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index f5387c517de..667f77d34c1 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -550,10 +550,12 @@ function applyBlocklistChanges(aOldAddon, aNewAddon, aOldAppVersion, let bs = Cc["@mozilla.org/extensions/blocklist;1"]. getService(Ci.nsIBlocklistService); - let oldBlocklistState = bs.getAddonBlocklistState(createWrapper(aOldAddon), + let oldBlocklistState = bs.getAddonBlocklistState(aOldAddon.id, + aOldAddon.version, aOldAppVersion, aOldPlatformVersion); - let newBlocklistState = bs.getAddonBlocklistState(createWrapper(aNewAddon)); + let newBlocklistState = bs.getAddonBlocklistState(aNewAddon.id, + aNewAddon.version); // If the blocklist state hasn't changed then the properties don't need to // change @@ -6199,7 +6201,7 @@ AddonInternal.prototype = { let bs = Cc["@mozilla.org/extensions/blocklist;1"]. getService(Ci.nsIBlocklistService); - return bs.getAddonBlocklistState(createWrapper(this)); + return bs.getAddonBlocklistState(this.id, this.version); }, get blocklistURL() { @@ -6211,7 +6213,7 @@ AddonInternal.prototype = { let bs = Cc["@mozilla.org/extensions/blocklist;1"]. getService(Ci.nsIBlocklistService); - return bs.getAddonBlocklistURL(createWrapper(this)); + return bs.getAddonBlocklistURL(this.id, this.version); }, applyCompatibilityUpdate: function AddonInternal_applyCompatibilityUpdate(aUpdate, aSyncCompatibility) { @@ -6329,7 +6331,7 @@ function AddonWrapper(aAddon) { ["id", "syncGUID", "version", "type", "isCompatible", "isPlatformCompatible", "providesUpdatesSecurely", "blocklistState", "blocklistURL", "appDisabled", "softDisabled", "skinnable", "size", "foreignInstall", "hasBinaryComponents", - "strictCompatibility", "compatibilityOverrides", "updateURL"].forEach(function(aProp) { + "strictCompatibility", "compatibilityOverrides"].forEach(function(aProp) { this.__defineGetter__(aProp, function AddonWrapper_propertyGetter() aAddon[aProp]); }, this); diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index 55c69ef7379..c43c1b74949 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -49,8 +49,6 @@ const VULNERABILITYSTATUS_NONE = 0; const VULNERABILITYSTATUS_UPDATE_AVAILABLE = 1; const VULNERABILITYSTATUS_NO_UPDATE = 2; -const EXTENSION_BLOCK_FILTERS = ["id", "name", "creator", "homepageURL", "updateURL"]; - var gLoggingEnabled = null; var gBlocklistEnabled = true; var gBlocklistLevel = DEFAULT_LEVEL; @@ -319,16 +317,16 @@ Blocklist.prototype = { }, /* See nsIBlocklistService */ - isAddonBlocklisted: function Blocklist_isAddonBlocklisted(addon, appVersion, toolkitVersion) { - return this.getAddonBlocklistState(addon, appVersion, toolkitVersion) == + isAddonBlocklisted: function Blocklist_isAddonBlocklisted(id, version, appVersion, toolkitVersion) { + return this.getAddonBlocklistState(id, version, appVersion, toolkitVersion) == Ci.nsIBlocklistService.STATE_BLOCKED; }, /* See nsIBlocklistService */ - getAddonBlocklistState: function Blocklist_getAddonBlocklistState(addon, appVersion, toolkitVersion) { + getAddonBlocklistState: function Blocklist_getAddonBlocklistState(id, version, appVersion, toolkitVersion) { if (!this._addonEntries) this._loadBlocklist(); - return this._getAddonBlocklistState(addon, this._addonEntries, + return this._getAddonBlocklistState(id, version, this._addonEntries, appVersion, toolkitVersion); }, @@ -351,8 +349,8 @@ Blocklist.prototype = { * @returns The blocklist state for the item, one of the STATE constants as * defined in nsIBlocklistService. */ - _getAddonBlocklistState: function Blocklist_getAddonBlocklistStateCall(addon, - addonEntries, appVersion, toolkitVersion) { + _getAddonBlocklistState: function Blocklist_getAddonBlocklistStateCall(id, + version, addonEntries, appVersion, toolkitVersion) { if (!gBlocklistEnabled) return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; @@ -361,12 +359,12 @@ Blocklist.prototype = { if (!toolkitVersion) toolkitVersion = gApp.platformVersion; - var blItem = this._findMatchingAddonEntry(addonEntries, addon); + var blItem = this._findMatchingAddonEntry(addonEntries, id); if (!blItem) return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; for (let currentblItem of blItem.versions) { - if (currentblItem.includesItem(addon.version, appVersion, toolkitVersion)) + if (currentblItem.includesItem(version, appVersion, toolkitVersion)) return currentblItem.severity >= gBlocklistLevel ? Ci.nsIBlocklistService.STATE_BLOCKED : Ci.nsIBlocklistService.STATE_SOFTBLOCKED; } @@ -376,63 +374,36 @@ Blocklist.prototype = { /** * Returns the set of prefs of the add-on stored in the blocklist file * (probably to revert them on disabling). - * @param addon - * The add-on whose to-be-reset prefs are to be found. + * @param id + * ID of the add-on. */ - _getAddonPrefs: function Blocklist_getAddonPrefs(addon) { - let entry = this._findMatchingAddonEntry(this._addonEntries, addon); + _getAddonPrefs: function Blocklist_getAddonPrefs(id) { + let entry = this._findMatchingAddonEntry(this._addonEntries, id); return entry.prefs.slice(0); }, _findMatchingAddonEntry: function Blocklist_findMatchingAddonEntry(aAddonEntries, - aAddon) { - if (!aAddon) - return null; - // Returns true if the params object passes the constraints set by entry. - // (For every non-null property in entry, the same key must exist in - // params and value must be the same) - function checkEntry(entry, params) { - for (let [key, value] of entry) { - if (value === null || value === undefined) - continue; - if (params[key]) { - if (value instanceof RegExp) { - if (!value.test(params[key])) { - return false; - } - } else if (value !== params[key]) { - return false; - } - } else { - return false; - } - } - return true; - } - - let params = {}; - for (let filter of EXTENSION_BLOCK_FILTERS) { - params[filter] = aAddon[filter]; - } - if (params.creator) - params.creator = params.creator.name; + aId) { for (let entry of aAddonEntries) { - if (checkEntry(entry.attributes, params)) { - return entry; - } - } - return null; + if (entry.id instanceof RegExp) { + if (entry.id.test(aId)) + return entry; + } else if (entry.id == aId) { + return entry; + } + } + return null; }, /* See nsIBlocklistService */ - getAddonBlocklistURL: function Blocklist_getAddonBlocklistURL(addon, appVersion, toolkitVersion) { + getAddonBlocklistURL: function Blocklist_getAddonBlocklistURL(id, version, appVersion, toolkitVersion) { if (!gBlocklistEnabled) return ""; if (!this._addonEntries) this._loadBlocklist(); - let blItem = this._findMatchingAddonEntry(this._addonEntries, addon); + let blItem = this._findMatchingAddonEntry(this._addonEntries, id); if (!blItem || !blItem.blockID) return null; @@ -763,26 +734,18 @@ Blocklist.prototype = { return; let blockEntry = { + id: null, versions: [], prefs: [], - blockID: null, - attributes: new Map() - // Atleast one of EXTENSION_BLOCK_FILTERS must get added to attributes + blockID: null }; - // Any filter starting with '/' is interpreted as a regex. So if an attribute - // starts with a '/' it must be checked via a regex. - function regExpCheck(attr) { - return attr.startsWith("/") ? parseRegExp(attr) : attr; - } - - for (let filter of EXTENSION_BLOCK_FILTERS) { - let attr = blocklistElement.getAttribute(filter); - if (attr) - blockEntry.attributes.set(filter, regExpCheck(attr)); - } - var childNodes = blocklistElement.childNodes; + var id = blocklistElement.getAttribute("id"); + // Add-on IDs cannot contain '/', so an ID starting with '/' must be a regex + if (id.startsWith("/")) + id = parseRegExp(id); + blockEntry.id = id; for (let x = 0; x < childNodes.length; x++) { var childElement = childNodes.item(x); @@ -965,8 +928,9 @@ Blocklist.prototype = { for (let addon of addons) { let oldState = Ci.nsIBlocklistService.STATE_NOTBLOCKED; if (oldAddonEntries) - oldState = self._getAddonBlocklistState(addon, oldAddonEntries); - let state = self.getAddonBlocklistState(addon); + oldState = self._getAddonBlocklistState(addon.id, addon.version, + oldAddonEntries); + let state = self.getAddonBlocklistState(addon.id, addon.version); LOG("Blocklist state for " + addon.id + " changed from " + oldState + " to " + state); @@ -977,7 +941,7 @@ Blocklist.prototype = { if (state === Ci.nsIBlocklistService.STATE_BLOCKED) { // It's a hard block. We must reset certain preferences. - let prefs = self._getAddonPrefs(addon); + let prefs = self._getAddonPrefs(addon.id); resetPrefs(prefs); } @@ -1009,7 +973,7 @@ Blocklist.prototype = { disable: false, blocked: state == Ci.nsIBlocklistService.STATE_BLOCKED, item: addon, - url: self.getAddonBlocklistURL(addon), + url: self.getAddonBlocklistURL(addon.id), }); } @@ -1092,7 +1056,7 @@ Blocklist.prototype = { // This add-on is softblocked. addon.item.softDisabled = true; // We must revert certain prefs. - let prefs = self._getAddonPrefs(addon.item); + let prefs = self._getAddonPrefs(addon.item.id); resetPrefs(prefs); } } diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_blocklist_metadata_filters_1.xml b/toolkit/mozapps/extensions/test/xpcshell/data/test_blocklist_metadata_filters_1.xml deleted file mode 100644 index 368a6ed53fd..00000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/data/test_blocklist_metadata_filters_1.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug393285.xml b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug393285.xml index 1767b4332ff..fe92c132ca5 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/data/test_bug393285.xml +++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_bug393285.xml @@ -3,10 +3,7 @@ - - - - + diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js deleted file mode 100644 index 15e951bce3a..00000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_metadata_filters.js +++ /dev/null @@ -1,159 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -// Tests blocking of extensions by ID, name, creator, homepageURL, updateURL -// and RegExps for each. See bug 897735. - -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"); -var testserver = new HttpServer(); -testserver.start(-1); -gPort = testserver.identity.primaryPort; - -// register static files with server and interpolate port numbers in them -mapFile("/data/test_blocklist_metadata_filters_1.xml", testserver); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -// Don't need the full interface, attempts to call other methods will just -// throw which is just fine -var WindowWatcher = { - 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 = arguments.wrappedJSObject.list; - list.forEach(function(aItem) { - if (!aItem.blocked) - aItem.disable = true; - }); - - //run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed", null); - - }, - - QueryInterface: function(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -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() { - Services.obs.removeObserver(arguments.callee, "blocklist-updated"); - - do_execute_soon(aCallback); - }, "blocklist-updated", false); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + - gPort + "/data/" + aFile); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - - -function end_test() { - testserver.stop(do_test_finished); -} - -function run_test() { - do_test_pending(); - - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1"); - - // Should get blocked by name - writeInstallRDFForExtension({ - id: "block1@tests.mozilla.org", - version: "1.0", - name: "Mozilla Corp.", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - // Should get blocked by all the attributes. - writeInstallRDFForExtension({ - id: "block2@tests.mozilla.org", - version: "1.0", - name: "Moz-addon", - creator: "Dangerous", - homepageURL: "www.extension.dangerous.com", - updateURL: "www.extension.dangerous.com/update.rdf", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - // Fails to get blocked because of a different ID even though other - // attributes match against a blocklist entry. - writeInstallRDFForExtension({ - id: "block3@tests.mozilla.org", - version: "1.0", - name: "Moz-addon", - creator: "Dangerous", - homepageURL: "www.extensions.dangerous.com", - updateURL: "www.extension.dangerous.com/update.rdf", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(["block1@tests.mozilla.org", - "block2@tests.mozilla.org", - "block3@tests.mozilla.org"], function([a1, a2, a3]) { - do_check_eq(a1.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - do_check_eq(a2.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - do_check_eq(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - - run_test_1(); - }); -} - -function run_test_1() { - load_blocklist("test_blocklist_metadata_filters_1.xml", function() { - restartManager(); - - AddonManager.getAddonsByIDs(["block1@tests.mozilla.org", - "block2@tests.mozilla.org", - "block3@tests.mozilla.org"], function([a1, a2, a3]) { - do_check_eq(a1.blocklistState, Ci.nsIBlocklistService.STATE_SOFTBLOCKED); - do_check_eq(a2.blocklistState, Ci.nsIBlocklistService.STATE_BLOCKED); - do_check_eq(a3.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - end_test(); - }); - }); -} diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js index e691bb5708e..8bfef2feffd 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug335238.js @@ -79,10 +79,10 @@ var ADDONS = [ // This is a replacement for the blocklist service var BlocklistService = { - getAddonBlocklistState: function(aAddon, aAppVersion, aToolkitVersion) { - if (aAddon.id == "bug335238_3@tests.mozilla.org") + getAddonBlocklistState: function(aId, aVersion, aAppVersion, aToolkitVersion) { + if (aId == "bug335238_3@tests.mozilla.org") return Ci.nsIBlocklistService.STATE_SOFTBLOCKED; - if (aAddon.id == "bug335238_4@tests.mozilla.org") + if (aId == "bug335238_4@tests.mozilla.org") return Ci.nsIBlocklistService.STATE_BLOCKED; return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; }, @@ -91,8 +91,8 @@ var BlocklistService = { return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; }, - isAddonBlocklisted: function(aAddon, aAppVersion, aToolkitVersion) { - return this.getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) == + isAddonBlocklisted: function(aId, aVersion, aAppVersion, aToolkitVersion) { + return this.getAddonBlocklistState(aId, aVersion, aAppVersion, aToolkitVersion) == Ci.nsIBlocklistService.STATE_BLOCKED; }, diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js index 90cf2975330..c631ba4325b 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug393285.js @@ -3,325 +3,53 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -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"); -var testserver = new HttpServer(); -testserver.start(-1); -gPort = testserver.identity.primaryPort; - -// register static files with server and interpolate port numbers in them -mapFile("/data/test_bug393285.xml", testserver); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -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", - "test_bug393285_4@tests.mozilla.org", - "test_bug393285_5@tests.mozilla.org", - "test_bug393285_6@tests.mozilla.org", - "test_bug393285_7@tests.mozilla.org", - "test_bug393285_8@tests.mozilla.org", - "test_bug393285_9@tests.mozilla.org", - "test_bug393285_10@tests.mozilla.org", - "test_bug393285_11@tests.mozilla.org", - "test_bug393285_12@tests.mozilla.org", - "test_bug393285_13@tests.mozilla.org", - "test_bug393285_14@tests.mozilla.org"]; - -// A window watcher to deal with the blocklist UI dialog. -var WindowWatcher = { - 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 = arguments.wrappedJSObject.list; - list.forEach(function(aItem) { - if (!aItem.blocked) - aItem.disable = true; - }); - - //run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed", null); - - }, - - QueryInterface: function(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -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() { - Services.obs.removeObserver(arguments.callee, "blocklist-updated"); - - do_execute_soon(aCallback); - }, "blocklist-updated", false); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + - gPort + "/data/" + aFile); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - - -function end_test() { - testserver.stop(do_test_finished); -} - function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - writeInstallRDFForExtension({ - id: "test_bug393285_1@tests.mozilla.org", - name: "extension 1", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // We cannot force the blocklist to update so just copy our test list to the profile + var blocklistFile = gProfD.clone(); + blocklistFile.append("blocklist.xml"); + if (blocklistFile.exists()) + blocklistFile.remove(false); + var source = do_get_file("data/test_bug393285.xml"); + source.copyTo(gProfD, "blocklist.xml"); + var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"] + .getService(Components.interfaces.nsIBlocklistService); + + // No info in blocklist, shouldn't be blocked + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_1@tests.mozilla.org", "1", "1", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_2@tests.mozilla.org", - name: "extension 2", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Should always be blocked + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_2@tests.mozilla.org", "1", "1", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_3a@tests.mozilla.org", - name: "extension 3a", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Only version 1 should be blocked + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_3@tests.mozilla.org", "1", "1", "1.9")); + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_3@tests.mozilla.org", "2", "1", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_3b@tests.mozilla.org", - name: "extension 3b", - version: "2.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Should be blocked for app version 1 + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_4@tests.mozilla.org", "1", "1", "1.9")); + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_4@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_4@tests.mozilla.org", - name: "extension 4", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Not blocklisted because we are a different OS + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_5@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_5@tests.mozilla.org", - name: "extension 5", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Blocklisted based on OS + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_6@tests.mozilla.org", "1", "2", "1.9")); + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_7@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_6@tests.mozilla.org", - name: "extension 6", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Not blocklisted because we are a different ABI + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_8@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_7@tests.mozilla.org", - name: "extension 7", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Blocklisted based on ABI + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_9@tests.mozilla.org", "1", "2", "1.9")); + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_10@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_8@tests.mozilla.org", - name: "extension 8", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // Doesnt match both os and abi so not blocked + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_11@tests.mozilla.org", "1", "2", "1.9")); + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_12@tests.mozilla.org", "1", "2", "1.9")); + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_13@tests.mozilla.org", "1", "2", "1.9")); - writeInstallRDFForExtension({ - id: "test_bug393285_9@tests.mozilla.org", - name: "extension 9", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_10@tests.mozilla.org", - name: "extension 10", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_11@tests.mozilla.org", - name: "extension 11", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_12@tests.mozilla.org", - name: "extension 12", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_13@tests.mozilla.org", - name: "extension 13", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_14@tests.mozilla.org", - name: "extension 14", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(addonIDs, function(addons) { - for (addon of addons) { - do_check_eq(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - } - run_test_1(); - }); -} - -function run_test_1() { - load_blocklist("test_bug393285.xml", function() { - restartManager(); - - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"] - .getService(Ci.nsIBlocklistService); - - AddonManager.getAddonsByIDs(addonIDs, - function([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15]) { - // No info in blocklist, shouldn't be blocked - do_check_false(blocklist.isAddonBlocklisted(a1, "1", "1.9")); - - // Should always be blocked - do_check_true(blocklist.isAddonBlocklisted(a2, "1", "1.9")); - - // Only version 1 should be blocked - do_check_true(blocklist.isAddonBlocklisted(a3, "1", "1.9")); - do_check_false(blocklist.isAddonBlocklisted(a4, "1", "1.9")); - - // Should be blocked for app version 1 - do_check_true(blocklist.isAddonBlocklisted(a5, "1", "1.9")); - do_check_false(blocklist.isAddonBlocklisted(a5, "2", "1.9")); - - // Not blocklisted because we are a different OS - do_check_false(blocklist.isAddonBlocklisted(a6, "2", "1.9")); - - // Blocklisted based on OS - do_check_true(blocklist.isAddonBlocklisted(a7, "2", "1.9")); - do_check_true(blocklist.isAddonBlocklisted(a8, "2", "1.9")); - - // Not blocklisted because we are a different ABI - do_check_false(blocklist.isAddonBlocklisted(a9, "2", "1.9")); - - // Blocklisted based on ABI - do_check_true(blocklist.isAddonBlocklisted(a10, "2", "1.9")); - do_check_true(blocklist.isAddonBlocklisted(a11, "2", "1.9")); - - // Doesnt match both os and abi so not blocked - do_check_false(blocklist.isAddonBlocklisted(a12, "2", "1.9")); - do_check_false(blocklist.isAddonBlocklisted(a13, "2", "1.9")); - do_check_false(blocklist.isAddonBlocklisted(a14, "2", "1.9")); - - // Matches both os and abi so blocked - do_check_true(blocklist.isAddonBlocklisted(a15, "2", "1.9")); - end_test(); - }); - }); + // Matches both os and abi so blocked + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_14@tests.mozilla.org", "1", "2", "1.9")); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js index 724b48dd5bf..6ab86d2a0de 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug406118.js @@ -3,165 +3,24 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -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"]; - -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"); -var testserver = new HttpServer(); -testserver.start(-1); -gPort = testserver.identity.primaryPort; - -// register static files with server and interpolate port numbers in them -mapFile("/data/test_bug393285.xml", testserver); - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -// A window watcher to deal with the blocklist UI dialog. -var WindowWatcher = { - 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 = arguments.wrappedJSObject.list; - list.forEach(function(aItem) { - if (!aItem.blocked) - aItem.disable = true; - }); - - //run the code after the blocklist is closed - Services.obs.notifyObservers(null, "addon-blocklist-closed", null); - - }, - - QueryInterface: function(iid) { - if (iid.equals(Ci.nsIWindowWatcher) - || iid.equals(Ci.nsISupports)) - return this; - - throw Cr.NS_ERROR_NO_INTERFACE; - } -}; - -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() { - Services.obs.removeObserver(arguments.callee, "blocklist-updated"); - - do_execute_soon(aCallback); - }, "blocklist-updated", false); - - Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" + - gPort + "/data/" + aFile); - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"]. - getService(Ci.nsITimerCallback); - blocklist.notify(null); -} - - -function end_test() { - testserver.stop(do_test_finished); -} - function run_test() { - do_test_pending(); - createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); - writeInstallRDFForExtension({ - id: "test_bug393285_1@tests.mozilla.org", - name: "extension 1", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); + // We cannot force the blocklist to update so just copy our test list to the profile + var blocklistFile = gProfD.clone(); + blocklistFile.append("blocklist.xml"); + if (blocklistFile.exists()) + blocklistFile.remove(false); + var source = do_get_file("data/test_bug393285.xml"); + source.copyTo(gProfD, "blocklist.xml"); + var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"] + .getService(Components.interfaces.nsIBlocklistService); + + // All these should be blocklisted for the current app. + do_check_false(blocklist.isAddonBlocklisted("test_bug393285_1@tests.mozilla.org", "1", null, null)); + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_2@tests.mozilla.org", "1", null, null)); + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_3@tests.mozilla.org", "1", null, null)); + do_check_true(blocklist.isAddonBlocklisted("test_bug393285_4@tests.mozilla.org", "1", null, null)); - writeInstallRDFForExtension({ - id: "test_bug393285_2@tests.mozilla.org", - name: "extension 2", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_3a@tests.mozilla.org", - name: "extension 3a", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - writeInstallRDFForExtension({ - id: "test_bug393285_4@tests.mozilla.org", - name: "extension 4", - version: "1.0", - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }, profileDir); - - startupManager(); - - AddonManager.getAddonsByIDs(addonIDs, function(addons) { - for (addon of addons) { - do_check_eq(addon.blocklistState, Ci.nsIBlocklistService.STATE_NOT_BLOCKED); - } - run_test_1(); - }); -} - -function run_test_1() { - load_blocklist("test_bug393285.xml", function() { - restartManager(); - - var blocklist = Cc["@mozilla.org/extensions/blocklist;1"] - .getService(Ci.nsIBlocklistService); - - AddonManager.getAddonsByIDs(addonIDs, - function([a1, a2, a3, a4]) { - // No info in blocklist, shouldn't be blocked - do_check_false(blocklist.isAddonBlocklisted(a1, null, null)); - - // All these should be blocklisted for the current app. - do_check_true(blocklist.isAddonBlocklisted(a2, null, null)); - do_check_true(blocklist.isAddonBlocklisted(a3, null, null)); - do_check_true(blocklist.isAddonBlocklisted(a4, null, null)); - - end_test(); - }); - }); } diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js b/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js index 8c1ebe5ff26..1f0ec3e6f14 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug455906.js @@ -461,11 +461,11 @@ function check_test_pt3() { do_check_eq(check_addon_state(addons[3]), "false,false,true"); // Check blockIDs are correct - do_check_eq(blocklist.getAddonBlocklistURL(addons[0]),create_blocklistURL(addons[0].id)); - do_check_eq(blocklist.getAddonBlocklistURL(addons[1]),create_blocklistURL(addons[1].id)); - do_check_eq(blocklist.getAddonBlocklistURL(addons[2]),create_blocklistURL(addons[2].id)); - do_check_eq(blocklist.getAddonBlocklistURL(addons[3]),create_blocklistURL(addons[3].id)); - do_check_eq(blocklist.getAddonBlocklistURL(addons[4]),create_blocklistURL(addons[4].id)); + do_check_eq(blocklist.getAddonBlocklistURL(addons[0].id,''),create_blocklistURL(addons[0].id)); + do_check_eq(blocklist.getAddonBlocklistURL(addons[1].id,''),create_blocklistURL(addons[1].id)); + do_check_eq(blocklist.getAddonBlocklistURL(addons[2].id,''),create_blocklistURL(addons[2].id)); + do_check_eq(blocklist.getAddonBlocklistURL(addons[3].id,''),create_blocklistURL(addons[3].id)); + do_check_eq(blocklist.getAddonBlocklistURL(addons[4].id,''),create_blocklistURL(addons[4].id)); // All plugins have the same blockID on the test do_check_eq(blocklist.getPluginBlocklistURL(PLUGINS[0]), create_blocklistURL('test_bug455906_plugin')); diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini index 1b5c99b3f63..53f1b1a46c2 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini +++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini @@ -17,7 +17,6 @@ skip-if = os == "android" [test_badschema.js] [test_blocklistchange.js] [test_blocklist_prefs.js] -[test_blocklist_metadata_filters.js] # Bug 676992: test consistently hangs on Android skip-if = os == "android" [test_blocklist_regexp.js] diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index 7cebf0f2e36..494a2202056 100644 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -869,7 +869,7 @@ var gIncompatibleCheckPage = { // the add-on will become incompatible. let bs = CoC["@mozilla.org/extensions/blocklist;1"]. getService(CoI.nsIBlocklistService); - if (bs.isAddonBlocklisted(addon, + if (bs.isAddonBlocklisted(addon.id, install.version, gUpdates.update.appVersion, gUpdates.update.platformVersion)) return; diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index 8550e5e2bc3..e6475389e9d 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -2972,7 +2972,7 @@ UpdateService.prototype = { // the add-on will become incompatible. let bs = Cc["@mozilla.org/extensions/blocklist;1"]. getService(Ci.nsIBlocklistService); - if (bs.isAddonBlocklisted(addon, + if (bs.isAddonBlocklisted(addon.id, install.version, gUpdates.update.appVersion, gUpdates.update.platformVersion)) return; diff --git a/xpcom/system/nsIBlocklistService.idl b/xpcom/system/nsIBlocklistService.idl index eecfc68afd0..5f8104b0b6d 100644 --- a/xpcom/system/nsIBlocklistService.idl +++ b/xpcom/system/nsIBlocklistService.idl @@ -29,8 +29,10 @@ interface nsIBlocklistService : nsISupports /** * Determine if an item is blocklisted - * @param addon - * The addon item to be checked. + * @param id + * The ID of the item. + * @param version + * The item's version. * @param appVersion * The version of the application we are checking in the blocklist. * If this parameter is null, the version of the running application @@ -42,14 +44,16 @@ interface nsIBlocklistService : nsISupports * @returns true if the item is compatible with this version of the * application or this version of the toolkit, false, otherwise. */ - boolean isAddonBlocklisted(in jsval addon, + boolean isAddonBlocklisted(in AString id, in AString version, [optional] in AString appVersion, [optional] in AString toolkitVersion); /** * Determine the blocklist state of an add-on * @param id - * The addon item to be checked. + * The ID of the item. + * @param version + * The item's version. * @param appVersion * The version of the application we are checking in the blocklist. * If this parameter is null, the version of the running application @@ -60,7 +64,7 @@ interface nsIBlocklistService : nsISupports * is used. * @returns The STATE constant. */ - unsigned long getAddonBlocklistState(in jsval addon, + unsigned long getAddonBlocklistState(in AString id, in AString version, [optional] in AString appVersion, [optional] in AString toolkitVersion); @@ -84,11 +88,11 @@ interface nsIBlocklistService : nsISupports /** * Determine the blocklist web page of an add-on. - * @param addon - * The addon item whose url is required. + * @param id + * The ID of the blocked add-on. * @returns The URL of the description page. */ - AString getAddonBlocklistURL(in jsval addon, + AString getAddonBlocklistURL(in AString id, in AString version, [optional] in AString appVersion, [optional] in AString toolkitVersion);