diff options
Diffstat (limited to 'data/chrome_worker/parser')
-rw-r--r-- | data/chrome_worker/parser/jsdefs.js | 8 | ||||
-rw-r--r-- | data/chrome_worker/parser/jslex.js | 16 | ||||
-rw-r--r-- | data/chrome_worker/parser/jsparse.js | 2 | ||||
-rw-r--r-- | data/chrome_worker/parser/parse.js | 10 |
4 files changed, 18 insertions, 18 deletions
diff --git a/data/chrome_worker/parser/jsdefs.js b/data/chrome_worker/parser/jsdefs.js index aff5c08..684934c 100644 --- a/data/chrome_worker/parser/jsdefs.js +++ b/data/chrome_worker/parser/jsdefs.js @@ -50,7 +50,7 @@ * done by SpiderMonkey. */ /** - * 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 * @@ -83,7 +83,7 @@ var Narcissus = {}; }, hostSupportsEvalConst: (function() { try { - return eval("(function(s) { eval(s); return x })('const x = true;')"); + return (function(s){if(s !== undefined){const x = true; return x;}}()); } catch (e) { return false; } @@ -164,7 +164,7 @@ Narcissus.definitions = (function() { // Whitespace characters (see ECMA-262 7.2) var whitespaceChars = [ // normal whitespace: - "\u0009", "\u000B", "\u000C", "\u0020", "\u00A0", "\uFEFF", + "\u0009", "\u000B", "\u000C", "\u0020", "\u00A0", "\uFEFF", // high-Unicode whitespace: "\u1680", "\u180E", @@ -327,7 +327,7 @@ Narcissus.definitions = (function() { var argStr = "a[0]"; for (var i = 1, n = a.length; i < n; i++) argStr += ",a[" + i + "]"; - return eval("new f(" + argStr + ")"); + return `new f(${argStr})`; } }; } 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) { diff --git a/data/chrome_worker/parser/jsparse.js b/data/chrome_worker/parser/jsparse.js index b78078c..113e989 100644 --- a/data/chrome_worker/parser/jsparse.js +++ b/data/chrome_worker/parser/jsparse.js @@ -43,7 +43,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 * diff --git a/data/chrome_worker/parser/parse.js b/data/chrome_worker/parser/parse.js index 07c800e..20a9e17 100644 --- a/data/chrome_worker/parser/parse.js +++ b/data/chrome_worker/parser/parse.js @@ -1,23 +1,23 @@ /** - * 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 * Copyright (C) 2014, 2015 Nik Nyby * - * This file is part of GNU LibreJS. + * This file is part of GNU LibreJSXUL. * - * GNU LibreJS is free software: you can redistribute it and/or modify + * GNU LibreJSXUL is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * - * GNU LibreJS is distributed in the hope that it will be useful, + * GNU LibreJSXUL is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>. + * along with GNU LibreJSXUL. If not, see <http://www.gnu.org/licenses/>. */ /** |