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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 { | 872 { |
873 return (this.contentType & typeMask) != 0 && | 873 return (this.contentType & typeMask) != 0 && |
874 (this.thirdParty == null || this.thirdParty == thirdParty) && | 874 (this.thirdParty == null || this.thirdParty == thirdParty) && |
875 this.isActiveOnDomain(docDomain, sitekey) && | 875 this.isActiveOnDomain(docDomain, sitekey) && |
876 this.matchesLocation(location); | 876 this.matchesLocation(location); |
877 }, | 877 }, |
878 | 878 |
879 /** | 879 /** |
880 * Checks whether the given URL matches this filter's pattern. | 880 * Checks whether the given URL matches this filter's pattern. |
881 * @param {string} location The URL to check. | 881 * @param {string} location The URL to check. |
| 882 * @param {?string} [lowerCaseLocation] The lower-case version of the URL to |
| 883 * check, for case-insensitive matching. |
882 * @returns {boolean} <code>true</code> if the URL matches. | 884 * @returns {boolean} <code>true</code> if the URL matches. |
883 */ | 885 */ |
884 matchesLocation(location) | 886 matchesLocation(location, lowerCaseLocation) |
885 { | 887 { |
886 let {regexp} = this; | 888 let {regexp} = this; |
887 | 889 |
888 if (regexp) | 890 if (regexp) |
889 return regexp.test(location); | 891 return regexp.test(location); |
890 | 892 |
891 if (!this.matchCase) | 893 if (!this.matchCase) |
892 location = location.toLowerCase(); | 894 location = lowerCaseLocation || location.toLowerCase(); |
893 | 895 |
894 let {pattern} = this; | 896 let {pattern} = this; |
895 | 897 |
896 let startsWithDoubleAnchor = pattern[0] == "|" && pattern[1] == "|"; | 898 let startsWithDoubleAnchor = pattern[0] == "|" && pattern[1] == "|"; |
897 let endsWithSeparator = pattern[pattern.length - 1] == "^"; | 899 let endsWithSeparator = pattern[pattern.length - 1] == "^"; |
898 | 900 |
899 if (startsWithDoubleAnchor) | 901 if (startsWithDoubleAnchor) |
900 pattern = pattern.substr(2); | 902 pattern = pattern.substr(2); |
901 | 903 |
902 if (endsWithSeparator) | 904 if (endsWithSeparator) |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 | 1435 |
1434 /** | 1436 /** |
1435 * Script that should be executed | 1437 * Script that should be executed |
1436 * @type {string} | 1438 * @type {string} |
1437 */ | 1439 */ |
1438 get script() | 1440 get script() |
1439 { | 1441 { |
1440 return this.body; | 1442 return this.body; |
1441 } | 1443 } |
1442 }); | 1444 }); |
OLD | NEW |