aboutsummaryrefslogtreecommitdiff
path: root/main_background.js
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2018-09-18 17:15:30 +0200
committerhackademix <giorgio@maone.net>2018-09-18 17:15:30 +0200
commit813daae97602ad7143e23fd6d955bef5e413dc7a (patch)
tree3bd16a3657cdd207b71a10c64080daf1f3a5a043 /main_background.js
parent3e4c252f982637b54719b427ac85ac3701d44abd (diff)
Update for compatibility with Acorn 6.
Diffstat (limited to 'main_background.js')
-rw-r--r--main_background.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/main_background.js b/main_background.js
index 9e08976..5b745c1 100644
--- a/main_background.js
+++ b/main_background.js
@@ -20,10 +20,9 @@
* along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
*/
-var acorn_base = require("acorn");
-var acorn = require('acorn/dist/acorn_loose');
+var acorn = require('acorn');
+var acornLoose = require('acorn-loose');
var jssha = require('jssha');
-var walk = require("acorn/dist/walk");
var legacy_license_lib = require("./legacy_license_check.js");
var {ResponseProcessor} = require("./bg/ResponseProcessor");
var {Storage, ListStore} = require("./common/Storage");
@@ -462,7 +461,7 @@ function full_evaluate(script){
return [true,"Harmless null script"];
}
- var ast = acorn.parse_dammit(script).body[0];
+ var ast = acornLoose.parse(script).body[0];
var flag = false;
var amtloops = 0;
@@ -470,7 +469,7 @@ function full_evaluate(script){
var loopkeys = {"for":true,"if":true,"while":true,"switch":true};
var operators = {"||":true,"&&":true,"=":true,"==":true,"++":true,"--":true,"+=":true,"-=":true,"*":true};
try{
- var tokens = acorn_base.tokenizer(script);
+ var tokens = acorn.tokenizer(script);
}catch(e){
console.warn("Tokenizer could not be initiated (probably invalid code)");
return [false,"Tokenizer could not be initiated (probably invalid code)"];
@@ -512,7 +511,7 @@ function full_evaluate(script){
return script.charAt(end+i) == "[";
}
var error_count = 0;
- while(toke !== undefined && toke.type != acorn_base.tokTypes.eof){
+ while(toke !== undefined && toke.type != acorn.tokTypes.eof){
if(toke.type.keyword !== undefined){
//dbg_print("Keyword:");
//dbg_print(toke);