From b16bbb656cf2a65d5339f6b06b51f9ffdc11d586 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski <mizdebsk@redhat.com> Date: Wed, 23 Sep 2015 08:24:17 +0200 Subject: [PATCH] Port to Rhino 1.7.7 --- .../meterware/httpunit/javascript/JavaScript.java | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/com/meterware/httpunit/javascript/JavaScript.java b/src/com/meterware/httpunit/javascript/JavaScript.java index 181186b..6d86612 100644 --- a/src/com/meterware/httpunit/javascript/JavaScript.java +++ b/src/com/meterware/httpunit/javascript/JavaScript.java @@ -55,8 +55,7 @@ public class JavaScript { * Initiates JavaScript execution for the specified web response. */ public static void run( WebResponse response ) throws IllegalAccessException, InstantiationException, - InvocationTargetException, ClassDefinitionException, NotAFunctionException, - PropertyException, SAXException, JavaScriptException { + InvocationTargetException, SAXException, JavaScriptException { Context context = Context.enter(); // suggest bug fix for large java scripts see // bug report [ 1216567 ] Exception for large javascripts @@ -75,14 +74,14 @@ public class JavaScript { /** * Runs the onload event for the specified web response. */ - public static void load( WebResponse response ) throws ClassDefinitionException, InstantiationException, IllegalAccessException, InvocationTargetException, PropertyException, JavaScriptException, SAXException, NotAFunctionException { + public static void load( WebResponse response ) throws InstantiationException, IllegalAccessException, InvocationTargetException, JavaScriptException, SAXException { if (!(response.getScriptableObject().getScriptEngine() instanceof JavaScriptEngine)) run( response ); response.getScriptableObject().load(); } private static void initHTMLObjects( Scriptable scope ) throws IllegalAccessException, InstantiationException, - InvocationTargetException, ClassDefinitionException, PropertyException { + InvocationTargetException { ScriptableObject.defineClass( scope, Window.class ); ScriptableObject.defineClass( scope, Document.class ); ScriptableObject.defineClass( scope, Style.class ); @@ -115,7 +114,7 @@ public class JavaScript { * @scriptable - the scriptable object to do the initialization for */ void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) - throws SAXException, PropertyException, JavaScriptException, NotAFunctionException { + throws SAXException, JavaScriptException { _scriptable = scriptable; _scriptable.setScriptEngine( this ); _parent = parent; @@ -305,7 +304,7 @@ public class JavaScript { } - public Scriptable jsGet_frames() throws SAXException, PropertyException, JavaScriptException, NotAFunctionException { + public Scriptable jsGet_frames() throws SAXException, JavaScriptException { if (_frames == null) { WebResponse.Scriptable scriptables[] = getDelegate().getFrames(); Window[] frames = new Window[ scriptables.length ]; @@ -350,7 +349,7 @@ public class JavaScript { * @scriptable - the scriptable object to do the initialization for */ void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) - throws JavaScriptException, NotAFunctionException, PropertyException, SAXException { + throws JavaScriptException, SAXException { super.initialize( parent, scriptable ); _location = (Location) Context.getCurrentContext().newObject( this, "Location" ); @@ -401,7 +400,7 @@ public class JavaScript { public Window jsFunction_open( Object url, String name, String features, boolean replace ) - throws PropertyException, JavaScriptException, NotAFunctionException, IOException, SAXException { + throws JavaScriptException, IOException, SAXException { WebResponse.Scriptable delegate = getDelegate().open( toStringIfNotUndefined( url ), name, features, replace ); return delegate == null ? null : (Window) toScriptable( delegate ); } @@ -771,10 +770,6 @@ public class JavaScript { static ElementArray newElementArray( Scriptable parent ) { try { return (ElementArray) Context.getCurrentContext().newObject( parent, "ElementArray" ); - } catch (PropertyException e) { - throw new RhinoException( e ); - } catch (NotAFunctionException e) { - throw new RhinoException( e ); } catch (JavaScriptException e) { throw new RhinoException( e ); } @@ -860,7 +855,7 @@ public class JavaScript { } void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) - throws JavaScriptException, NotAFunctionException, PropertyException, SAXException { + throws JavaScriptException, SAXException { super.initialize( parent, scriptable ); _document = (Document) parent; _style = (Style) Context.getCurrentContext().newObject( this, "Style" ); @@ -912,7 +907,7 @@ public class JavaScript { } - public Scriptable jsGet_elements() throws PropertyException, NotAFunctionException, JavaScriptException { + public Scriptable jsGet_elements() throws JavaScriptException { if (_controls == null) { initializeControls(); } @@ -935,7 +930,7 @@ public class JavaScript { } - private void initializeControls() throws PropertyException, NotAFunctionException, JavaScriptException { + private void initializeControls() throws JavaScriptException { ScriptableDelegate scriptables[] = getDelegate().getElementDelegates(); Control[] controls = new Control[ scriptables.length ]; for (int i = 0; i < controls.length; i++) { @@ -1011,7 +1006,7 @@ public class JavaScript { } void initialize( JavaScriptEngine parent, ScriptableDelegate scriptable ) - throws JavaScriptException, NotAFunctionException, PropertyException, SAXException { + throws JavaScriptException, SAXException { super.initialize( parent, scriptable ); if (parent instanceof Form) _form = (Form) parent; } -- 2.4.3