| Left: | ||
| Right: |
| 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 { | 765 { |
| 766 sitekeys = this.sitekeySource.split("|"); | 766 sitekeys = this.sitekeySource.split("|"); |
| 767 this.sitekeySource = null; | 767 this.sitekeySource = null; |
| 768 } | 768 } |
| 769 | 769 |
| 770 Object.defineProperty( | 770 Object.defineProperty( |
| 771 this, "sitekeys", {value: sitekeys, enumerable: true} | 771 this, "sitekeys", {value: sitekeys, enumerable: true} |
| 772 ); | 772 ); |
| 773 return this.sitekeys; | 773 return this.sitekeys; |
| 774 }, | 774 }, |
| 775 /** | |
| 776 * Tests whether the filter only has location. | |
| 777 */ | |
| 778 get isLocationOnly() | |
|
Manish Jethani
2018/10/21 16:06:52
Let's make this a function rather than a property.
Jon Sonesen
2018/10/23 17:36:32
Acknowledged.
| |
| 779 { | |
| 780 return this.contentType == RegExpFilter.prototype.contentType && | |
| 781 this.thirdParty == null && !this.domains && !this.sitekeys; | |
| 782 }, | |
| 775 | 783 |
| 776 /** | 784 /** |
| 777 * Tests whether the URL matches this filter | 785 * Tests whether the URL matches this filter |
| 778 * @param {string} location URL to be tested | 786 * @param {string} location URL to be tested |
| 779 * @param {number} typeMask bitmask of content / request types to match | 787 * @param {number} typeMask bitmask of content / request types to match |
| 780 * @param {string} [docDomain] domain name of the document that loads the URL | 788 * @param {string} [docDomain] domain name of the document that loads the URL |
| 781 * @param {boolean} [thirdParty] should be true if the URL is a third-party | 789 * @param {boolean} [thirdParty] should be true if the URL is a third-party |
| 782 * request | 790 * request |
| 783 * @param {string} [sitekey] public key provided by the document | 791 * @param {string} [sitekey] public key provided by the document |
| 784 * @return {boolean} true in case of a match | 792 * @return {boolean} true in case of a match |
| 785 */ | 793 */ |
| 786 matches(location, typeMask, docDomain, thirdParty, sitekey) | 794 matches(location, typeMask, docDomain, thirdParty, sitekey) |
| 787 { | 795 { |
| 788 return (this.contentType & typeMask) != 0 && | 796 return (this.contentType & typeMask) != 0 && |
| 789 (this.thirdParty == null || this.thirdParty == thirdParty) && | 797 (this.thirdParty == null || this.thirdParty == thirdParty) && |
| 790 this.isActiveOnDomain(docDomain, sitekey) && | 798 this.isActiveOnDomain(docDomain, sitekey) && |
| 791 this.regexp.test(location); | 799 this.regexp.test(location); |
| 800 }, | |
| 801 matchesLocation(location) | |
| 802 { | |
| 803 return this.regexp.test(location); | |
| 792 } | 804 } |
| 793 }); | 805 }); |
| 794 | 806 |
| 795 /** | 807 /** |
| 796 * Yields the filter itself (required to optimize {@link Matcher}). | 808 * Yields the filter itself (required to optimize {@link Matcher}). |
| 797 * @yields {RegExpFilter} | 809 * @yields {RegExpFilter} |
| 798 */ | 810 */ |
| 799 RegExpFilter.prototype[Symbol.iterator] = function*() | 811 RegExpFilter.prototype[Symbol.iterator] = function*() |
| 800 { | 812 { |
| 801 yield this; | 813 yield this; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 | 1288 |
| 1277 /** | 1289 /** |
| 1278 * Script that should be executed | 1290 * Script that should be executed |
| 1279 * @type {string} | 1291 * @type {string} |
| 1280 */ | 1292 */ |
| 1281 get script() | 1293 get script() |
| 1282 { | 1294 { |
| 1283 return this.body; | 1295 return this.body; |
| 1284 } | 1296 } |
| 1285 }); | 1297 }); |
| OLD | NEW |