Bug 1451743 - remove getAddonBlocklistURL from nsIBlocklistService, r=florian

MozReview-Commit-ID: HSrOHIZ1MA

--HG--
extra : rebase_source : 271b94bc2e90979c78d665882437a87d0b9e96d6
This commit is contained in:
Gijs Kruitbosch 2018-04-05 15:05:28 +01:00
Родитель 47e3fce893
Коммит 3319ebe86f
4 изменённых файлов: 12 добавлений и 29 удалений

Просмотреть файл

@ -52,10 +52,6 @@ var BlocklistProxy = {
return 0; // STATE_NOT_BLOCKED
},
getAddonBlocklistURL(aAddon, aAppVersion, aToolkitVersion) {
return "";
},
getPluginBlocklistURL(aPluginTag) {
return "";
},

Просмотреть файл

@ -431,15 +431,6 @@ Blocklist.prototype = {
return null;
},
/* See nsIBlocklistService */
getAddonBlocklistURL(addon, appVersion, toolkitVersion) {
if (!this.isLoaded)
this._loadBlocklist();
let entry = this._getAddonBlocklistEntry(addon, this._addonEntries);
return entry && entry.url;
},
_createBlocklistURL(id) {
let url = Services.urlFormatter.formatURLPref(PREF_BLOCKLIST_ITEM_URL);
url = url.replace(/%blockID%/g, id);
@ -1292,6 +1283,7 @@ Blocklist.prototype = {
continue;
}
let entry = this._getAddonBlocklistEntry(addon, this._addonEntries);
addonList.push({
name: addon.name,
version: addon.version,
@ -1299,7 +1291,7 @@ Blocklist.prototype = {
disable: false,
blocked: state == Ci.nsIBlocklistService.STATE_BLOCKED,
item: addon,
url: this.getAddonBlocklistURL(addon),
url: entry && entry.url,
});
}

Просмотреть файл

@ -14,6 +14,11 @@ gTestserver.registerDirectory("/data/", do_get_file("data"));
const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL";
Services.prefs.setCharPref(PREF_BLOCKLIST_ITEM_URL, "http://example.com/blocklist/%blockID%");
function getAddonBlocklistURL(addon) {
let entry = Services.blocklist.getAddonBlocklistEntry(addon);
return entry && entry.url;
}
var ADDONS = [{
// Tests how the blocklist affects a disabled add-on
id: "test_bug455906_1@tests.mozilla.org",
@ -361,11 +366,11 @@ add_task(async function test_pt3() {
checkAddonState(addons[3], {userDisabled: false, softDisabled: false, appDisabled: true});
// Check blockIDs are correct
equal(Services.blocklist.getAddonBlocklistURL(addons[0]), create_blocklistURL(addons[0].id));
equal(Services.blocklist.getAddonBlocklistURL(addons[1]), create_blocklistURL(addons[1].id));
equal(Services.blocklist.getAddonBlocklistURL(addons[2]), create_blocklistURL(addons[2].id));
equal(Services.blocklist.getAddonBlocklistURL(addons[3]), create_blocklistURL(addons[3].id));
equal(Services.blocklist.getAddonBlocklistURL(addons[4]), create_blocklistURL(addons[4].id));
equal(getAddonBlocklistURL(addons[0]), create_blocklistURL(addons[0].id));
equal(getAddonBlocklistURL(addons[1]), create_blocklistURL(addons[1].id));
equal(getAddonBlocklistURL(addons[2]), create_blocklistURL(addons[2].id));
equal(getAddonBlocklistURL(addons[3]), create_blocklistURL(addons[3].id));
equal(getAddonBlocklistURL(addons[4]), create_blocklistURL(addons[4].id));
// All plugins have the same blockID on the test
equal(Services.blocklist.getPluginBlocklistURL(PLUGINS[0]), create_blocklistURL("test_bug455906_plugin"));

Просмотреть файл

@ -63,16 +63,6 @@ interface nsIBlocklistService : nsISupports
[optional] in AString appVersion,
[optional] in AString toolkitVersion);
/**
* Determine the blocklist web page of an add-on.
* @param addon
* The addon item whose url is required.
* @returns The URL of the description page.
*/
AString getAddonBlocklistURL(in jsval addon,
[optional] in AString appVersion,
[optional] in AString toolkitVersion);
/**
* Returns the blocklist entry, as an object with `state` and `url`
* properties, if a blocklist entry for the add-on exists, or null