Index: lib/filterClasses.js |
=================================================================== |
--- a/lib/filterClasses.js |
+++ b/lib/filterClasses.js |
@@ -314,28 +314,28 @@ |
let strippedDollarIndex = -1; |
let dollarIndex = -1; |
do |
{ |
strippedDollarIndex = beforeOptions.indexOf("$", strippedDollarIndex + 1); |
dollarIndex = text.indexOf("$", dollarIndex + 1); |
} |
while (strippedDollarIndex != -1); |
- let optionsText = text.substr(dollarIndex + 1); |
+ let optionsText = text.substring(dollarIndex + 1); |
// Then we can normalize spaces in the options part safely |
let options = optionsText.split(","); |
for (let i = 0; i < options.length; i++) |
{ |
let option = options[i]; |
let cspMatch = /^ *c *s *p *=/i.exec(option); |
if (cspMatch) |
{ |
options[i] = cspMatch[0].replace(/ +/g, "") + |
- option.substr(cspMatch[0].length).trim().replace(/ +/g, " "); |
+ option.substring(cspMatch[0].length).trim().replace(/ +/g, " "); |
} |
else |
options[i] = option.replace(/ +/g, ""); |
} |
return beforeOptions + "$" + options.join(); |
}; |
@@ -526,17 +526,17 @@ |
let domain = list[i]; |
if (domain == "") |
continue; |
let include; |
if (domain[0] == "~") |
{ |
include = false; |
- domain = domain.substr(1); |
+ domain = domain.substring(1); |
} |
else |
{ |
include = true; |
hasIncludes = true; |
} |
if (!domains) |
@@ -725,17 +725,17 @@ |
this.resourceName = resourceName; |
if (regexpSource.length >= 2 && |
regexpSource[0] == "/" && |
regexpSource[regexpSource.length - 1] == "/") |
{ |
// The filter is a regular expression - convert it immediately to |
// catch syntax errors |
- let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), |
+ let regexp = new RegExp(regexpSource.substring(1, regexpSource.length - 1), |
this.matchCase ? "" : "i"); |
Object.defineProperty(this, "regexp", {value: regexp}); |
} |
else |
{ |
// Patterns like /foo/bar/* exist so that they are not treated as regular |
// expressions. We drop any superfluous wildcards here so our optimizations |
// can kick in. |
@@ -907,17 +907,17 @@ |
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); |
+ pattern = pattern.substring(2); |
if (endsWithSeparator) |
pattern = pattern.slice(0, -1); |
let index = location.indexOf(pattern); |
// The "||" prefix requires that the text that follows does not start |
// with a forward slash. |
@@ -970,47 +970,47 @@ |
*/ |
RegExpFilter.fromText = function(text) |
{ |
let blocking = true; |
let origText = text; |
if (text[0] == "@" && text[1] == "@") |
{ |
blocking = false; |
- text = text.substr(2); |
+ text = text.substring(2); |
} |
let contentType = null; |
let matchCase = null; |
let domains = null; |
let sitekeys = null; |
let thirdParty = null; |
let collapse = null; |
let csp = null; |
let rewrite = null; |
let resourceName = null; |
let options; |
let match = text.includes("$") ? Filter.optionsRegExp.exec(text) : null; |
if (match) |
{ |
options = match[1].split(","); |
- text = match.input.substr(0, match.index); |
+ text = match.input.substring(0, match.index); |
for (let option of options) |
{ |
let value = null; |
let separatorIndex = option.indexOf("="); |
if (separatorIndex >= 0) |
{ |
- value = option.substr(separatorIndex + 1); |
- option = option.substr(0, separatorIndex); |
+ value = option.substring(separatorIndex + 1); |
+ option = option.substring(0, separatorIndex); |
} |
let inverse = option[0] == "~"; |
if (inverse) |
- option = option.substr(1); |
+ option = option.substring(1); |
let type = RegExpFilter.typeMap[option.replace(/-/, "_").toUpperCase()]; |
if (type) |
{ |
if (inverse) |
{ |
if (contentType == null) |
({contentType} = RegExpFilter.prototype); |
@@ -1051,17 +1051,17 @@ |
return new InvalidFilter(origText, "filter_unknown_option"); |
sitekeys = value.toUpperCase(); |
break; |
case "rewrite": |
if (value == null) |
return new InvalidFilter(origText, "filter_unknown_option"); |
rewrite = value; |
if (value.startsWith("abp-resource:")) |
- resourceName = value.substr("abp-resource:".length); |
+ resourceName = value.substring("abp-resource:".length); |
break; |
default: |
return new InvalidFilter(origText, "filter_unknown_option"); |
} |
} |
} |
} |