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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 compareFilter( | 254 compareFilter( |
255 test, filterText, [ | 255 test, filterText, [ |
256 "type=invalid", "text=" + filterText, | 256 "type=invalid", "text=" + filterText, |
257 "reason=filter_elemhideemulation_nodomain" | 257 "reason=filter_elemhideemulation_nodomain" |
258 ] | 258 ] |
259 ); | 259 ); |
260 } | 260 } |
261 checkElemHideEmulationFilterInvalid(""); | 261 checkElemHideEmulationFilterInvalid(""); |
262 checkElemHideEmulationFilterInvalid("~foo.com"); | 262 checkElemHideEmulationFilterInvalid("~foo.com"); |
263 checkElemHideEmulationFilterInvalid("~foo.com,~bar.com"); | 263 checkElemHideEmulationFilterInvalid("~foo.com,~bar.com"); |
264 checkElemHideEmulationFilterInvalid("foo"); | |
265 checkElemHideEmulationFilterInvalid("~foo.com,bar"); | |
266 | 264 |
267 test.done(); | 265 test.done(); |
268 }; | 266 }; |
269 | 267 |
270 exports.testFiltersWithState = function(test) | 268 exports.testFiltersWithState = function(test) |
271 { | 269 { |
272 compareFilter(test, "blabla", ["type=filterlist", "text=blabla", "regexp=blabl
a"]); | 270 compareFilter(test, "blabla", ["type=filterlist", "text=blabla", "regexp=blabl
a"]); |
273 compareFilter( | 271 compareFilter( |
274 test, "blabla_default", ["type=filterlist", "text=blabla_default", "regexp=b
labla_default"], | 272 test, "blabla_default", ["type=filterlist", "text=blabla_default", "regexp=b
labla_default"], |
275 filter => | 273 filter => |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 compareFilter(test, "Foo,bAr#@#ddd", ["type=elemhideexception", "text=Foo,bAr#
@#ddd", "selectorDomains=foo,bar", "selector=ddd", "domains=bar|foo"]); | 372 compareFilter(test, "Foo,bAr#@#ddd", ["type=elemhideexception", "text=Foo,bAr#
@#ddd", "selectorDomains=foo,bar", "selector=ddd", "domains=bar|foo"]); |
375 compareFilter(test, "foo,~baR#@#ddd", ["type=elemhideexception", "text=foo,~ba
R#@#ddd", "selectorDomains=foo", "selector=ddd", "domains=foo|~bar"]); | 373 compareFilter(test, "foo,~baR#@#ddd", ["type=elemhideexception", "text=foo,~ba
R#@#ddd", "selectorDomains=foo", "selector=ddd", "domains=foo|~bar"]); |
376 compareFilter(test, "foo,~baz,bar#@#ddd", ["type=elemhideexception", "text=foo
,~baz,bar#@#ddd", "selectorDomains=foo,bar", "selector=ddd", "domains=bar|foo|~b
az"]); | 374 compareFilter(test, "foo,~baz,bar#@#ddd", ["type=elemhideexception", "text=foo
,~baz,bar#@#ddd", "selectorDomains=foo,bar", "selector=ddd", "domains=bar|foo|~b
az"]); |
377 | 375 |
378 test.done(); | 376 test.done(); |
379 }; | 377 }; |
380 | 378 |
381 exports.testElemHideEmulationFilters = function(test) | 379 exports.testElemHideEmulationFilters = function(test) |
382 { | 380 { |
383 // Check valid domain combinations | 381 // Check valid domain combinations |
| 382 compareFilter(test, "foo#?#:-abp-properties(abc)", ["type=elemhideemulation",
"text=foo#?#:-abp-properties(abc)", "selectorDomains=foo", "selector=:-abp-prope
rties(abc)", "domains=foo"]); |
| 383 compareFilter(test, "foo,~bar#?#:-abp-properties(abc)", ["type=elemhideemulati
on", "text=foo,~bar#?#:-abp-properties(abc)", "selectorDomains=foo", "selector=:
-abp-properties(abc)", "domains=foo|~bar"]); |
| 384 compareFilter(test, "~foo,bar#?#:-abp-properties(abc)", ["type=elemhideemulati
on", "text=~foo,bar#?#:-abp-properties(abc)", "selectorDomains=bar", "selector=:
-abp-properties(abc)", "domains=bar|~foo"]); |
384 compareFilter(test, "fOO.cOm#?#:-abp-properties(abc)", ["type=elemhideemulatio
n", "text=fOO.cOm#?#:-abp-properties(abc)", "selectorDomains=foo.com", "selector
=:-abp-properties(abc)", "domains=foo.com"]); | 385 compareFilter(test, "fOO.cOm#?#:-abp-properties(abc)", ["type=elemhideemulatio
n", "text=fOO.cOm#?#:-abp-properties(abc)", "selectorDomains=foo.com", "selector
=:-abp-properties(abc)", "domains=foo.com"]); |
385 compareFilter(test, "Foo.com,~bAr.com#?#:-abp-properties(abc)", ["type=elemhid
eemulation", "text=Foo.com,~bAr.com#?#:-abp-properties(abc)", "selectorDomains=f
oo.com", "selector=:-abp-properties(abc)", "domains=foo.com|~bar.com"]); | 386 compareFilter(test, "Foo.com,~bAr.com#?#:-abp-properties(abc)", ["type=elemhid
eemulation", "text=Foo.com,~bAr.com#?#:-abp-properties(abc)", "selectorDomains=f
oo.com", "selector=:-abp-properties(abc)", "domains=foo.com|~bar.com"]); |
386 compareFilter(test, "foo.com,~baR#?#:-abp-properties(abc)", ["type=elemhideemu
lation", "text=foo.com,~baR#?#:-abp-properties(abc)", "selectorDomains=foo.com",
"selector=:-abp-properties(abc)", "domains=foo.com|~bar"]); | 387 compareFilter(test, "foo.com,~baR#?#:-abp-properties(abc)", ["type=elemhideemu
lation", "text=foo.com,~baR#?#:-abp-properties(abc)", "selectorDomains=foo.com",
"selector=:-abp-properties(abc)", "domains=foo.com|~bar"]); |
387 compareFilter(test, "~foo.com,bar.com#?#:-abp-properties(abc)", ["type=elemhid
eemulation", "text=~foo.com,bar.com#?#:-abp-properties(abc)", "selectorDomains=b
ar.com", "selector=:-abp-properties(abc)", "domains=bar.com|~foo.com"]); | 388 compareFilter(test, "~foo.com,bar.com#?#:-abp-properties(abc)", ["type=elemhid
eemulation", "text=~foo.com,bar.com#?#:-abp-properties(abc)", "selectorDomains=b
ar.com", "selector=:-abp-properties(abc)", "domains=bar.com|~foo.com"]); |
388 | 389 |
389 // Check some special cases | 390 // Check some special cases |
390 compareFilter(test, "#?#:-abp-properties(abc)", ["type=invalid", "text=#?#:-ab
p-properties(abc)", "reason=filter_elemhideemulation_nodomain"]); | 391 compareFilter(test, "#?#:-abp-properties(abc)", ["type=invalid", "text=#?#:-ab
p-properties(abc)", "reason=filter_elemhideemulation_nodomain"]); |
391 compareFilter(test, "foo.com#?#abc", ["type=elemhideemulation", "text=foo.com#
?#abc", "selectorDomains=foo.com", "selector=abc", "domains=foo.com"]); | 392 compareFilter(test, "foo.com#?#abc", ["type=elemhideemulation", "text=foo.com#
?#abc", "selectorDomains=foo.com", "selector=abc", "domains=foo.com"]); |
392 compareFilter(test, "foo.com#?#:-abp-foobar(abc)", ["type=elemhideemulation",
"text=foo.com#?#:-abp-foobar(abc)", "selectorDomains=foo.com", "selector=:-abp-f
oobar(abc)", "domains=foo.com"]); | 393 compareFilter(test, "foo.com#?#:-abp-foobar(abc)", ["type=elemhideemulation",
"text=foo.com#?#:-abp-foobar(abc)", "selectorDomains=foo.com", "selector=:-abp-f
oobar(abc)", "domains=foo.com"]); |
393 compareFilter(test, "foo.com#?#aaa :-abp-properties(abc) bbb", ["type=elemhide
emulation", "text=foo.com#?#aaa :-abp-properties(abc) bbb", "selectorDomains=foo
.com", "selector=aaa :-abp-properties(abc) bbb", "domains=foo.com"]); | 394 compareFilter(test, "foo.com#?#aaa :-abp-properties(abc) bbb", ["type=elemhide
emulation", "text=foo.com#?#aaa :-abp-properties(abc) bbb", "selectorDomains=foo
.com", "selector=aaa :-abp-properties(abc) bbb", "domains=foo.com"]); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 // This compares the references to make sure that both refer to the same | 607 // This compares the references to make sure that both refer to the same |
607 // object (#6815). | 608 // object (#6815). |
608 test.equal(filter1.domains, filter2.domains); | 609 test.equal(filter1.domains, filter2.domains); |
609 | 610 |
610 let filter3 = Filter.fromText("www.example.com##.bar"); | 611 let filter3 = Filter.fromText("www.example.com##.bar"); |
611 | 612 |
612 test.notEqual(filter2.domains, filter3.domains); | 613 test.notEqual(filter2.domains, filter3.domains); |
613 | 614 |
614 test.done(); | 615 test.done(); |
615 }; | 616 }; |
OLD | NEW |