[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FormControl.java,1.33,1.34 WebResponse.ja
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-02-05 16:08:12
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv7415/src/com/meterware/httpunit
Modified Files:
FormControl.java WebResponse.java
Log Message:
Check for HTML before trying to run scripts in new window
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- FormControl.java 30 Dec 2002 21:46:54 -0000 1.33
+++ FormControl.java 5 Feb 2003 16:07:38 -0000 1.34
@@ -49,7 +49,13 @@
private final String _onClickEvent;
private final WebForm _form;
- FormControl( WebForm form ) {
+
+ static ScriptableDelegate newSelectionOption() {
+ return new SelectionFormControl.Option();
+ }
+
+
+ FormControl( WebForm form ) {
super( newEmptyNode( form ) );
_form = form;
_valueAttribute = "";
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -r1.107 -r1.108
--- WebResponse.java 5 Feb 2003 05:15:51 -0000 1.107
+++ WebResponse.java 5 Feb 2003 16:07:39 -0000 1.108
@@ -538,7 +538,7 @@
public static ScriptableDelegate newDelegate( String delegateClassName ) {
if (delegateClassName.equalsIgnoreCase( "Option" )) {
- return new SelectionFormControl.Option();
+ return FormControl.newSelectionOption();
} else {
throw new IllegalArgumentException( "No such scripting class supported: " + delegateClassName );
}
@@ -587,11 +587,13 @@
public void load() throws SAXException {
- final String[] scripts = getReceivedPage().getScripts();
- for (int i = 0; i < scripts.length; i++) {
- runScript( scripts[i] );
+ if (isHTML()) {
+ final String[] scripts = getReceivedPage().getScripts();
+ for (int i = 0; i < scripts.length; i++) {
+ runScript( scripts[i] );
+ }
+ doEvent( getReceivedPage().getOnLoadEvent() );
}
- doEvent( getReceivedPage().getOnLoadEvent() );
}
|