Commit 567fbd5d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Use stored nsdoc in IHTMLDocument2::get_body.

parent 5629945c
......@@ -294,43 +294,31 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
{
HTMLDocument *This = HTMLDOC_THIS(iface);
nsIDOMDocument *nsdoc;
nsIDOMHTMLDocument *nshtmldoc;
nsIDOMHTMLElement *nsbody = NULL;
HTMLDOMNode *node;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
*p = NULL;
if(!This->nscontainer)
return S_OK;
nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
if(NS_FAILED(nsres)) {
ERR("GetDocument failed: %08x\n", nsres);
return S_OK;
if(!This->nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
if(NS_FAILED(nsres) || !nsdoc)
return S_OK;
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
nsIDOMDocument_Release(nsdoc);
nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody);
nsIDOMHTMLDocument_Release(nshtmldoc);
if(NS_FAILED(nsres) || !nsbody) {
nsres = nsIDOMHTMLDocument_GetBody(This->nsdoc, &nsbody);
if(NS_FAILED(nsres)) {
TRACE("Could not get body: %08x\n", nsres);
return S_OK;
return E_UNEXPECTED;
}
if(nsbody) {
node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
nsIDOMHTMLElement_Release(nsbody);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
}else {
*p = NULL;
}
TRACE("*p = %p\n", *p);
return S_OK;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment