diff --git a/mozilla/js/rhino/docs/tutorial.html b/mozilla/js/rhino/docs/tutorial.html
index eeec6f2fff7..8324c2afbf3 100644
--- a/mozilla/js/rhino/docs/tutorial.html
+++ b/mozilla/js/rhino/docs/tutorial.html
@@ -210,9 +210,8 @@ hi
The next example is RunScript2.
This is the same as RunScript, but with the addition of two extra lines
of code:
-
Scriptable jsArgs = Context.toObject(System.out,
-scope);
-
scope.put("out", scope, jsArgs);
+Object wrappedOut = Context.javaToJS(System.out, scope);
+
ScriptableObject.putProperty(scope, "out", wrappedOut);
These lines add a global variable out that is a JavaScript reflection
of the System.out variable:
$ java RunScript2 'out.println(42)'
diff --git a/mozilla/js/rhino/examples/File.java b/mozilla/js/rhino/examples/File.java
index 52bb93d4b15..d39e3565da4 100644
--- a/mozilla/js/rhino/examples/File.java
+++ b/mozilla/js/rhino/examples/File.java
@@ -252,7 +252,7 @@ public class File extends ScriptableObject {
// in a Scriptable object so that it can be manipulated by
// JavaScript.
Scriptable parent = ScriptableObject.getTopLevelScope(this);
- return Context.toObject(reader, parent);
+ return Context.javaToJS(reader, parent);
}
/**
@@ -265,7 +265,7 @@ public class File extends ScriptableObject {
if (writer == null)
return null;
Scriptable parent = ScriptableObject.getTopLevelScope(this);
- return Context.toObject(writer, parent);
+ return Context.javaToJS(writer, parent);
}
/**
diff --git a/mozilla/js/rhino/examples/RunScript2.java b/mozilla/js/rhino/examples/RunScript2.java
index 5021605ea78..79810aeb942 100644
--- a/mozilla/js/rhino/examples/RunScript2.java
+++ b/mozilla/js/rhino/examples/RunScript2.java
@@ -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++) {
diff --git a/mozilla/js/rhino/examples/RunScript3.java b/mozilla/js/rhino/examples/RunScript3.java
index 2bfee6033ee..f2505b4d063 100644
--- a/mozilla/js/rhino/examples/RunScript3.java
+++ b/mozilla/js/rhino/examples/RunScript3.java
@@ -44,7 +44,6 @@ import org.mozilla.javascript.*;
*/
public class RunScript3 {
public static void main(String args[])
- throws JavaScriptException
{
Context cx = Context.enter();
try {