Fix #1212: less aggressive document blocking

This commit is contained in:
Chris 2015-04-08 16:00:04 -06:00
parent 09825e1165
commit d92ea20acf
1 changed files with 2 additions and 14 deletions

View File

@ -256,13 +256,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('$');
@ -270,11 +263,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);
@ -295,8 +283,8 @@ var toBlockDocResult = function(url, hostname, result) {
return ''; return '';
} }
// verify that the match starts before the path // make sure the match ends before the path-part of the URL (#1212)
if ( matches.index < url.indexOf(hostname) + hostname.length ) { if ( re.lastIndex <= url.indexOf(hostname) + hostname.length + 1 ) {
return result; return result;
} }