Switch to using Context.javaToJS instead of Context.toObject

git-svn-id: svn://10.0.0.236/trunk@157503 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org
2004-06-07 10:35:22 +00:00
parent e207feccac
commit 9a39b3b949
4 changed files with 6 additions and 9 deletions

View File

@@ -41,7 +41,6 @@ import org.mozilla.javascript.*;
*/
public class RunScript2 {
public static void main(String args[])
throws JavaScriptException
{
Context cx = Context.enter();
try {
@@ -49,8 +48,8 @@ public class RunScript2 {
// Add a global variable "out" that is a JavaScript reflection
// of System.out
Scriptable jsArgs = Context.toObject(System.out, scope);
scope.put("out", scope, jsArgs);
Object jsOut = Context.javaToJS(System.out, scope);
ScriptableObject.putProperty(scope, "out", jsOut);
String s = "";
for (int i=0; i < args.length; i++) {