mshtml: Use stored nsdoc in IHTMLElement::insertAdjacentText.

This commit is contained in:
Jacek Caban 2008-10-09 15:25:39 -05:00 committed by Alexandre Julliard
parent ccef2eab80
commit 4283f5ac40

View File

@ -979,25 +979,21 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
BSTR text) BSTR text)
{ {
HTMLElement *This = HTMLELEM_THIS(iface); HTMLElement *This = HTMLELEM_THIS(iface);
nsresult nsres;
nsIDOMDocument *nsdoc;
nsIDOMNode *nsnode; nsIDOMNode *nsnode;
nsAString ns_text; nsAString ns_text;
nsresult nsres;
HRESULT hr; HRESULT hr;
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text)); TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
nsres = nsIWebNavigation_GetDocument(This->node.doc->nscontainer->navigation, &nsdoc); if(!This->node.doc->nsdoc) {
if(NS_FAILED(nsres) || !nsdoc) WARN("NULL nsdoc\n");
{ return E_UNEXPECTED;
ERR("GetDocument failed: %08x\n", nsres);
return E_FAIL;
} }
nsAString_Init(&ns_text, text);
nsres = nsIDOMDocument_CreateTextNode(nsdoc, &ns_text, (nsIDOMText **)&nsnode); nsAString_Init(&ns_text, text);
nsIDOMDocument_Release(nsdoc); nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsAString_Finish(&ns_text); nsAString_Finish(&ns_text);
if(NS_FAILED(nsres) || !nsnode) if(NS_FAILED(nsres) || !nsnode)