From 0549bfaf003248cf86af718d5e507f8fca37c09c Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 18 Jul 2020 09:40:38 -0400 Subject: [PATCH] Do not implicitly strict-block when pattern contains no token char Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1147 --- src/js/traffic.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/traffic.js b/src/js/traffic.js index 74792edb9..7079c3efb 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -243,9 +243,14 @@ const onBeforeRootFrameRequest = function(fctxt) { // https://github.com/gorhill/uBlock/issues/3208 // 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) { 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 match = re.exec(url.toLowerCase()); if ( match === null ) { return false; }