Skip to content

Commit fa358cf

Browse files
committedFeb 9, 2021
webApp not working
1 parent 4519e2d commit fa358cf

File tree

4 files changed

+34
-20
lines changed

4 files changed

+34
-20
lines changed
 

‎.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
node_modules
3+
*_jalangi_*

‎DCG.js

+25-18
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,13 @@
172172
//Identifying Non-native -> Native Calls
173173
if ((f.toString().indexOf('[native code]') > -1 || f.toString().indexOf('[object ') === 0)) {
174174
callerIid = getLoc(giid);
175-
if (["apply","call"].includes(funName) || funName.startsWith("bound ")){
176-
applyStack.push(giid)
175+
//if (["apply","call"].includes(funName) || funName.startsWith("bound ")){
176+
//applyStack.push(giid)
177177
calleeIid = iidToFunName[giid] + " (Native)" + " [" + getLoc(giid)+"]"
178-
}
179-
else{
180-
calleeIid = iidToFunName[giid] + " (Native)"
181-
}
178+
//}
179+
//else{
180+
//calleeIid = iidToFunName[giid] + " (Native)"
181+
//}
182182

183183
//Adding the caller and the callee to the call edge list
184184
if (!(callerIid in callerToCallee)) {
@@ -190,7 +190,7 @@
190190
calleeIids.push(calleeIid);
191191
}
192192

193-
callStack.push(giid);
193+
callStack.push(giid); //what if we move this out and use this for both native and non-native calls
194194
}
195195
},
196196

@@ -224,13 +224,19 @@
224224
}
225225
else{
226226
//Identifying Native -> Non-native Calls
227-
if ((["apply","call"].includes(callerName) || callerName.startsWith("bound ")) && applyStack.length>0){
228-
var apcal_loc= applyStack[applyStack.length - 1];
229-
callerIid = callerName + " (Native)" + " [" + getLoc(apcal_loc) +"]" ;
230-
}
231-
else{
232-
callerIid = callerName + " (Native)"
233-
}
227+
//if ((["apply","call"].includes(callerName) || callerName.startsWith("bound ")) && applyStack.length>0){
228+
//var apcal_loc= applyStack[applyStack.length - 1];
229+
//callerIid = callerName + " (Native)" + " [" + getLoc(apcal_loc) +"]" ;
230+
if(callStack.length>0){
231+
callerIid = callerName + " (Native)" + " [" + getLoc(callStack[callStack.length - 1]) +"]" ;
232+
}else{
233+
callerIid = callerName + " (Native)"
234+
}
235+
236+
//}
237+
//else{
238+
//callerIid = callerName + " (Native)"
239+
//}
234240

235241
}
236242
}
@@ -316,9 +322,9 @@
316322
if (callStack[callStack.length - 1] == giid) {
317323
callStack.pop();
318324
}
319-
if (applyStack[applyStack.length - 1] == giid) {
325+
/*if (applyStack[applyStack.length - 1] == giid) {
320326
applyStack.pop();
321-
}
327+
}*/
322328

323329
},
324330
/**
@@ -356,15 +362,16 @@
356362
}
357363
}
358364
//Writing the output to a file
359-
if (!isBrowser) {
365+
/*if (!isBrowser) {
360366
var jsonString = JSON.stringify(jsonCallList,null,4)
361367
origName = process.argv[1];
362368
instname = origName.replace(/.js$/, "_dynCalls.json");
363369
fs.writeFileSync(instname, jsonString, function(err) {
364370
if(err) console.log('error', err);
365371
});
366-
}
372+
}*/
367373
J$.callList=jsonCallList
374+
//console.log(jsonCallList)
368375
return J$.callList
369376
}
370377

‎WebAppEval.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
const puppeteer = require('puppeteer');
22
const fs = require('fs');
33
const process = require('process');
4-
var jalangi = require('/Users/madhurimachakraborty/Documents/jalangi2/src/js/utils/api');
4+
var jalangi = require('../node_modules/jalangi2/src/js/utils/api');
55
var inputDir =[]
66
inputDir.push(process.argv[2])
77
var options = {
88
instrumentInline: true,
99
inlineIID: true,
1010
inlineSource: true,
1111
inlineJalangi: true,
12-
analysis: ['src/js/sample_analyses/ChainedAnalyses.js', 'src/js/sample_analyses/dlint/Utils.js', 'experiments/metrics/DynNative.js'],
12+
analysis: ['../node_modules/jalangi2/src/js/sample_analyses/ChainedAnalyses.js', '../node_modules/jalangi2/src/js/sample_analyses/dlint/Utils.js', './DCG.js'],
1313
outputDir: '/tmp',
1414
inputFiles: inputDir
1515
};

‎package.json

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"type": "git",
1414
"url": "git+https://github.com/ucr-riple/DynCallGraphJS.git"
1515
},
16+
"dependencies": {
17+
"jalangi2": "0.2.6",
18+
"puppeteer": "5.5.0"
19+
},
1620
"author": "",
1721
"license": "ISC",
1822
"bugs": {

0 commit comments

Comments
 (0)