use of org.mozilla.javascript.tools.shell.Global in project hackpad by dropbox.
the class Main method mainEmbeddedImpl.
/**
* Helper method for {@link #mainEmbedded(String)}, etc.
*/
private static Main mainEmbeddedImpl(ContextFactory factory, Object scopeProvider, String title) {
if (title == null) {
title = "Rhino JavaScript Debugger (embedded usage)";
}
Main main = new Main(title);
main.doBreak();
main.setExitAction(new IProxy(IProxy.EXIT_ACTION));
main.attachTo(factory);
if (scopeProvider instanceof ScopeProvider) {
main.setScopeProvider((ScopeProvider) scopeProvider);
} else {
Scriptable scope = (Scriptable) scopeProvider;
if (scope instanceof Global) {
Global global = (Global) scope;
global.setIn(main.getIn());
global.setOut(main.getOut());
global.setErr(main.getErr());
}
main.setScope(scope);
}
main.pack();
main.setSize(600, 460);
main.setVisible(true);
return main;
}
use of org.mozilla.javascript.tools.shell.Global in project cuke4duke by cucumber.
the class JsLanguage method begin_scenario.
protected void begin_scenario(Scenario scenario) throws Throwable {
clearHooksAndStepDefinitions();
cx = Context.enter();
// This gives us access to global functions like load()
scope = new Global(cx);
scope.put("jsLanguage", scope, this);
cx.evaluateReader(scope, new InputStreamReader(getClass().getResourceAsStream(JS_DSL)), JS_DSL, 1, null);
for (String jsFile : jsFiles) {
cx.evaluateReader(scope, new FileReader(jsFile), jsFile, 1, null);
}
}
Aggregations