Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29876561: Issue 6931 - Allow content filters for localhost (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Limit scope to localhost Created Sept. 7, 2018, 2 a.m.
Right Patch Set: Use includes Created Sept. 10, 2018, 5:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « lib/filterClasses.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 // Check some special cases 389 // Check some special cases
390 compareFilter(test, "#?#:-abp-properties(abc)", ["type=invalid", "text=#?#:-ab p-properties(abc)", "reason=filter_elemhideemulation_nodomain"]); 390 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"]); 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#?#:-abp-foobar(abc)", ["type=elemhideemulation", "text=foo.com#?#:-abp-foobar(abc)", "selectorDomains=foo.com", "selector=:-abp-f oobar(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#?#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"]); 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#?#:-abp-properties(|background-image: url(data:*) )", ["type=elemhideemulation", "text=foo.com#?#:-abp-properties(|background-imag e: url(data:*))", "selectorDomains=foo.com", "selector=:-abp-properties(|backgro und-image: url(data:*))", "domains=foo.com"]); 394 compareFilter(test, "foo.com#?#:-abp-properties(|background-image: url(data:*) )", ["type=elemhideemulation", "text=foo.com#?#:-abp-properties(|background-imag e: url(data:*))", "selectorDomains=foo.com", "selector=:-abp-properties(|backgro und-image: url(data:*))", "domains=foo.com"]);
395 395
396 // Support element hiding emulation filters for localhost (#6931). 396 // Support element hiding emulation filters for localhost (#6931).
397 compareFilter(test, "localhost#?#:-abp-properties(abc)", ["type=elemhideemulat ion", "text=localhost#?#:-abp-properties(abc)", "selectorDomains=localhost", "se lector=:-abp-properties(abc)", "domains=localhost"]); 397 compareFilter(test, "localhost#?#:-abp-properties(abc)", ["type=elemhideemulat ion", "text=localhost#?#:-abp-properties(abc)", "selectorDomains=localhost", "se lector=:-abp-properties(abc)", "domains=localhost"]);
398 compareFilter(test, "localhost,~www.localhost#?#:-abp-properties(abc)", ["type =elemhideemulation", "text=localhost,~www.localhost#?#:-abp-properties(abc)", "s electorDomains=localhost", "selector=:-abp-properties(abc)", "domains=localhost| ~www.localhost"]);
399 compareFilter(test, "~www.localhost,localhost#?#:-abp-properties(abc)", ["type =elemhideemulation", "text=~www.localhost,localhost#?#:-abp-properties(abc)", "s electorDomains=localhost", "selector=:-abp-properties(abc)", "domains=localhost| ~www.localhost"]);
398 400
399 test.done(); 401 test.done();
400 }; 402 };
401 403
402 exports.testEmptyElemHideDomains = function(test) 404 exports.testEmptyElemHideDomains = function(test)
403 { 405 {
404 let emptyDomainFilters = [ 406 let emptyDomainFilters = [
405 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector", 407 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector",
406 ",foo.com##selector", "foo.com,~##selector", 408 ",foo.com##selector", "foo.com,~##selector",
407 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector" 409 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // This compares the references to make sure that both refer to the same 611 // This compares the references to make sure that both refer to the same
610 // object (#6815). 612 // object (#6815).
611 test.equal(filter1.domains, filter2.domains); 613 test.equal(filter1.domains, filter2.domains);
612 614
613 let filter3 = Filter.fromText("www.example.com##.bar"); 615 let filter3 = Filter.fromText("www.example.com##.bar");
614 616
615 test.notEqual(filter2.domains, filter3.domains); 617 test.notEqual(filter2.domains, filter3.domains);
616 618
617 test.done(); 619 test.done();
618 }; 620 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld