mirror of https://github.com/gorhill/uBlock.git
This commit is contained in:
parent
637439c6db
commit
ef9913c711
|
@ -252,13 +252,6 @@ var toBlockDocResult = function(url, hostname, result) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quick test: if the result starts with `|` or `||`, then this means the
|
|
||||||
// match is before the path part of the URL for sure.
|
|
||||||
// Examples: sb:|http:// sb:||example.com^
|
|
||||||
if ( result.charAt(3) === '|' ) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make a regex out of the result
|
// Make a regex out of the result
|
||||||
var reText = result.slice(3);
|
var reText = result.slice(3);
|
||||||
var pos = reText.indexOf('$');
|
var pos = reText.indexOf('$');
|
||||||
|
@ -266,11 +259,6 @@ var toBlockDocResult = function(url, hostname, result) {
|
||||||
reText = reText.slice(0, pos);
|
reText = reText.slice(0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matches whole URL
|
|
||||||
if ( reText === '*' ) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We are going to have to take the long way to find out
|
// We are going to have to take the long way to find out
|
||||||
if ( reText.charAt(0) === '/' && reText.slice(-1) === '/' ) {
|
if ( reText.charAt(0) === '/' && reText.slice(-1) === '/' ) {
|
||||||
reText = reText.slice(1, -1);
|
reText = reText.slice(1, -1);
|
||||||
|
@ -291,8 +279,10 @@ var toBlockDocResult = function(url, hostname, result) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// verify that the match starts before the path
|
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
||||||
if ( matches.index < url.indexOf(hostname) + hostname.length ) {
|
// https://github.com/chrisaljoudi/uBlock/issues/1212
|
||||||
|
// Relax the rule: verify that the match is completely before the path part
|
||||||
|
if ( re.lastIndex <= url.indexOf(hostname) + hostname.length + 1 ) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue