1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-02 09:09:38 +02:00
This commit is contained in:
Raymond Hill 2018-02-12 08:18:24 -05:00
parent b0600645a6
commit 94c8cfc3f3
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 7 additions and 6 deletions

View File

@ -76,7 +76,7 @@ var nameToActionMap = {
// For performance purpose, as simple tests as possible
var reHostnameVeryCoarse = /[g-z_-]/;
var reIPv4VeryCoarse = /\.\d+$/;
var reBadHostname = /[^0-9a-z_.\[\]:-]/;
var reBadHostname = /[^0-9a-z_.\[\]:%-]/;
// http://tools.ietf.org/html/rfc5952
// 4.3: "MUST be represented in lowercase"

View File

@ -869,6 +869,7 @@ var untangleRules = function(s) {
var firewallRules = [];
var urlRules = [];
var switches = [];
var reIsSwitchRule = /^[a-z-]+:\s/;
while ( lineBeg < textEnd ) {
lineEnd = s.indexOf('\n', lineBeg);
@ -881,12 +882,12 @@ var untangleRules = function(s) {
line = s.slice(lineBeg, lineEnd).trim();
lineBeg = lineEnd + 1;
if ( line.indexOf('://') !== -1 ) {
urlRules.push(line);
} else if ( line.indexOf(':') === -1 ) {
firewallRules.push(line);
} else {
if ( reIsSwitchRule.test(line) ) {
switches.push(line);
} else if ( line.indexOf('://') !== -1 ) {
urlRules.push(line);
} else {
firewallRules.push(line);
}
}