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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 * Tests whether the URL matches this filter | 611 * Tests whether the URL matches this filter |
612 * @param {String} location URL to be tested | 612 * @param {String} location URL to be tested |
613 * @param {String} contentType content type identifier of the URL | 613 * @param {String} contentType content type identifier of the URL |
614 * @param {String} docDomain domain name of the document that loads the URL | 614 * @param {String} docDomain domain name of the document that loads the URL |
615 * @param {Boolean} thirdParty should be true if the URL is a third-party requ
est | 615 * @param {Boolean} thirdParty should be true if the URL is a third-party requ
est |
616 * @param {String} sitekey public key provided by the document | 616 * @param {String} sitekey public key provided by the document |
617 * @return {Boolean} true in case of a match | 617 * @return {Boolean} true in case of a match |
618 */ | 618 */ |
619 matches: function(location, contentType, docDomain, thirdParty, sitekey) | 619 matches: function(location, contentType, docDomain, thirdParty, sitekey) |
620 { | 620 { |
621 if (this.regexp.test(location) && | 621 if ((RegExpFilter.typeMap[contentType] & this.contentType) != 0 && |
622 (RegExpFilter.typeMap[contentType] & this.contentType) != 0 && | |
623 (this.thirdParty == null || this.thirdParty == thirdParty) && | 622 (this.thirdParty == null || this.thirdParty == thirdParty) && |
624 this.isActiveOnDomain(docDomain, sitekey)) | 623 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location)) |
625 { | 624 { |
626 return true; | 625 return true; |
627 } | 626 } |
628 | 627 |
629 return false; | 628 return false; |
630 } | 629 } |
631 }; | 630 }; |
632 | 631 |
633 // Required to optimize Matcher, see also RegExpFilter.prototype.length | 632 // Required to optimize Matcher, see also RegExpFilter.prototype.length |
634 Object.defineProperty(RegExpFilter.prototype, "0", | 633 Object.defineProperty(RegExpFilter.prototype, "0", |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 function ElemHideException(text, domains, selector) | 939 function ElemHideException(text, domains, selector) |
941 { | 940 { |
942 ElemHideBase.call(this, text, domains, selector); | 941 ElemHideBase.call(this, text, domains, selector); |
943 } | 942 } |
944 exports.ElemHideException = ElemHideException; | 943 exports.ElemHideException = ElemHideException; |
945 | 944 |
946 ElemHideException.prototype = | 945 ElemHideException.prototype = |
947 { | 946 { |
948 __proto__: ElemHideBase.prototype | 947 __proto__: ElemHideBase.prototype |
949 }; | 948 }; |
OLD | NEW |