setProxy problem solved, openNewWindow null result handling
"Wolfgang Fahl" <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Organization | BITPlan GmbH |
| Message-ID | <[email protected]> |
Dear httpunit developers,
I found a possible answer myself. setProxy is a
sideeffect of getReceivedPage - in the following code
getWindow() gets a new document so that the sideEffect
of setProxy does not work - it has to be redone.
/**
* create a DOMScriptingHandler
* @return the dom scripting handler
*/
public ScriptingHandler createDomScriptingHandler() {
if (!isHTML()) {
return new DomWindow( this );
} else {
try {
HTMLPage page=this.getReceivedPage();
Node rootNode=page.getRootNode();
HTMLDocumentImpl document=(HTMLDocumentImpl) rootNode;
DomWindow result=document.getWindow();
result.setProxy(this);
return result;
} catch (SAXException e) {
return new DomWindow( this );
}
}
}
I also fixed the case when the openNewWindow function
returns null e.g. when the urlString contains something
like "javascript:alert('hi')"
DomWindowProxy newWindow=_proxy.openNewWindow( name, urlString );
if (newWindow==null) {
// throw new RuntimeException("DomWindow.open failed for
'"+name+"','"+urlString+"' openNewWindow returned null");
return null;
}
Now 16 errors and 26 Failures to go for the new Dom
Javascript implementation.
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