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

Unified Diff: lib/filterClasses.js

Issue 29996555: Noissue - Lower-case URL in advance for location-only filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Add JSDoc access tag Created Feb. 2, 2019, 10:54 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 | 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
@@ -874,27 +874,30 @@
(this.thirdParty == null || this.thirdParty == thirdParty) &&
this.isActiveOnDomain(docDomain, sitekey) &&
this.matchesLocation(location);
},
/**
* Checks whether the given URL matches this filter's pattern.
* @param {string} location The URL to check.
+ * @param {?string} [lowerCaseLocation] The lower-case version of the URL to
+ * check, for case-insensitive matching.
* @returns {boolean} <code>true</code> if the URL matches.
+ * @package
*/
- matchesLocation(location)
+ matchesLocation(location, lowerCaseLocation)
{
let {regexp} = this;
if (regexp)
return regexp.test(location);
if (!this.matchCase)
- location = location.toLowerCase();
+ location = lowerCaseLocation || location.toLowerCase();
let {pattern} = this;
let startsWithDoubleAnchor = pattern[0] == "|" && pattern[1] == "|";
let endsWithSeparator = pattern[pattern.length - 1] == "^";
if (startsWithDoubleAnchor)
pattern = pattern.substr(2);
« 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