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

Delta Between Two Patch Sets: lib/filterClasses.js

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

Powered by Google App Engine
This is Rietveld