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

Side by Side Diff: test/filterClasses.js

Issue 29876561: Issue 6931 - Allow content filters for localhost (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Limit scope to localhost Created Sept. 7, 2018, 2 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
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"]); 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.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"]); 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 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).
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
396 test.done(); 399 test.done();
397 }; 400 };
398 401
399 exports.testEmptyElemHideDomains = function(test) 402 exports.testEmptyElemHideDomains = function(test)
400 { 403 {
401 let emptyDomainFilters = [ 404 let emptyDomainFilters = [
402 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector", 405 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector",
403 ",foo.com##selector", "foo.com,~##selector", 406 ",foo.com##selector", "foo.com,~##selector",
404 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector" 407 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"
405 ]; 408 ];
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // This compares the references to make sure that both refer to the same 609 // This compares the references to make sure that both refer to the same
607 // object (#6815). 610 // object (#6815).
608 test.equal(filter1.domains, filter2.domains); 611 test.equal(filter1.domains, filter2.domains);
609 612
610 let filter3 = Filter.fromText("www.example.com##.bar"); 613 let filter3 = Filter.fromText("www.example.com##.bar");
611 614
612 test.notEqual(filter2.domains, filter3.domains); 615 test.notEqual(filter2.domains, filter3.domains);
613 616
614 test.done(); 617 test.done();
615 }; 618 };
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld