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

Unified Diff: lib/filterClasses.js

Issue 29926557: Issue 6994 - Use shortcut matching for location-only filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Minor update Created Oct. 25, 2018, 9:22 p.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 | lib/matcher.js » ('j') | 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
@@ -848,16 +848,29 @@
// The "||" prefix requires that the text that follows does not start
// with a forward slash.
return index != -1 && location[index] != "/" &&
doubleAnchorRegExp.test(location.substring(0, index));
}
return location.includes(pattern);
+ },
+
+ /**
+ * Checks whether this filter has only a URL pattern and no content type,
+ * third-party flag, domains, or sitekeys.
+ * @returns {boolean}
+ */
+ isLocationOnly()
+ {
+ return this.contentType == RegExpFilter.prototype.contentType &&
+ this.thirdParty == null &&
+ !this.domainSource && !this.sitekeySource &&
+ !this.domains && !this.sitekeys;
}
});
/**
* Yields the filter itself (required to optimize {@link Matcher}).
* @yields {RegExpFilter}
*/
RegExpFilter.prototype[Symbol.iterator] = function*()
« no previous file with comments | « no previous file | lib/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld