fix disabling of call / apply for ajaxslt test
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@4408 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
da746ac8a4
commit
c18cc405f7
|
@ -40,7 +40,7 @@ public class JsViewerDriver extends Util {
|
||||||
|
|
||||||
SourceModule[] sources = getSources(domless, url);
|
SourceModule[] sources = getSources(domless, url);
|
||||||
|
|
||||||
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory), sources, false);
|
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory), sources, false, true);
|
||||||
builder.setBaseURL(url);
|
builder.setBaseURL(url);
|
||||||
|
|
||||||
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
||||||
|
|
|
@ -13,12 +13,9 @@ package com.ibm.wala.cast.js.test;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.ibm.wala.cast.js.ipa.callgraph.JSAnalysisOptions;
|
|
||||||
import com.ibm.wala.ipa.callgraph.CallGraph;
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
import com.ibm.wala.ipa.callgraph.propagation.PropagationCallGraphBuilder;
|
|
||||||
import com.ibm.wala.util.CancelException;
|
import com.ibm.wala.util.CancelException;
|
||||||
|
|
||||||
public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
|
public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
|
||||||
|
@ -33,9 +30,9 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
|
||||||
|
|
||||||
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException {
|
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException {
|
||||||
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
|
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
|
||||||
PropagationCallGraphBuilder b = Util.makeHTMLCGBuilder(url);
|
// don't handle call / apply; it makes things blow up
|
||||||
((JSAnalysisOptions) b.getOptions()).setHandleCallApply(false);
|
CallGraph CG = Util.makeHTMLCG(url, false);
|
||||||
CallGraph CG = b.makeCallGraph(b.getOptions());
|
|
||||||
verifyGraphAssertions(CG, assertionsForAjaxslt);
|
verifyGraphAssertions(CG, assertionsForAjaxslt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,10 @@ import com.ibm.wala.ipa.callgraph.propagation.cfa.ZeroXInstanceKeys;
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
import com.ibm.wala.ipa.cha.IClassHierarchy;
|
||||||
import com.ibm.wala.util.CancelException;
|
import com.ibm.wala.util.CancelException;
|
||||||
import com.ibm.wala.util.MonitorUtil.IProgressMonitor;
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO this class is a mess. rewrite.
|
||||||
|
*/
|
||||||
public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
|
public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
|
||||||
|
|
||||||
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, boolean useOneCFA) throws IOException {
|
public static JSCFABuilder makeScriptCGBuilder(String dir, String name, boolean useOneCFA) throws IOException {
|
||||||
|
@ -57,7 +59,7 @@ public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
|
||||||
scope = makeScope(new SourceFileModule[] { makeSourceModule(script, dir, name) }, loaders, JavaScriptLoader.JS);
|
scope = makeScope(new SourceFileModule[] { makeSourceModule(script, dir, name) }, loaders, JavaScriptLoader.JS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return makeCG(loaders, scope, useOneCFA);
|
return makeCG(loaders, scope, useOneCFA, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSCFABuilder makeScriptCGBuilder(String dir, String name) throws IOException {
|
public static JSCFABuilder makeScriptCGBuilder(String dir, String name) throws IOException {
|
||||||
|
@ -78,16 +80,19 @@ public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
|
||||||
|
|
||||||
public static CallGraph makeScriptCG(SourceModule[] scripts, boolean useOneCFA) throws IOException, IllegalArgumentException,
|
public static CallGraph makeScriptCG(SourceModule[] scripts, boolean useOneCFA) throws IOException, IllegalArgumentException,
|
||||||
CancelException {
|
CancelException {
|
||||||
PropagationCallGraphBuilder b = makeCGBuilder(makeLoaders(), scripts, useOneCFA);
|
PropagationCallGraphBuilder b = makeCGBuilder(makeLoaders(), scripts, useOneCFA, true);
|
||||||
CallGraph CG = b.makeCallGraph(b.getOptions());
|
CallGraph CG = b.makeCallGraph(b.getOptions());
|
||||||
dumpCG(b.getPointerAnalysis(), CG);
|
dumpCG(b.getPointerAnalysis(), CG);
|
||||||
return CG;
|
return CG;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSCFABuilder makeHTMLCGBuilder(URL url) throws IOException {
|
public static JSCFABuilder makeHTMLCGBuilder(URL url) throws IOException {
|
||||||
|
return makeHTMLCGBuilder(url, true);
|
||||||
|
}
|
||||||
|
public static JSCFABuilder makeHTMLCGBuilder(URL url, boolean handleCallApply) throws IOException {
|
||||||
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
|
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
|
||||||
Set<MappedSourceModule> script = WebUtil.extractScriptFromHTML(url);
|
Set<MappedSourceModule> script = WebUtil.extractScriptFromHTML(url);
|
||||||
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory, preprocessor), script.toArray(new SourceModule[script.size()]), false);
|
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory, preprocessor), script.toArray(new SourceModule[script.size()]), false, handleCallApply);
|
||||||
builder.setBaseURL(url);
|
builder.setBaseURL(url);
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -99,24 +104,25 @@ public class Util extends com.ibm.wala.cast.js.ipa.callgraph.Util {
|
||||||
return CG;
|
return CG;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CallGraph makeHTMLCG(URL url, IProgressMonitor monitor) throws IOException, IllegalArgumentException,
|
public static CallGraph makeHTMLCG(URL url, boolean handleCallApply) throws IOException, IllegalArgumentException,
|
||||||
CancelException {
|
CancelException {
|
||||||
PropagationCallGraphBuilder b = makeHTMLCGBuilder(url);
|
PropagationCallGraphBuilder b = makeHTMLCGBuilder(url, handleCallApply);
|
||||||
CallGraph CG = b.makeCallGraph(b.getOptions(), monitor);
|
CallGraph CG = b.makeCallGraph(b.getOptions());
|
||||||
return CG;
|
return CG;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSCFABuilder makeCGBuilder(JavaScriptLoaderFactory loaders, SourceModule[] scripts, boolean useOneCFA) throws IOException {
|
public static JSCFABuilder makeCGBuilder(JavaScriptLoaderFactory loaders, SourceModule[] scripts, boolean useOneCFA, boolean handleCallApply) throws IOException {
|
||||||
AnalysisScope scope = makeScope(scripts, loaders, JavaScriptLoader.JS);
|
AnalysisScope scope = makeScope(scripts, loaders, JavaScriptLoader.JS);
|
||||||
return makeCG(loaders, scope, useOneCFA);
|
return makeCG(loaders, scope, useOneCFA, handleCallApply);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, boolean useOneCFA) throws IOException {
|
protected static JSCFABuilder makeCG(JavaScriptLoaderFactory loaders, AnalysisScope scope, boolean useOneCFA, boolean handleCallApply) throws IOException {
|
||||||
try {
|
try {
|
||||||
IClassHierarchy cha = makeHierarchy(scope, loaders);
|
IClassHierarchy cha = makeHierarchy(scope, loaders);
|
||||||
com.ibm.wala.cast.test.Util.checkForFrontEndErrors(cha);
|
com.ibm.wala.cast.test.Util.checkForFrontEndErrors(cha);
|
||||||
Iterable<Entrypoint> roots = makeScriptRoots(cha);
|
Iterable<Entrypoint> roots = makeScriptRoots(cha);
|
||||||
JSAnalysisOptions options = makeOptions(scope, cha, roots);
|
JSAnalysisOptions options = makeOptions(scope, cha, roots);
|
||||||
|
options.setHandleCallApply(handleCallApply);
|
||||||
AnalysisCache cache = makeCache();
|
AnalysisCache cache = makeCache();
|
||||||
|
|
||||||
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS, useOneCFA);
|
JSCFABuilder builder = new JSZeroOrOneXCFABuilder(cha, options, cache, null, null, ZeroXInstanceKeys.ALLOCATIONS, useOneCFA);
|
||||||
|
|
|
@ -58,12 +58,12 @@ public class Util extends com.ibm.wala.cast.ipa.callgraph.Util {
|
||||||
* the translator factory to be used for analysis TODO: pass the factory where
|
* the translator factory to be used for analysis TODO: pass the factory where
|
||||||
* needed instead of using a global?
|
* needed instead of using a global?
|
||||||
*/
|
*/
|
||||||
protected static JavaScriptTranslatorFactory translatorFactory;
|
public static JavaScriptTranslatorFactory translatorFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* preprocessor to run generated CAst trees through, null if none
|
* preprocessor to run generated CAst trees through, null if none
|
||||||
*/
|
*/
|
||||||
protected static CAstRewriterFactory preprocessor;
|
public static CAstRewriterFactory preprocessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the translator factory. This method should be called before invoking
|
* Set up the translator factory. This method should be called before invoking
|
||||||
|
|
Loading…
Reference in New Issue