mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-07 03:12:33 +01:00
fix #3506
This commit is contained in:
parent
b0600645a6
commit
94c8cfc3f3
@ -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"
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user