Jacek Caban : mshtml: Use stored nsdoc in IHTMLDocument2::write.

Alexandre Julliard julliard at winehq.org
Thu Oct 9 07:42:48 CDT 2008


Module: wine
Branch: master
Commit: c451ac27f2e23fc83734aac2e451a0cb753de66d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c451ac27f2e23fc83734aac2e451a0cb753de66d

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct  8 13:29:08 2008 -0500

mshtml: Use stored nsdoc in IHTMLDocument2::write.

---

 dlls/mshtml/htmldoc.c |   25 ++++++-------------------
 1 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index a3d68c6..07602d9 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -757,8 +757,6 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
 {
     HTMLDocument *This = HTMLDOC_THIS(iface);
-    nsIDOMDocument *domdoc;
-    nsIDOMHTMLDocument *nsdoc;
     nsAString nsstr;
     VARIANT *var;
     int i;
@@ -767,29 +765,19 @@ static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarr
 
     TRACE("(%p)->(%p)\n", iface, psarray);
 
+    if(!This->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
+    }
+
     if(psarray->cDims != 1) {
         FIXME("cDims=%d\n", psarray->cDims);
         return E_INVALIDARG;
     }
 
-    if(!This->nscontainer)
-        return S_OK;
-
-    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &domdoc);
-    if(NS_FAILED(nsres)) {
-        ERR("GetDocument failed: %08x\n", nsres);
-        return S_OK;
-    }
-
-    nsres = nsIDOMDocument_QueryInterface(domdoc, &IID_nsIDOMHTMLDocument, (void**)&nsdoc);
-    nsIDOMDocument_Release(domdoc);
-    if(NS_FAILED(nsres))
-        return S_OK;
-
     hres = SafeArrayAccessData(psarray, (void**)&var);
     if(FAILED(hres)) {
         WARN("SafeArrayAccessData failed: %08x\n", hres);
-        nsIDOMHTMLDocument_Release(nsdoc);
         return hres;
     }
 
@@ -798,7 +786,7 @@ static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarr
     for(i=0; i < psarray->rgsabound[0].cElements; i++) {
         if(V_VT(var+i) == VT_BSTR) {
             nsAString_SetData(&nsstr, V_BSTR(var+i));
-            nsres = nsIDOMHTMLDocument_Write(nsdoc, &nsstr);
+            nsres = nsIDOMHTMLDocument_Write(This->nsdoc, &nsstr);
             if(NS_FAILED(nsres))
                 ERR("Write failed: %08x\n", nsres);
         }else {
@@ -808,7 +796,6 @@ static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarr
 
     nsAString_Finish(&nsstr);
     SafeArrayUnaccessData(psarray);
-    nsIDOMHTMLDocument_Release(nsdoc);
 
     return S_OK;
 }




More information about the wine-cvs mailing list