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

Side by Side Diff: test/filterClasses.js

Issue 29909555: Issue 7046 - Defer caching of domain maps (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Change shouldCacheDomain function to cacheDomain property Created Oct. 16, 2018, 6 p.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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 test.equal( 603 test.equal(
604 filterStrip.rewriteUrl("http://example.com/?tag"), 604 filterStrip.rewriteUrl("http://example.com/?tag"),
605 "http://example.com/?" 605 "http://example.com/?"
606 ); 606 );
607 607
608 test.done(); 608 test.done();
609 }; 609 };
610 610
611 exports.testDomainMapDeduplication = function(test) 611 exports.testDomainMapDeduplication = function(test)
612 { 612 {
613 let filter1 = Filter.fromText("example.com##.foo"); 613 let filter1 = Filter.fromText("foo$domain=blocking.example.com");
614 let filter2 = Filter.fromText("example.com##.bar"); 614 let filter2 = Filter.fromText("bar$domain=blocking.example.com");
615 let filter3 = Filter.fromText("elemhide.example.com##.foo");
616 let filter4 = Filter.fromText("elemhide.example.com##.bar");
615 617
616 // This compares the references to make sure that both refer to the same 618 // This compares the references to make sure that both refer to the same
617 // object (#6815). 619 // object (#6815).
618 test.equal(filter1.domains, filter2.domains); 620 test.equal(filter1.domains, filter2.domains);
619 621
620 let filter3 = Filter.fromText("www.example.com##.bar"); 622 // For element hiding filters, the value of the property is cached internally
623 // only on second access.
624 test.notEqual(filter3.domains, filter4.domains);
625 test.equal(filter3.domains, filter4.domains);
621 626
622 test.notEqual(filter2.domains, filter3.domains); 627 let filter5 = Filter.fromText("bar$domain=www.example.com");
628 let filter6 = Filter.fromText("www.example.com##.bar");
629
630 test.notEqual(filter2.domains, filter5.domains);
631
632 // Check twice for element hiding filters to make sure the internal cached
633 // values are also not equal.
634 test.notEqual(filter4.domains, filter6.domains);
635 test.notEqual(filter4.domains, filter6.domains);
623 636
624 test.done(); 637 test.done();
625 }; 638 };
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