You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by cj...@apache.org on 2002/11/05 18:29:51 UTC
cvs commit: xml-batik/sources/org/apache/batik/script/rhino RhinoInterpreter.java
cjolif 2002/11/05 09:29:51
Modified: sources/org/apache/batik/script/rhino RhinoInterpreter.java
Log:
The window object used as a global object was not inited with default global
properties of ECMAScript global object (for example calling "eval" was not working
anymore)
Revision Changes Path
1.20 +20 -12 xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java
Index: RhinoInterpreter.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/RhinoInterpreter.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- RhinoInterpreter.java 18 Jun 2002 08:27:22 -0000 1.19
+++ RhinoInterpreter.java 5 Nov 2002 17:29:51 -0000 1.20
@@ -96,10 +96,10 @@
/**
* The SecuritySupport implementation for Batik,
- * which ensures scripts have access to the
+ * which ensures scripts have access to the
* server they were downloaded from
*/
- private SecuritySupport securitySupport
+ private SecuritySupport securitySupport
= new BatikSecuritySupport();
/**
@@ -111,21 +111,21 @@
/**
* Default Context for scripts. This is used only for efficiency
- * reason.
+ * reason.
*/
protected Context defaultContext;
/**
- * Context vector, to make sure we are not
+ * Context vector, to make sure we are not
* setting the security context too many times
*/
protected Vector contexts = new Vector();
/**
* Build a <code>Interpreter</code> for ECMAScript using Rhino.
- *
+ *
* @param documentURL the URL for the document which references
- *
+ *
* @see org.apache.batik.script.Interpreter
* @see org.apache.batik.script.InterpreterPool
*/
@@ -137,7 +137,7 @@
// entering a context
defaultContext = enterContext();
Context ctx = defaultContext;
-
+
try {
// init std object with an importer
@@ -166,7 +166,7 @@
}
/**
- * Implementation helper. Makes sure the proper security is set
+ * Implementation helper. Makes sure the proper security is set
* on the context.
*/
public Context enterContext(){
@@ -178,7 +178,7 @@
ctx.setSecuritySupport(securitySupport);
contexts.add(ctx);
- // Hopefully, we are not switching threads too
+ // Hopefully, we are not switching threads too
// often ....
defaultContext = ctx;
}
@@ -245,7 +245,7 @@
*/
public Object evaluate(final String scriptstr)
throws InterpreterException {
-
+
final Context ctx = enterContext();
ctx.setWrapHandler(wrapHandler);
@@ -356,6 +356,14 @@
// The window becomes the global object.
globalObject =
(ScriptableObject)globalObject.get(BIND_NAME_WINDOW, globalObject);
+
+ // we need to init it as a global object...
+ ctx = enterContext();
+ try {
+ ctx.initStandardObjects(globalObject);
+ } finally {
+ Context.exit();
+ }
} catch (Exception e) {
// Cannot happen.
}
@@ -415,7 +423,7 @@
/**
* To build an argument list.
*/
- public interface ArgumentsBuilder {
+ public interface ArgumentsBuilder {
Object[] buildArguments();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org