From 87d0cce9b2916e1c83bad23733efecbb9506ecd0 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 29 Jun 2016 18:12:21 -0400 Subject: [PATCH] remove stray comma separator in injected CSS declarations --- src/js/contentscript.js | 2 +- src/js/cosmetic-filtering.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/contentscript.js b/src/js/contentscript.js index 211ed881a..b66a2fb82 100644 --- a/src/js/contentscript.js +++ b/src/js/contentscript.js @@ -209,7 +209,7 @@ vAPI.domFilterer = { if ( this.newCSSRules.length ) { styleTag = document.createElement('style'); styleTag.setAttribute('type', 'text/css'); - styleTag.textContent = ':root ' + this.newCSSRules.join(',\n:root '); + styleTag.textContent = ':root ' + this.newCSSRules.join('\n:root '); document.head.appendChild(styleTag); this.styleTags.push(styleTag); this.newCSSRules.length = 0; diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index 2b974249e..4fd41c57f 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -388,6 +388,10 @@ FilterParser.prototype.translateAdguardCSSInjectionFilter = function(raw) { if ( matches === null ) { return ''; } + // For now we do not allow generic CSS injections (prolly never). + if ( matches[1] === '' && matches[2] !== '@' ) { + return ''; + } return matches[1] + '#' + matches[2] + '#' + matches[3].trim() +