[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebResponse.java,1.101,1.102
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2002-11-19 04:57:20
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv11470/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Fixed frame name array index and top.parent bug
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- WebResponse.java 17 Nov 2002 16:43:41 -0000 1.101
+++ WebResponse.java 19 Nov 2002 04:57:17 -0000 1.102
@@ -20,6 +20,7 @@
*
*******************************************************************************************************************/
import com.meterware.httpunit.scripting.ScriptableDelegate;
+import com.meterware.httpunit.scripting.NamedDelegate;
import com.meterware.httpunit.cookies.CookieJar;
import com.meterware.httpunit.cookies.CookieSource;
@@ -532,7 +533,7 @@
}
- public class Scriptable extends ScriptableDelegate {
+ public class Scriptable extends ScriptableDelegate implements NamedDelegate {
public void alert( String message ) {
_client.postAlert( message );
@@ -607,11 +608,11 @@
**/
public Object get( String propertyName ) {
if (propertyName.equals( "name" )) {
- return getFrameName().equals( WebRequest.TOP_FRAME ) ? _window.getName() : getFrameName();
+ return getName();
} else if (propertyName.equalsIgnoreCase( "top" )) {
return _window.getFrameContents( WebRequest.TOP_FRAME ).getScriptableObject();
} else if (propertyName.equalsIgnoreCase( "parent" )) {
- return getFrameName().equals( WebRequest.TOP_FRAME ) ? null
+ return getFrameName().equals( WebRequest.TOP_FRAME ) ? this
: _window.getFrameContents( WebFrame.getParentFrameName( getFrameName() ) ).getScriptableObject();
} else if (propertyName.equalsIgnoreCase( "opener" )) {
return getFrameName().equals( WebRequest.TOP_FRAME ) ? getScriptable( _window.getOpener() ) : null;
@@ -624,6 +625,11 @@
return super.get( propertyName );
}
}
+ }
+
+
+ public String getName() {
+ return getFrameName().equals( WebRequest.TOP_FRAME ) ? _window.getName() : getFrameName();
}
|