Jacek Caban : mshtml: Use stored nsdoc in get_doc_string.

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


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

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

mshtml: Use stored nsdoc in get_doc_string.

---

 dlls/mshtml/persist.c |   23 +++++++----------------
 1 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c
index e673f9c..a207266 100644
--- a/dlls/mshtml/persist.c
+++ b/dlls/mshtml/persist.c
@@ -335,25 +335,17 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO
 
 static HRESULT get_doc_string(HTMLDocument *This, char **str, DWORD *len)
 {
-    nsIDOMDocument *nsdoc;
     nsIDOMNode *nsnode;
     LPCWSTR strw;
     nsAString nsstr;
     nsresult nsres;
 
-    if(!This->nscontainer) {
-        WARN("no nscontainer, returning NULL\n");
-        return S_OK;
-    }
-
-    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
-    if(NS_FAILED(nsres)) {
-        ERR("GetDocument failed: %08x\n", nsres);
-        return E_FAIL;
+    if(!This->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return E_UNEXPECTED;
     }
 
-    nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
-    nsIDOMDocument_Release(nsdoc);
+    nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
     if(NS_FAILED(nsres)) {
         ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
         return E_FAIL;
@@ -601,12 +593,11 @@ static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileNam
     }
 
     hres = get_doc_string(This, &str, &len);
-    if(FAILED(hres))
-        return hres;
+    if(SUCCEEDED(hres))
+        WriteFile(file, str, len, &written, NULL);
 
-    WriteFile(file, str, len, &written, NULL);
     CloseHandle(file);
-    return S_OK;
+    return hres;
 }
 
 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)




More information about the wine-cvs mailing list