Incomplete JS call graph.

20 views
Skip to first unread message

Ray Zhao

unread,
Jan 17, 2020, 11:18:22 AM1/17/20
to wala.sourceforge.net
Hello everyone, I've met a problem when building the call graph for JavaScript.

I use the following code for the call graph construction

JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
JSCFABuilder builder = JSCallGraphBuilderUtil.makeScriptCGBuilder(folder, file);
return builder.makeCallGraph(builder.getOptions());


for the following JavaScript

function getAppName () {
 
return window.navigator.appName;
}


function getPlatform() {
 
return window.navigator.platform;
}


function myfunc(a, b, c) {
 
var ret = a + "|" + b + "|" + c + "|" + window.navigator.appVersion;
 
return ret;
}


function send(str) {
 
var xhr = new XMLHttpRequest();
 xhr
.open("POST", "/server.php", true);
 xhr
.send(str);
}


var x = getAppName();
var y = getPlatform();
var z = window.navigator.userAgent;
var s = myfunc(x, y, z);
send
(s);

Unfortunately, the call graph I got is incomplete.
For example, WALA is able to identify the functions 'myfunc' while not able to find its constructor, which cause a missing node in the call graph.

Is there any expertise help me figure out how to address this problem?

Lots of thanks,
Ray
Reply all
Reply to author
Forward
0 new messages