mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 17:47:14 +02:00
Do not implicitly strict-block when pattern contains no token char
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1147
This commit is contained in:
parent
90868e873c
commit
0549bfaf00
@ -243,9 +243,14 @@ const onBeforeRootFrameRequest = function(fctxt) {
|
|||||||
|
|
||||||
// https://github.com/gorhill/uBlock/issues/3208
|
// https://github.com/gorhill/uBlock/issues/3208
|
||||||
// Mind case insensitivity.
|
// Mind case insensitivity.
|
||||||
|
// https://github.com/uBlockOrigin/uBlock-issues/issues/1147
|
||||||
|
// Do not strict-block if the filter pattern does not contain at least one
|
||||||
|
// token character.
|
||||||
const toBlockDocResult = function(url, hostname, logData) {
|
const toBlockDocResult = function(url, hostname, logData) {
|
||||||
if ( typeof logData.regex !== 'string' ) { return false; }
|
if ( typeof logData.regex !== 'string' ) { return false; }
|
||||||
|
if ( typeof logData.raw === 'string' && /\w/.test(logData.raw) === false ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
const re = new RegExp(logData.regex, 'i');
|
const re = new RegExp(logData.regex, 'i');
|
||||||
const match = re.exec(url.toLowerCase());
|
const match = re.exec(url.toLowerCase());
|
||||||
if ( match === null ) { return false; }
|
if ( match === null ) { return false; }
|
||||||
|
Loading…
Reference in New Issue
Block a user