LEFT | RIGHT |
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 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 if (domains && /(^|,)~?(,|$)/.test(domains)) | 1124 if (domains && /(^|,)~?(,|$)/.test(domains)) |
1125 return new InvalidFilter(text, "filter_invalid_domain"); | 1125 return new InvalidFilter(text, "filter_invalid_domain"); |
1126 | 1126 |
1127 if (type == "@") | 1127 if (type == "@") |
1128 return new ElemHideException(text, domains, body); | 1128 return new ElemHideException(text, domains, body); |
1129 | 1129 |
1130 if (type == "?" || type == "$") | 1130 if (type == "?" || type == "$") |
1131 { | 1131 { |
1132 // Element hiding emulation and snippet filters are inefficient so we need | 1132 // Element hiding emulation and snippet filters are inefficient so we need |
1133 // to make sure that they're only applied if they specify active domains | 1133 // to make sure that they're only applied if they specify active domains |
1134 if (!/(^|,)[^~,]/.test(domains)) | 1134 if (!(/,[^~][^,.]*\.[^,]/.test("," + domains) || |
| 1135 ("," + domains + ",").includes(",localhost,"))) |
1135 { | 1136 { |
1136 return new InvalidFilter(text, type == "?" ? | 1137 return new InvalidFilter(text, type == "?" ? |
1137 "filter_elemhideemulation_nodomain" : | 1138 "filter_elemhideemulation_nodomain" : |
1138 "filter_snippet_nodomain"); | 1139 "filter_snippet_nodomain"); |
1139 } | 1140 } |
1140 | 1141 |
1141 if (type == "?") | 1142 if (type == "?") |
1142 return new ElemHideEmulationFilter(text, domains, body); | 1143 return new ElemHideEmulationFilter(text, domains, body); |
1143 | 1144 |
1144 return new SnippetFilter(text, domains, body); | 1145 return new SnippetFilter(text, domains, body); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 | 1248 |
1248 /** | 1249 /** |
1249 * Script that should be executed | 1250 * Script that should be executed |
1250 * @type {string} | 1251 * @type {string} |
1251 */ | 1252 */ |
1252 get script() | 1253 get script() |
1253 { | 1254 { |
1254 return this.body; | 1255 return this.body; |
1255 } | 1256 } |
1256 }); | 1257 }); |
LEFT | RIGHT |