OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 checkMatch(test, ["@@||foo.com^"], "http://foo.com/bar", "IMAGE", "foo.com", f
alse, null, false, null, "@@||foo.com^"); | 238 checkMatch(test, ["@@||foo.com^"], "http://foo.com/bar", "IMAGE", "foo.com", f
alse, null, false, null, "@@||foo.com^"); |
239 checkMatch(test, ["/bar", "@@||foo.com^"], "http://foo.com/bar", "IMAGE", "foo
.com", false, null, false, "@@||foo.com^"); | 239 checkMatch(test, ["/bar", "@@||foo.com^"], "http://foo.com/bar", "IMAGE", "foo
.com", false, null, false, "@@||foo.com^"); |
240 checkMatch(test, ["/bar", "@@||foo.com^"], "http://foo.com/foo", "IMAGE", "foo
.com", false, null, false, null, "@@||foo.com^"); | 240 checkMatch(test, ["/bar", "@@||foo.com^"], "http://foo.com/foo", "IMAGE", "foo
.com", false, null, false, null, "@@||foo.com^"); |
241 checkMatch(test, ["||foo.com^$popup"], "http://foo.com/bar", "POPUP", "foo.com
", false, null, false, "||foo.com^$popup"); | 241 checkMatch(test, ["||foo.com^$popup"], "http://foo.com/bar", "POPUP", "foo.com
", false, null, false, "||foo.com^$popup"); |
242 checkMatch(test, ["@@||foo.com^$popup"], "http://foo.com/bar", "POPUP", "foo.c
om", false, null, false, null, "@@||foo.com^$popup"); | 242 checkMatch(test, ["@@||foo.com^$popup"], "http://foo.com/bar", "POPUP", "foo.c
om", false, null, false, null, "@@||foo.com^$popup"); |
243 checkMatch(test, ["||foo.com^$popup", "@@||foo.com^$popup"], "http://foo.com/b
ar", "POPUP", "foo.com", false, null, false, "@@||foo.com^$popup", "||foo.com^$p
opup"); | 243 checkMatch(test, ["||foo.com^$popup", "@@||foo.com^$popup"], "http://foo.com/b
ar", "POPUP", "foo.com", false, null, false, "@@||foo.com^$popup", "||foo.com^$p
opup"); |
244 checkMatch(test, ["||foo.com^$csp=script-src 'none'"], "http://foo.com/bar", "
CSP", "foo.com", false, null, false, "||foo.com^$csp=script-src 'none'"); | 244 checkMatch(test, ["||foo.com^$csp=script-src 'none'"], "http://foo.com/bar", "
CSP", "foo.com", false, null, false, "||foo.com^$csp=script-src 'none'"); |
245 checkMatch(test, ["@@||foo.com^$csp"], "http://foo.com/bar", "CSP", "foo.com",
false, null, false, null, "@@||foo.com^$csp"); | 245 checkMatch(test, ["@@||foo.com^$csp"], "http://foo.com/bar", "CSP", "foo.com",
false, null, false, null, "@@||foo.com^$csp"); |
246 checkMatch(test, ["||foo.com^$csp=script-src 'none'", "@@||foo.com^$csp"], "ht
tp://foo.com/bar", "CSP", "foo.com", false, null, false, "@@||foo.com^$csp", "||
foo.com^$csp=script-src 'none'"); | 246 checkMatch(test, ["||foo.com^$csp=script-src 'none'", "@@||foo.com^$csp"], "ht
tp://foo.com/bar", "CSP", "foo.com", false, null, false, "@@||foo.com^$csp", "||
foo.com^$csp=script-src 'none'"); |
247 | 247 |
| 248 // See #7312. |
| 249 checkMatch(test, ["^foo/bar/$script"], "http://foo/bar/", "SCRIPT", "example.c
om", true, null, true, null); |
| 250 checkMatch(test, ["^foo/bar/$script"], "http://foo/bar/", "SCRIPT", "example.c
om", true, null, false, "^foo/bar/$script"); |
| 251 checkMatch(test, ["^foo/bar/$script,domain=example.com", "@@^foo/bar/$script"]
, "http://foo/bar/", "SCRIPT", "example.com", true, null, true, "@@^foo/bar/$scr
ipt", "^foo/bar/$script,domain=example.com"); |
| 252 checkMatch(test, ["@@^foo/bar/$script", "^foo/bar/$script,domain=example.com"]
, "http://foo/bar/", "SCRIPT", "example.com", true, null, true, "@@^foo/bar/$scr
ipt", "^foo/bar/$script,domain=example.com"); |
| 253 checkMatch(test, ["@@^foo/bar/$script", "^foo/bar/$script,domain=example.com"]
, "http://foo/bar/", "SCRIPT", "example.com", true, null, false, "@@^foo/bar/$sc
ript"); |
| 254 |
248 test.done(); | 255 test.done(); |
249 }; | 256 }; |
250 | 257 |
251 exports.testFilterSearch = function(test) | 258 exports.testFilterSearch = function(test) |
252 { | 259 { |
253 // Start with three filters: foo, bar, and @@foo | 260 // Start with three filters: foo, bar, and @@foo |
254 let filters = ["foo", "bar", "@@foo"]; | 261 let filters = ["foo", "bar", "@@foo"]; |
255 | 262 |
256 checkSearch(test, filters, "http://example.com/foo", "IMAGE", "example.com", | 263 checkSearch(test, filters, "http://example.com/foo", "IMAGE", "example.com", |
257 false, null, false, "all", | 264 false, null, false, "all", |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 matcher.remove(Filter.fromText("/example/*$~third-party")); | 441 matcher.remove(Filter.fromText("/example/*$~third-party")); |
435 | 442 |
436 test.equal(matcher._blacklist._filterDomainMapsByKeyword.size, 0); | 443 test.equal(matcher._blacklist._filterDomainMapsByKeyword.size, 0); |
437 | 444 |
438 test.ok(!matcher.matchesAny("https://example.com/example/image.jpg", | 445 test.ok(!matcher.matchesAny("https://example.com/example/image.jpg", |
439 RegExpFilter.typeMap.IMAGE, "example.com", | 446 RegExpFilter.typeMap.IMAGE, "example.com", |
440 false)); | 447 false)); |
441 | 448 |
442 test.done(); | 449 test.done(); |
443 }; | 450 }; |
OLD | NEW |