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

Side by Side Diff: test/filterClasses.js

Issue 30000586: Issue 7265 - Orgnanize request blocking filters by domain (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase Created Feb. 7, 2019, 3:45 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/matcher.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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 623
624 exports.testDomainMapDeduplication = function(test) 624 exports.testDomainMapDeduplication = function(test)
625 { 625 {
626 let filter1 = Filter.fromText("foo$domain=blocking.example.com"); 626 let filter1 = Filter.fromText("foo$domain=blocking.example.com");
627 let filter2 = Filter.fromText("bar$domain=blocking.example.com"); 627 let filter2 = Filter.fromText("bar$domain=blocking.example.com");
628 let filter3 = Filter.fromText("elemhide.example.com##.foo"); 628 let filter3 = Filter.fromText("elemhide.example.com##.foo");
629 let filter4 = Filter.fromText("elemhide.example.com##.bar"); 629 let filter4 = Filter.fromText("elemhide.example.com##.bar");
630 630
631 // This compares the references to make sure that both refer to the same 631 // This compares the references to make sure that both refer to the same
632 // object (#6815). 632 // object (#6815).
633
634 // For both request blocking and element hiding filters, the value of the
635 // property is cached internally only on second access.
636 test.notEqual(filter1.domains, filter2.domains);
633 test.equal(filter1.domains, filter2.domains); 637 test.equal(filter1.domains, filter2.domains);
634
635 // For element hiding filters, the value of the property is cached internally
636 // only on second access.
637 test.notEqual(filter3.domains, filter4.domains); 638 test.notEqual(filter3.domains, filter4.domains);
638 test.equal(filter3.domains, filter4.domains); 639 test.equal(filter3.domains, filter4.domains);
639 640
640 let filter5 = Filter.fromText("bar$domain=www.example.com"); 641 let filter5 = Filter.fromText("bar$domain=www.example.com");
641 let filter6 = Filter.fromText("www.example.com##.bar"); 642 let filter6 = Filter.fromText("www.example.com##.bar");
642 643
643 test.notEqual(filter2.domains, filter5.domains); 644 test.notEqual(filter2.domains, filter5.domains);
644 645
645 // Check twice for element hiding filters to make sure the internal cached 646 // Check twice for element hiding filters to make sure the internal cached
646 // values are also not equal. 647 // values are also not equal.
647 test.notEqual(filter4.domains, filter6.domains); 648 test.notEqual(filter4.domains, filter6.domains);
648 test.notEqual(filter4.domains, filter6.domains); 649 test.notEqual(filter4.domains, filter6.domains);
649 650
650 test.done(); 651 test.done();
651 }; 652 };
OLDNEW
« no previous file with comments | « lib/matcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld