From 6b9848cf0d87b25178b54022c072e9f584578089 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 30 Sep 2015 10:17:25 -0400 Subject: [PATCH] Exception script tag filter makes no sense: reject such filters --- src/js/cosmetic-filtering.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 1a0c8730c..d66c2b886 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -267,6 +267,7 @@ FilterParser.prototype.parse = function(s) { // Remember original string this.prefix = matches[1]; this.suffix = matches[3]; + this.unhide = matches[2].charAt(1) === '@' ? 1 : 0; // 2014-05-23: // https://github.com/gorhill/httpswitchboard/issues/260 @@ -288,8 +289,9 @@ FilterParser.prototype.parse = function(s) { // overhead in the content script. // Example: focus.de##script:contains(/uabInject/) if ( this.suffix.charAt(0) === 's' && this.reScriptContains.test(this.suffix) ) { - // Currently supported only as non-generic selector. - if ( this.prefix.length === 0 ) { + // Currently supported only as non-generic selector. Also, exception + // script tag filter makes no sense, ignore. + if ( this.prefix.length === 0 || this.unhide === 1 ) { this.invalid = true; return this; } @@ -302,7 +304,6 @@ FilterParser.prototype.parse = function(s) { } } - this.unhide = matches[2].charAt(1) === '@' ? 1 : 0; if ( this.prefix !== '' ) { this.hostnames = this.prefix.split(/\s*,\s*/); }