Skip to content
Snippets Groups Projects
Commit 872ae6a9 authored by Guy Zana's avatar Guy Zana
Browse files

cli: make the JS scope variable public and static so it can be accessible

other classes may need to read/write global javascript objects, the run
command which is going to be commited in the next patch deals with it
parent 7e8afabe
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,8 @@ public class RhinoCLI { ...@@ -11,6 +11,8 @@ public class RhinoCLI {
public static Global global = new Global(); public static Global global = new Global();
public static Scriptable _scope;
// //
// Invoke the cli.js file take care of exposing all scriptable objects // Invoke the cli.js file take care of exposing all scriptable objects
// such as the tests // such as the tests
...@@ -20,11 +22,11 @@ public class RhinoCLI { ...@@ -20,11 +22,11 @@ public class RhinoCLI {
try { try {
global.init(cx); global.init(cx);
Scriptable scope = ScriptableObject.getTopLevelScope(global); _scope = ScriptableObject.getTopLevelScope(global);
ScriptableObject.defineClass(scope, TCPEchoServerTest.class); ScriptableObject.defineClass(_scope, TCPEchoServerTest.class);
FileReader cli_js = new FileReader("/console/cli.js"); FileReader cli_js = new FileReader("/console/cli.js");
cx.evaluateReader(scope, cli_js, "cli.js", 1, null); cx.evaluateReader(_scope, cli_js, "cli.js", 1, null);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment