| OLD | NEW |
| 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 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); | |
| 637 test.equal(filter1.domains, filter2.domains); | 634 test.equal(filter1.domains, filter2.domains); |
| 638 test.notEqual(filter3.domains, filter4.domains); | |
| 639 test.equal(filter3.domains, filter4.domains); | 635 test.equal(filter3.domains, filter4.domains); |
| 640 | 636 |
| 641 let filter5 = Filter.fromText("bar$domain=www.example.com"); | 637 let filter5 = Filter.fromText("bar$domain=www.example.com"); |
| 642 let filter6 = Filter.fromText("www.example.com##.bar"); | 638 let filter6 = Filter.fromText("www.example.com##.bar"); |
| 643 | 639 |
| 644 test.notEqual(filter2.domains, filter5.domains); | 640 test.notEqual(filter2.domains, filter5.domains); |
| 645 | |
| 646 // Check twice for element hiding filters to make sure the internal cached | |
| 647 // values are also not equal. | |
| 648 test.notEqual(filter4.domains, filter6.domains); | |
| 649 test.notEqual(filter4.domains, filter6.domains); | 641 test.notEqual(filter4.domains, filter6.domains); |
| 650 | 642 |
| 651 test.done(); | 643 test.done(); |
| 652 }; | 644 }; |
| OLD | NEW |