Samsung / jalangi2

Dynamic analysis framework for JavaScript
Apache License 2.0
435 stars 119 forks source link

how to deal with the problem of "document is not defined". #139

Open meixufen opened 7 years ago

meixufen commented 7 years ago

When I instrumented and analysed the js file use this command: T:\github_jalangi2\experiments> node ..\src\js\commands\jalangi.js --inlineIID --inlineSource --analysis .\getbyid.js .\getid.js, I met this problem: ReferenceError: document is not defined at T:\github_jalangi2\experiments\getbyid.js:5:32 at Object. (T:\github_jalangi2\experiments\getbyid.js:30:3) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at T:\github_jalangi2\src\js\commands\jalangi.js:90:9

In my getid.js, I used the statement: var element = document.getElementById('show_file_org'); how can I deal with this problem, thanks.

zcl0203 commented 7 years ago

Maybe you can create a html file and execute the getid.js file in it ,the use the offline instrumentation on the whole project and this error message won't appear in the browser console.

ZAhmaad commented 3 years ago

@zcl0203 Hi, I used to run my js file in html and then used the offline instrumentation on whole project by using the following command:

node src/js/commands/instrument.js --inlineIID --inlineSource -i --inlineJalangi --analysis src/js/commands/conditoncheck.js --outputDir /tmp test2/test3

The analysis works in terminal without showing any error. when i open the html file by giving the following command, It just gives the output of html file in console but not output of analysis on that file.

file:///tmp/test2/test3/new.html

Any solution in that case?