| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 } | 917 } |
| 918 | 918 |
| 919 if (id) | 919 if (id) |
| 920 selector = tagName + "." + id + additional + "," + tagName + "#" + id + ad
ditional; | 920 selector = tagName + "." + id + additional + "," + tagName + "#" + id + ad
ditional; |
| 921 else if (tagName || additional) | 921 else if (tagName || additional) |
| 922 selector = tagName + additional; | 922 selector = tagName + additional; |
| 923 else | 923 else |
| 924 return new InvalidFilter(text, "filter_elemhide_nocriteria"); | 924 return new InvalidFilter(text, "filter_elemhide_nocriteria"); |
| 925 } | 925 } |
| 926 | 926 |
| 927 // We don't allow ElemHide filters which have any empty domains. |
| 928 // Note: The ElemHide.prototype.domainSeparator is duplicated here, if that |
| 929 // changes this must be changed too. |
| 930 if (domain && /(^|,)~?(,|$)/.test(domain)) |
| 931 return new InvalidFilter(text, "filter_invalid_domain"); |
| 932 |
| 927 if (isException) | 933 if (isException) |
| 928 return new ElemHideException(text, domain, selector); | 934 return new ElemHideException(text, domain, selector); |
| 929 | 935 |
| 930 let match = Filter.csspropertyRegExp.exec(selector); | 936 let match = Filter.csspropertyRegExp.exec(selector); |
| 931 if (match) | 937 if (match) |
| 932 { | 938 { |
| 933 // CSS property filters are inefficient so we need to make sure that | 939 // CSS property filters are inefficient so we need to make sure that |
| 934 // they're only applied if they specify active domains | 940 // they're only applied if they specify active domains |
| 935 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) | 941 if (!/,[^~][^,.]*\.[^,]/.test("," + domain)) |
| 936 return new InvalidFilter(text, "filter_cssproperty_nodomain"); | 942 return new InvalidFilter(text, "filter_cssproperty_nodomain"); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1034 // several times on Safari, due to WebKit bug 132872 | 1040 // several times on Safari, due to WebKit bug 132872 |
| 1035 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); | 1041 let prop = Object.getOwnPropertyDescriptor(this, "regexpString"); |
| 1036 if (prop) | 1042 if (prop) |
| 1037 return prop.value; | 1043 return prop.value; |
| 1038 | 1044 |
| 1039 let regexp = Filter.toRegExp(this.regexpSource); | 1045 let regexp = Filter.toRegExp(this.regexpSource); |
| 1040 Object.defineProperty(this, "regexpString", {value: regexp}); | 1046 Object.defineProperty(this, "regexpString", {value: regexp}); |
| 1041 return regexp; | 1047 return regexp; |
| 1042 } | 1048 } |
| 1043 }); | 1049 }); |
| OLD | NEW |