Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/filterClasses.js

Issue 29876561: Issue 6931 - Allow content filters for localhost (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Sept. 6, 2018, 10:26 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 { 1135 {
1136 return new InvalidFilter(text, type == "?" ? 1136 return new InvalidFilter(text, type == "?" ?
1137 "filter_elemhideemulation_nodomain" : 1137 "filter_elemhideemulation_nodomain" :
1138 "filter_snippet_nodomain"); 1138 "filter_snippet_nodomain");
1139 } 1139 }
1140 1140
1141 if (type == "?") 1141 if (type == "?")
1142 return new ElemHideEmulationFilter(text, domains, body); 1142 return new ElemHideEmulationFilter(text, domains, body);
1143 1143
1144 return new SnippetFilter(text, domains, body); 1144 return new SnippetFilter(text, domains, body);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 1247
1248 /** 1248 /**
1249 * Script that should be executed 1249 * Script that should be executed
1250 * @type {string} 1250 * @type {string}
1251 */ 1251 */
1252 get script() 1252 get script()
1253 { 1253 {
1254 return this.body; 1254 return this.body;
1255 } 1255 }
1256 }); 1256 });
OLDNEW
« no previous file with comments | « no previous file | test/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld