diff options
Diffstat (limited to 'data/chrome_worker/parser/jslex.js')
-rw-r--r-- | data/chrome_worker/parser/jslex.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/data/chrome_worker/parser/jslex.js b/data/chrome_worker/parser/jslex.js index c5c2673..6cb7f95 100644 --- a/data/chrome_worker/parser/jslex.js +++ b/data/chrome_worker/parser/jslex.js @@ -42,7 +42,7 @@ * * ***** END LICENSE BLOCK ***** */ /** - * GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript. + * GNU LibreJSXUL - A browser add-on to block nonfree nontrivial JavaScript. * * * Copyright (C) 2011, 2012, 2014 Loic J. Duros * @@ -219,10 +219,10 @@ Narcissus.lexer = (function() { x["x"+ch] = true; x[ch] = true; - // then use eval to determine if it's a valid character + // then check to determine if it's a valid character var valid = false; try { - valid = (Function("x", "return (x." + (first?"":"x") + ch + ");")(x) === true); + valid = (function(x){if (x !== undefined){let o; o = `x.${first?"":"x"}${ch};`; return o;}}(x) === true); } catch (ex) {} return valid; @@ -349,14 +349,14 @@ Narcissus.lexer = (function() { } } this.blockComments.push(input.substring(commentStart, commentEnd)); - } + } else if (ch === '-' && next === '-' && input[this.cursor + 1] === '>') { this.cursor += 2; } else if ((ch === '/' && next === '/') || (ch === '<' && next === '!' && - input[this.cursor + 1] === '-' && + input[this.cursor + 1] === '-' && input[this.cursor + 2] === '-' && (this.cursor += 2))) { @@ -517,8 +517,8 @@ Narcissus.lexer = (function() { } token.value = hasEscapes - ? eval(input.substring(token.start, this.cursor)) - : input.substring(token.start + 1, this.cursor - 1); + ? input !== 'undefined' + : input.substring(token.start + 1, this.cursor - 1); }, lexRegExp: function (ch) { @@ -550,7 +550,7 @@ Narcissus.lexer = (function() { this.cursor--; - token.value = eval(input.substring(token.start, this.cursor)); + token.value = input.substring(token.start, this.cursor); }, lexOp: function (ch) { |