mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-01 16:33:06 +01:00
code review (#3208)
This commit is contained in:
parent
f7bfcff37a
commit
bc036724c1
@ -304,8 +304,9 @@ var onBeforeRootFrameRequest = function(details) {
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/3208
|
||||
// Mind case insensitivity.
|
||||
|
||||
var toBlockDocResult = function(url, hostname, logData) {
|
||||
if ( typeof logData.regex !== 'string' ) { return; }
|
||||
if ( typeof logData.regex !== 'string' ) { return false; }
|
||||
var re = new RegExp(logData.regex, 'i'),
|
||||
match = re.exec(url.toLowerCase());
|
||||
if ( match === null ) { return false; }
|
||||
@ -313,14 +314,8 @@ var toBlockDocResult = function(url, hostname, logData) {
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1128
|
||||
// https://github.com/chrisaljoudi/uBlock/issues/1212
|
||||
// Relax the rule: verify that the match is completely before the path part
|
||||
if (
|
||||
(match.index + match[0].length) <=
|
||||
(url.indexOf(hostname) + hostname.length + 1)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return (match.index + match[0].length) <=
|
||||
(url.indexOf(hostname) + hostname.length + 1);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user