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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 this.sitekeySource = null; | 640 this.sitekeySource = null; |
641 } | 641 } |
642 | 642 |
643 Object.defineProperty(this, "sitekeys", {value: sitekeys, enumerable: true})
; | 643 Object.defineProperty(this, "sitekeys", {value: sitekeys, enumerable: true})
; |
644 return this.sitekeys; | 644 return this.sitekeys; |
645 }, | 645 }, |
646 | 646 |
647 /** | 647 /** |
648 * Tests whether the URL matches this filter | 648 * Tests whether the URL matches this filter |
649 * @param {String} location URL to be tested | 649 * @param {String} location URL to be tested |
650 * @param {String} typeMask bitmask of content / request types to match | 650 * @param {number} typeMask bitmask of content / request types to match |
651 * @param {String} docDomain domain name of the document that loads the URL | 651 * @param {String} docDomain domain name of the document that loads the URL |
652 * @param {Boolean} thirdParty should be true if the URL is a third-party requ
est | 652 * @param {Boolean} thirdParty should be true if the URL is a third-party requ
est |
653 * @param {String} sitekey public key provided by the document | 653 * @param {String} sitekey public key provided by the document |
654 * @return {Boolean} true in case of a match | 654 * @return {Boolean} true in case of a match |
655 */ | 655 */ |
656 matches: function(location, typeMask, docDomain, thirdParty, sitekey) | 656 matches: function(location, typeMask, docDomain, thirdParty, sitekey) |
657 { | 657 { |
658 if (this.contentType & typeMask && | 658 if (this.contentType & typeMask && |
659 (this.thirdParty == null || this.thirdParty == thirdParty) && | 659 (this.thirdParty == null || this.thirdParty == thirdParty) && |
660 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location)) | 660 this.isActiveOnDomain(docDomain, sitekey) && this.regexp.test(location)) |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 // several times on Safari, due to WebKit bug 132872 | 1061 // several times on Safari, due to WebKit bug 132872 |
1062 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); | 1062 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); |
1063 if (prop) | 1063 if (prop) |
1064 return prop.value; | 1064 return prop.value; |
1065 | 1065 |
1066 let regexp = Filter.toRegExp(this.regexpSource); | 1066 let regexp = Filter.toRegExp(this.regexpSource); |
1067 Object.defineProperty(this, "regexpString", {value: regexp}); | 1067 Object.defineProperty(this, "regexpString", {value: regexp}); |
1068 return regexp; | 1068 return regexp; |
1069 } | 1069 } |
1070 }; | 1070 }; |
OLD | NEW |