1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01: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 // For performance purpose, as simple tests as possible
var reHostnameVeryCoarse = /[g-z_-]/; var reHostnameVeryCoarse = /[g-z_-]/;
var reIPv4VeryCoarse = /\.\d+$/; var reIPv4VeryCoarse = /\.\d+$/;
var reBadHostname = /[^0-9a-z_.\[\]:-]/; var reBadHostname = /[^0-9a-z_.\[\]:%-]/;
// http://tools.ietf.org/html/rfc5952 // http://tools.ietf.org/html/rfc5952
// 4.3: "MUST be represented in lowercase" // 4.3: "MUST be represented in lowercase"

View File

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