Index: test/filterListener.js |
=================================================================== |
--- a/test/filterListener.js |
+++ b/test/filterListener.js |
@@ -50,16 +50,18 @@ |
FilterStorage.addSubscription(Subscription.fromURL("~fl~")); |
FilterStorage.addSubscription(Subscription.fromURL("~wl~")); |
FilterStorage.addSubscription(Subscription.fromURL("~eh~")); |
Subscription.fromURL("~fl~").defaults = ["blocking"]; |
Subscription.fromURL("~wl~").defaults = ["whitelist"]; |
Subscription.fromURL("~eh~").defaults = ["elemhide"]; |
+ Subscription.fromURL("~fl~").trusted = false; |
+ |
callback(); |
}; |
function checkKnownFilters(test, text, expected) |
{ |
let result = {}; |
for (let type of ["blacklist", "whitelist"]) |
{ |
@@ -105,24 +107,29 @@ |
result[type].sort(); |
} |
test.deepEqual(result, expected, text); |
} |
exports.testAddingAndRemovingFilters = function(test) |
{ |
+ let filter0 = Filter.fromText("filter0"); |
let filter1 = Filter.fromText("filter1"); |
let filter2 = Filter.fromText("@@filter2"); |
let filter3 = Filter.fromText("##filter3"); |
let filter4 = Filter.fromText("!filter4"); |
let filter5 = Filter.fromText("#@#filter5"); |
let filter6 = Filter.fromText("example.com#?#:-abp-properties(filter6')"); |
let filter7 = Filter.fromText("example.com#@#[-abp-properties='filter7']"); |
+ filter0.needsTrust = true; |
+ FilterStorage.addFilter(filter0); |
+ checkKnownFilters(test, "add filter0", {}); |
+ |
FilterStorage.addFilter(filter1); |
checkKnownFilters(test, "add filter1", {blacklist: [filter1.text]}); |
FilterStorage.addFilter(filter2); |
checkKnownFilters(test, "add @@filter2", {blacklist: [filter1.text], whitelist: [filter2.text]}); |
FilterStorage.addFilter(filter3); |
checkKnownFilters(test, "add ##filter3", {blacklist: [filter1.text], whitelist: [filter2.text], elemhide: [filter3.text]}); |
FilterStorage.addFilter(filter4); |
checkKnownFilters(test, "add !filter4", {blacklist: [filter1.text], whitelist: [filter2.text], elemhide: [filter3.text]}); |