vhardy 2002/06/06 01:24:10 Modified: sources/org/apache/batik/script/rhino WindowWrapper.java Log: Fixed problem showed by ..../script/rhino/eval.svg Revision Changes Path 1.10 +25 -1 xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java Index: WindowWrapper.java =================================================================== RCS file: /home/cvs/xml-batik/sources/org/apache/batik/script/rhino/WindowWrapper.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- WindowWrapper.java 14 May 2002 08:57:32 -0000 1.9 +++ WindowWrapper.java 6 Jun 2002 08:24:10 -0000 1.10 @@ -36,7 +36,7 @@ * This class wraps a Window object to expose it to the interpreter. * * @author <a href="mailto:[EMAIL PROTECTED]">Stephane Hillion</a> - * @version $Id: WindowWrapper.java,v 1.9 2002/05/14 08:57:32 vhardy Exp $ + * @version $Id: WindowWrapper.java,v 1.10 2002/06/06 08:24:10 vhardy Exp $ */ public class WindowWrapper extends ScriptableObject { @@ -74,6 +74,30 @@ public String toString() { return "[object Window]"; + } + + /** + * Wraps the 'eval' methods of the Window interface. + */ + public static void jsFunction_eval(Context cx, + Scriptable thisObj, + Object[] args, + Function funObj) + throws JavaScriptException { + int len = args.length; + WindowWrapper ww = (WindowWrapper)thisObj; + Window window = ww.window; + if (len >= 1) { + String code = + (String)NativeJavaObject.coerceType(String.class, args[0]); + RhinoInterpreter interp = + (RhinoInterpreter)window.getInterpreter(); + try { + interp.evaluate(code); + } catch (InterpreterException e) { + throw new JavaScriptException(e); + } + } } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]