Module: wine Branch: master Commit: 5629945cb7f8945a6b42dea534d164e4f5115fb6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=5629945cb7f8945a6b42dea534... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Wed Oct 8 13:29:32 2008 -0500 mshtml: Use stored nsdoc in IHTMDocument2::get_all. --- dlls/mshtml/htmldoc.c | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 9ac6f2e..57a9cfd 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -265,35 +265,29 @@ static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch * static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p) { HTMLDocument *This = HTMLDOC_THIS(iface); - nsIDOMDocument *nsdoc = NULL; nsIDOMElement *nselem = NULL; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); - if(!This->nscontainer) { - *p = NULL; - return S_OK; + if(!This->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; } - nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc); - if(NS_FAILED(nsres)) - ERR("GetDocument failed: %08x\n", nsres); - - if(nsdoc) { - nsres = nsIDOMHTMLDocument_GetDocumentElement(nsdoc, &nselem); - if(NS_FAILED(nsres)) - ERR("GetDocumentElement failed: %08x\n", nsres); + nsres = nsIDOMHTMLDocument_GetDocumentElement(This->nsdoc, &nselem); + if(NS_FAILED(nsres)) { + ERR("GetDocumentElement failed: %08x\n", nsres); + return E_FAIL; } - if(!nselem) { + if(nselem) { + *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE), TRUE); + nsIDOMElement_Release(nselem); + }else { *p = NULL; - return S_OK; } - *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE), TRUE); - - nsIDOMElement_Release(nselem); return S_OK; }