From 38a5f5751b575a9e6ba1bb24616788354653b462 Mon Sep 17 00:00:00 2001 From: gorhill Date: Fri, 30 Dec 2016 10:41:16 -0500 Subject: [PATCH] code review: be sure all invalid cosmetic filters are reported in logger --- src/js/cosmetic-filtering.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 4d35539f0..8782fb9ff 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -754,14 +754,15 @@ FilterContainer.prototype.compileSelector = (function() { var matches; // `:style` selector? - if ( (matches = reStyleSelector.exec(raw)) !== null ) { - if ( isValidCSSSelector(matches[1]) && isValidStyleProperty(matches[2]) ) { - return JSON.stringify({ - raw: raw, - style: [ matches[1], '{' + matches[2] + '}' ] - }); - } - return; + if ( + (matches = reStyleSelector.exec(raw)) !== null && + isValidCSSSelector(matches[1]) && + isValidStyleProperty(matches[2]) + ) { + return JSON.stringify({ + raw: raw, + style: [ matches[1], '{' + matches[2] + '}' ] + }); } // `script:` filter? @@ -774,7 +775,6 @@ FilterContainer.prototype.compileSelector = (function() { if ( reIsRegexLiteral.test(matches[2]) === false || isBadRegex(matches[2].slice(1, -1)) === false ) { return raw; } - return; } // Procedural selector? @@ -784,7 +784,6 @@ FilterContainer.prototype.compileSelector = (function() { } µb.logger.writeOne('', 'error', 'Cosmetic filtering – invalid filter: ' + raw); - return; }; })();