зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1451487 - remove nsIBlocklistService::isAddonBlocklisted as it's unused, r=mossop
MozReview-Commit-ID: Ht9DgjliSoo --HG-- extra : rebase_source : 27d0152d861cd2269e456267fd5091de394fb132
This commit is contained in:
Родитель
74a3a94cbd
Коммит
d1bb2f7d29
|
@ -44,10 +44,6 @@ var BlocklistProxy = {
|
|||
observe(aSubject, aTopic, aData) {
|
||||
},
|
||||
|
||||
isAddonBlocklisted(aAddon, aAppVersion, aToolkitVersion) {
|
||||
return false;
|
||||
},
|
||||
|
||||
getAddonBlocklistState(aAddon, aAppVersion, aToolkitVersion) {
|
||||
return 0; // STATE_NOT_BLOCKED
|
||||
},
|
||||
|
|
|
@ -140,11 +140,6 @@ class MockBlocklist {
|
|||
getPluginBlocklistState(plugin, version, appVersion, toolkitVersion) {
|
||||
return Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
|
||||
}
|
||||
|
||||
isAddonBlocklisted(addon, appVersion, toolkitVersion) {
|
||||
return this.getAddonBlocklistState(addon, appVersion, toolkitVersion) ==
|
||||
Ci.nsIBlocklistService.STATE_BLOCKED;
|
||||
}
|
||||
}
|
||||
|
||||
MockBlocklist.prototype.QueryInterface = XPCOMUtils.generateQI(["nsIBlocklistService"]);
|
||||
|
|
|
@ -291,12 +291,6 @@ Blocklist.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
/* See nsIBlocklistService */
|
||||
isAddonBlocklisted(addon, appVersion, toolkitVersion) {
|
||||
return this.getAddonBlocklistState(addon, appVersion, toolkitVersion) ==
|
||||
Ci.nsIBlocklistService.STATE_BLOCKED;
|
||||
},
|
||||
|
||||
/* See nsIBlocklistService */
|
||||
getAddonBlocklistState(addon, appVersion, toolkitVersion) {
|
||||
if (!this.isLoaded)
|
||||
|
|
|
@ -286,13 +286,16 @@ add_task(async function test_1() {
|
|||
await loadBlocklist("test_bug393285.xml");
|
||||
|
||||
let addons = await getAddons(ADDON_IDS);
|
||||
function isBlocklisted(addon, appVer, toolkitVer) {
|
||||
return Services.blocklist.getAddonBlocklistState(addon, appVer, toolkitVer) != Services.blocklist.STATE_NOT_BLOCKED;
|
||||
}
|
||||
for (let [id, options] of Object.entries(ADDONS)) {
|
||||
for (let blocklisted of options.blocklisted || []) {
|
||||
ok(Services.blocklist.isAddonBlocklisted(addons.get(id), ...blocklisted),
|
||||
ok(isBlocklisted(addons.get(id), ...blocklisted),
|
||||
`Add-on ${id} should be blocklisted in app/platform version ${blocklisted}`);
|
||||
}
|
||||
for (let notBlocklisted of options.notBlocklisted || []) {
|
||||
ok(!Services.blocklist.isAddonBlocklisted(addons.get(id), ...notBlocklisted),
|
||||
ok(!isBlocklisted(addons.get(id), ...notBlocklisted),
|
||||
`Add-on ${id} should not be blocklisted in app/platform version ${notBlocklisted}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,11 @@ function run_test() {
|
|||
run_next_test();
|
||||
}
|
||||
|
||||
// On first run whatever is in the app dir should get copied to the profile
|
||||
function isBlocklisted(addon, appVer, toolkitVer) {
|
||||
return Services.blocklist.getAddonBlocklistState(addon, appVer, toolkitVer) != Services.blocklist.STATE_NOT_BLOCKED;
|
||||
}
|
||||
|
||||
// On first run whataver is in the app dir should get copied to the profile
|
||||
add_test(function test_copy() {
|
||||
clearBlocklists();
|
||||
copyToApp(OLD);
|
||||
|
@ -93,11 +97,10 @@ add_test(function test_copy() {
|
|||
startupManager();
|
||||
|
||||
reloadBlocklist();
|
||||
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(invalidAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(ancientAddon));
|
||||
Assert.ok(Services.blocklist.isAddonBlocklisted(oldAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(newAddon));
|
||||
Assert.ok(!isBlocklisted(invalidAddon));
|
||||
Assert.ok(!isBlocklisted(ancientAddon));
|
||||
Assert.ok(isBlocklisted(oldAddon));
|
||||
Assert.ok(!isBlocklisted(newAddon));
|
||||
|
||||
shutdownManager();
|
||||
|
||||
|
@ -115,10 +118,10 @@ add_test(function test_ancient() {
|
|||
|
||||
reloadBlocklist();
|
||||
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(invalidAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(ancientAddon));
|
||||
Assert.ok(Services.blocklist.isAddonBlocklisted(oldAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(newAddon));
|
||||
Assert.ok(!isBlocklisted(invalidAddon));
|
||||
Assert.ok(!isBlocklisted(ancientAddon));
|
||||
Assert.ok(isBlocklisted(oldAddon));
|
||||
Assert.ok(!isBlocklisted(newAddon));
|
||||
|
||||
shutdownManager();
|
||||
|
||||
|
@ -136,10 +139,10 @@ add_test(function test_override() {
|
|||
|
||||
reloadBlocklist();
|
||||
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(invalidAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(ancientAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(oldAddon));
|
||||
Assert.ok(Services.blocklist.isAddonBlocklisted(newAddon));
|
||||
Assert.ok(!isBlocklisted(invalidAddon));
|
||||
Assert.ok(!isBlocklisted(ancientAddon));
|
||||
Assert.ok(!isBlocklisted(oldAddon));
|
||||
Assert.ok(isBlocklisted(newAddon));
|
||||
|
||||
shutdownManager();
|
||||
|
||||
|
@ -157,10 +160,10 @@ add_test(function test_retain() {
|
|||
|
||||
reloadBlocklist();
|
||||
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(invalidAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(ancientAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(oldAddon));
|
||||
Assert.ok(Services.blocklist.isAddonBlocklisted(newAddon));
|
||||
Assert.ok(!isBlocklisted(invalidAddon));
|
||||
Assert.ok(!isBlocklisted(ancientAddon));
|
||||
Assert.ok(!isBlocklisted(oldAddon));
|
||||
Assert.ok(isBlocklisted(newAddon));
|
||||
|
||||
shutdownManager();
|
||||
|
||||
|
@ -183,10 +186,10 @@ add_test(function test_missing() {
|
|||
|
||||
reloadBlocklist();
|
||||
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(invalidAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(ancientAddon));
|
||||
Assert.ok(Services.blocklist.isAddonBlocklisted(oldAddon));
|
||||
Assert.ok(!Services.blocklist.isAddonBlocklisted(newAddon));
|
||||
Assert.ok(!isBlocklisted(invalidAddon));
|
||||
Assert.ok(!isBlocklisted(ancientAddon));
|
||||
Assert.ok(isBlocklisted(oldAddon));
|
||||
Assert.ok(!isBlocklisted(newAddon));
|
||||
|
||||
shutdownManager();
|
||||
|
||||
|
|
|
@ -27,25 +27,6 @@ interface nsIBlocklistService : nsISupports
|
|||
// Indicates that the item is vulnerable and there is no update.
|
||||
const unsigned long STATE_VULNERABLE_NO_UPDATE = 5;
|
||||
|
||||
/**
|
||||
* Determine if an item is blocklisted
|
||||
* @param addon
|
||||
* The addon item to be checked.
|
||||
* @param appVersion
|
||||
* The version of the application we are checking in the blocklist.
|
||||
* If this parameter is null, the version of the running application
|
||||
* is used.
|
||||
* @param toolkitVersion
|
||||
* The version of the toolkit we are checking in the blocklist.
|
||||
* If this parameter is null, the version of the running toolkit
|
||||
* is used.
|
||||
* @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,
|
||||
[optional] in AString appVersion,
|
||||
[optional] in AString toolkitVersion);
|
||||
|
||||
/**
|
||||
* Determine the blocklist state of an add-on
|
||||
* @param id
|
||||
|
|
Загрузка…
Ссылка в новой задаче