From 02989edb058d2dc56897bbecd4a252264ec7f17f Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 30 Jan 2018 18:45:29 +0300 Subject: [PATCH] eat unclosed comments --- background/storage.js | 2 +- edit/applies-to-line-widget.js | 2 +- edit/sections.js | 2 +- vendor-overwrites/colorpicker/colorview.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/background/storage.js b/background/storage.js index 29bae5c4..438ee012 100644 --- a/background/storage.js +++ b/background/storage.js @@ -3,7 +3,7 @@ const RX_NAMESPACE = /\s*(@namespace\s+(?:\S+\s+)?url\(http:\/\/.*?\);)\s*/g; const RX_CHARSET = /\s*@charset\s+(['"]).*?\1\s*;\s*/g; -const RX_CSS_COMMENTS = /\/\*[\s\S]*?\*\//g; +const RX_CSS_COMMENTS = /\/\*[\s\S]*?(?:\*\/|$)/g; // eslint-disable-next-line no-var var SLOPPY_REGEXP_PREFIX = '\0'; diff --git a/edit/applies-to-line-widget.js b/edit/applies-to-line-widget.js index b154f1b5..b0d0dce8 100644 --- a/edit/applies-to-line-widget.js +++ b/edit/applies-to-line-widget.js @@ -484,7 +484,7 @@ function createAppliesToLineWidget(cm) { const text = cm.getValue(); const re = /^[\t ]*@-moz-document[\s\n]+/gm; const applyRe = new RegExp([ - /(?:\/\*[^*]*\*\/[\s\n]*)*/, + /(?:\/\*[\s\S]*?(?:\*\/\s*|$))*/, /(url|url-prefix|domain|regexp)/, /\(((['"])(?:\\\\|\\\n|\\\3|[^\n])*?\3|[^)\n]*)\)\s*(,\s*)?/, ].map(rx => rx.source).join(''), 'giy'); diff --git a/edit/sections.js b/edit/sections.js index 577ff479..5fc27d80 100644 --- a/edit/sections.js +++ b/edit/sections.js @@ -195,7 +195,7 @@ function setupCodeMirror(sectionDiv, code, index) { const text = event.clipboardData.getData('text') || ''; if ( text.includes('@-moz-document') && - text.replace(/\/\*[\s\S]*?\*\//g, '') + text.replace(/\/\*[\s\S]*?(?:\*\/|$)/g, '') .match(/@-moz-document[\s\r\n]+(url|url-prefix|domain|regexp)\(/) ) { event.preventDefault(); diff --git a/vendor-overwrites/colorpicker/colorview.js b/vendor-overwrites/colorpicker/colorview.js index 2d9ce2d0..69a72410 100644 --- a/vendor-overwrites/colorpicker/colorview.js +++ b/vendor-overwrites/colorpicker/colorview.js @@ -48,7 +48,7 @@ ')', 'gi'); const RX_DETECT_FUNC = /(rgb|hsl)a?\(/iy; - const RX_COMMENT = /\/\*(?:.(?!\*\/))*(?:.?\*\/|$)/g; + const RX_COMMENT = /\/\*[\s\S]*?(?:\*\/|$)/g; const SPACE1K = ' '.repeat(1000); // milliseconds to work on invisible colors per one run