| Index: test/matcher.js |
| =================================================================== |
| --- a/test/matcher.js |
| +++ b/test/matcher.js |
| @@ -244,8 +244,40 @@ |
| cacheCheck(test, matcher, "http://abc_cba", "MEDIA", null, true, "cba$third-party"); |
| cacheCheck(test, matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script"); |
| cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, false, "http://fed$~third-party,~script"); |
| cacheCheck(test, matcher, "http://def?http://fed", "MEDIA", null, true, "http://fed$third-party"); |
| cacheCheck(test, matcher, "http://def?http://fed", "SCRIPT", null, false, "http://def$script"); |
| test.done(); |
| }; |
| + |
| +exports.testWhitelisted = function(test) |
| +{ |
| + let matcher = new CombinedMatcher(); |
| + |
| + test.ok(!matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/bar", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.SUBDOCUMENT)); |
| + |
| + matcher.add(Filter.fromText("@@/foo^$image")); |
| + |
| + test.ok(matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/bar", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.SUBDOCUMENT)); |
| + |
| + matcher.remove(Filter.fromText("@@/foo^$image")); |
| + |
| + test.ok(!matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/bar", |
| + RegExpFilter.typeMap.IMAGE)); |
| + test.ok(!matcher.isWhitelisted("https://example.com/foo", |
| + RegExpFilter.typeMap.SUBDOCUMENT)); |
| + |
| + test.done(); |
| +}; |