Re: missing proxy for a Window

Russell Gold <[email protected]>
Newsgroups gmane.comp.web.httpunit.devel
Message-ID <[email protected]>
Very briefly - the proxy can only be set once we have parsed the  
document; however, at time the javascript needs to access the window  
object before this has happened. To handle this, we allow the creation  
of the window object early, and set its proxy once we have it.


On Mar 28, 2008, at 7:40 AM, Wolfgang Fahl wrote:

> This is probably a question for Russel,
>
> while debugging the new Javascript dom implementation i traced down  
> a problem to a null pointer exception and then made the error  
> message more readable like this:
> Caused by: java.lang.RuntimeException : DomWindow.open failed for  
> 'target' _proxy is null
>       at com.meterware.httpunit.dom.DomWindow.open( DomWindow.java: 
> 87 )
>       at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method )
>       at  
> sun 
> .reflect 
> .NativeMethodAccessorImpl.invoke( NativeMethodAccessorImpl.java:39 )
>       at  
> sun 
> .reflect 
> .DelegatingMethodAccessorImpl 
> .invoke( DelegatingMethodAccessorImpl.java:25 )
>       at java.lang.reflect.Method.invoke( Method.java:585 )
>       at org.mozilla.javascript.MemberBox.invoke( MemberBox.java:145 )
>       ... 55 more
>
> The cause seems to be the constructor which does not set a proxy:
>     /**
>      *   construct   me   from   a   document
>      *   @param   document
>      */
>     public  DomWindow( HTMLDocumentImpl document ) {
>         _document  = document;
>     }
> all other constructors do.
> The constructor is called from:
>     /**
>      *   get   the   Window
>      *   @return   the   window
>      */
>     public  DomWindow getWindow () {
>     // if there is now window yet
>       if  ( _window  == null ) {
>           // create a window for this document
>          _window  = new  DomWindow( this  );
>         setParentScope( _window  );
>       }
>       return   _window ;
>     }
> This is the only line where I could find a setProxy - which is in  
> WebResponse.getReceivedPage
>                 ((HTMLDocumentImpl)  
> _page .getRootNode()).getWindow(). setProxy ( this  );
> How should the proxy be correctly set here?
>
> Yours
>   Wolfgang
>
> BITPlan - smart solutions
> Pater-Delp-Str. 1, D-47877 Willich Schiefbahn
> Tel. +49 1805 - BITPLAN / +49 1805 248 752, Fax +49 2154 811-481
> Web: http://www.bitplan.de
> bitplan GmbH, Willich - HRB 6820 Krefeld, VAT-ID: 10258040548,  
> Geschäftsführer: Wolfgang Fahl
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace_______________________________________________
> Httpunit-develop mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/httpunit-develop

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.