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: Use boolean flag instead of counter Created Oct. 15, 2018, 3:28 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 test.equal( 598 test.equal(
599 filterStrip.rewriteUrl("http://example.com/?tag"), 599 filterStrip.rewriteUrl("http://example.com/?tag"),
600 "http://example.com/?" 600 "http://example.com/?"
601 ); 601 );
602 602
603 test.done(); 603 test.done();
604 }; 604 };
605 605
606 exports.testDomainMapDeduplication = function(test) 606 exports.testDomainMapDeduplication = function(test)
607 { 607 {
608 let filter1 = Filter.fromText("example.com##.foo"); 608 let filter1 = Filter.fromText("foo$domain=blocking.example.com");
609 let filter2 = Filter.fromText("example.com##.bar"); 609 let filter2 = Filter.fromText("bar$domain=blocking.example.com");
610 let filter3 = Filter.fromText("elemhide.example.com##.foo");
611 let filter4 = Filter.fromText("elemhide.example.com##.bar");
610 612
611 // This compares the references to make sure that both refer to the same 613 // This compares the references to make sure that both refer to the same
612 // object (#6815). 614 // object (#6815).
613 test.equal(filter1.domains, filter2.domains); 615 test.equal(filter1.domains, filter2.domains);
614 616
615 let filter3 = Filter.fromText("www.example.com##.bar"); 617 // For element hiding filters, the value of the property is cached internally
618 // only on second access.
619 test.notEqual(filter3.domains, filter4.domains);
620 test.equal(filter3.domains, filter4.domains);
616 621
617 test.notEqual(filter2.domains, filter3.domains); 622 let filter5 = Filter.fromText("bar$domain=www.example.com");
623 let filter6 = Filter.fromText("www.example.com##.bar");
624
625 test.notEqual(filter2.domains, filter5.domains);
626
627 // Check twice for element hiding filters to make sure the internal cached
628 // values are also not equal.
629 test.notEqual(filter4.domains, filter6.domains);
630 test.notEqual(filter4.domains, filter6.domains);
618 631
619 test.done(); 632 test.done();
620 }; 633 };
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