diff options
author | NateN1222 <nathannichols454@gmail.com> | 2017-10-11 20:10:01 -0500 |
---|---|---|
committer | NateN1222 <nathannichols454@gmail.com> | 2017-10-11 20:10:01 -0500 |
commit | 0eb20948e15a7763936032e1e0a55ee46969da7e (patch) | |
tree | 83dbe204bde1ff7c3362d62f5261cc7327f4b3d7 /main_background.js | |
parent | 080e11de5c73b45893ff09d94383217ac02309f3 (diff) |
Made a debugging page for the evaluation code
Diffstat (limited to 'main_background.js')
-rw-r--r-- | main_background.js | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/main_background.js b/main_background.js index 3504112..fe8dd52 100644 --- a/main_background.js +++ b/main_background.js @@ -1,8 +1,5 @@ -// TO BUILD: -// browserify main_background.js -o bundle.js -// you'll have to get these required packages with npm: -const acornbase = require("acorn"); +var acornbase = require("acorn"); var acorn = require('acorn/dist/acorn_loose'); var jssha = require('jssha'); var walk = require("acorn/dist/walk"); @@ -159,8 +156,8 @@ var licenses = { // Objects which could be used to do nontrivial things. // Scripts are not allowed to call any methods on these objects or access them in any way. var reserved_objects = [ - "document", - "window", + //"document", + //"window", "fetch", "XMLHttpRequest", "chrome", // only on chrome @@ -752,14 +749,18 @@ function full_evaluate(script){ var amtloops = 0; var conditionals = 0; var flag = true; + + + console.log(ast); + + return true; + walk.full(ast, node => { if(flag){ if(node.type != "Literal"){ console.log("%c"+node.type+":","color:purple;"); console.log(script.substring(node["start"],node["end"])); } - - // Pretty sure this is bracket suffix notation if(node.type == "MemberExpression"){ @@ -767,11 +768,15 @@ function full_evaluate(script){ flag = false; } + // This is the beginning of some "object chain" + if(node.type == "ExpressionStatement"){ + + } - - - - + if(node.arguments !== undefined){ + console.log("%cCalls function:","color:white"); + script.substring(node.start,node.end) + } // "It does not declare an array more than 50 elements long." // (what about dictionaries?) |