[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit/javascript JavaScriptEngineFactory.java,N
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-05 18:58:47
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv24279/src/com/meterware/httpunit/javascript Modified Files: JavaScript.java Added Files: JavaScriptEngineFactory.java Log Message: Initiate JavaScript automatically ***** Error reading new file[Errno 2] No such file or directory: 'JavaScriptEngineFactory.java' Index: JavaScript.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JavaScript.java 5 Aug 2002 17:34:25 -0000 1.4 +++ JavaScript.java 5 Aug 2002 18:58:43 -0000 1.5 @@ -48,10 +48,20 @@ /** * Initiates JavaScript execution for the specified web response. */ - static public void run( WebResponse response ) throws IllegalAccessException, InstantiationException, InvocationTargetException, - ClassDefinitionException, NotAFunctionException, PropertyException, SAXException, JavaScriptException { + static void run( WebResponse response ) throws IllegalAccessException, InstantiationException, + InvocationTargetException, ClassDefinitionException, NotAFunctionException, + PropertyException, SAXException, JavaScriptException { Context context = Context.enter(); Scriptable scope = context.initStandardObjects( null ); + initHTMLObjects( scope ); + + Window w = (Window) context.newObject( scope, "Window" ); + w.initialize( null, response.getScriptableObject() ); + } + + + private static void initHTMLObjects( Scriptable scope ) throws IllegalAccessException, InstantiationException, + InvocationTargetException, ClassDefinitionException, PropertyException { ScriptableObject.defineClass( scope, Window.class ); ScriptableObject.defineClass( scope, Document.class ); ScriptableObject.defineClass( scope, Link.class ); @@ -59,9 +69,6 @@ ScriptableObject.defineClass( scope, Control.class ); ScriptableObject.defineClass( scope, Link.class ); ScriptableObject.defineClass( scope, Image.class ); - Window w = (Window) context.newObject( scope, "Window" ); - - w.initialize( null, response.getScriptableObject() ); } |