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: Cover ~www.localhost,localhost case Created Sept. 10, 2018, 9:40 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 /,localhost,/.test("," + domains + ",")))
Sebastian Noack 2018/09/10 17:44:37 It seems we don't need a regular expression here,
Manish Jethani 2018/09/10 17:57:32 Good point, done.
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
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 });
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