OLD | NEW |
1 (function() | 1 (function() |
2 { | 2 { |
3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo
wn: restoreFilterComponents}); | 3 module("Matching of blocking filters", {setup: prepareFilterComponents, teardo
wn: restoreFilterComponents}); |
4 | 4 |
5 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey
, expected) | 5 function testMatch(text, location, contentType, docDomain, thirdParty, sitekey
, expected) |
6 { | 6 { |
7 function testMatch_internal(text, location, contentType, docDomain, thirdPar
ty, sitekey, expected) | 7 function testMatch_internal(text, location, contentType, docDomain, thirdPar
ty, sitekey, expected) |
8 { | 8 { |
9 let filter = Filter.fromText(text); | 9 let filter = Filter.fromText(text); |
10 let result = filter.matches(location, contentType, docDomain, thirdParty,
sitekey); | 10 let result = filter.matches(location, contentType, docDomain, thirdParty,
sitekey); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 testMatch("abc$sitekey=foo-publickey", "http://ccc/def", "IMAGE", "foo.com",
true, "foo-publickey", false); | 286 testMatch("abc$sitekey=foo-publickey", "http://ccc/def", "IMAGE", "foo.com",
true, "foo-publickey", false); |
287 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA
GE", "foo.com", true, "foo-publickey", true); | 287 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA
GE", "foo.com", true, "foo-publickey", true); |
288 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA
GE", "bar.com", true, "foo-publickey", false); | 288 testMatch("abc$domain=foo.com,sitekey=foo-publickey", "http://abc/def", "IMA
GE", "bar.com", true, "foo-publickey", false); |
289 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM
AGE", "foo.com", true, "foo-publickey", false); | 289 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM
AGE", "foo.com", true, "foo-publickey", false); |
290 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM
AGE", "bar.com", true, "foo-publickey", true); | 290 testMatch("abc$domain=~foo.com,sitekey=foo-publickey", "http://abc/def", "IM
AGE", "bar.com", true, "foo-publickey", true); |
291 }); | 291 }); |
292 | 292 |
293 test("Exception rules", function() | 293 test("Exception rules", function() |
294 { | 294 { |
295 testMatch("@@test", "http://test/", "DOCUMENT", null, false, null, false); | 295 testMatch("@@test", "http://test/", "DOCUMENT", null, false, null, false); |
296 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, null, t
rue); | 296 testMatch("@@http://test*", "http://test/", "DOCUMENT", null, false, null, f
alse); |
297 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, null, tru
e); | 297 testMatch("@@ftp://test*", "ftp://test/", "DOCUMENT", null, false, null, fal
se); |
298 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, null,
true); | 298 testMatch("@@test$document", "http://test/", "DOCUMENT", null, false, null,
true); |
299 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false,
null, true); | 299 testMatch("@@test$document,image", "http://test/", "DOCUMENT", null, false,
null, true); |
300 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, null, fa
lse); | 300 testMatch("@@test$~image", "http://test/", "DOCUMENT", null, false, null, fa
lse); |
301 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false,
null, true); | 301 testMatch("@@test$~image,document", "http://test/", "DOCUMENT", null, false,
null, true); |
302 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false,
null, true); | 302 testMatch("@@test$document,~image", "http://test/", "DOCUMENT", null, false,
null, true); |
303 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo
.com", false, null, true); | 303 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "foo
.com", false, null, true); |
304 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar
.com", false, null, false); | 304 testMatch("@@test$document,domain=foo.com", "http://test/", "DOCUMENT", "bar
.com", false, null, false); |
305 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo
o.com", false, null, false); | 305 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "fo
o.com", false, null, false); |
306 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba
r.com", false, null, true); | 306 testMatch("@@test$document,domain=~foo.com", "http://test/", "DOCUMENT", "ba
r.com", false, null, true); |
307 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT
", "foo.com", false, "foo-publickey", true); | 307 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT
", "foo.com", false, "foo-publickey", true); |
308 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT
", "foo.com", false, null, false); | 308 testMatch("@@test$document,sitekey=foo-publickey", "http://test/", "DOCUMENT
", "foo.com", false, null, false); |
309 }); | 309 }); |
310 })(); | 310 })(); |
OLD | NEW |