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

Unified Diff: lib/filterClasses.js

Issue 29867555: Noissue - Check for comment indicator first while parsing filter text (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created Aug. 28, 2018, 7:29 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/filterClasses.js
===================================================================
--- a/lib/filterClasses.js
+++ b/lib/filterClasses.js
@@ -118,23 +118,28 @@
* @return {Filter}
*/
Filter.fromText = function(text)
{
let filter = Filter.knownFilters.get(text);
if (filter)
return filter;
- let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null;
- if (match)
- filter = ContentFilter.fromText(text, match[1], match[2], match[3]);
- else if (text[0] == "!")
+ if (text[0] == "!")
Jon Sonesen 2018/08/29 15:01:36 Is there any difference performance wise between t
Manish Jethani 2018/08/29 15:50:15 In my tests, which was a while ago, I had found th
+ {
filter = new CommentFilter(text);
+ }
else
- filter = RegExpFilter.fromText(text);
+ {
+ let match = text.includes("#") ? Filter.contentRegExp.exec(text) : null;
+ if (match)
+ filter = ContentFilter.fromText(text, match[1], match[2], match[3]);
+ else
+ filter = RegExpFilter.fromText(text);
+ }
Filter.knownFilters.set(filter.text, filter);
return filter;
};
/**
* Deserializes a filter
*
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld