From 0eb20948e15a7763936032e1e0a55ee46969da7e Mon Sep 17 00:00:00 2001 From: NateN1222 Date: Wed, 11 Oct 2017 20:10:01 -0500 Subject: Made a debugging page for the evaluation code --- main_background.js | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'main_background.js') 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?) -- cgit v1.2.3