[PATCH] HTMLDocument adjust error handling

Marcus Meissner marcus at jet.franken.de
Sat Oct 6 08:31:00 CDT 2007


Hi,

sometime we have failure cases where we
still return S_OK.

I am not sure this is a good idea.

Ciao, Marcus
---
 dlls/mshtml/htmldoc.c  |    8 ++++----
 dlls/mshtml/htmldoc3.c |   13 ++++++++++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 4faeb6e..60391e7 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -280,16 +280,16 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
     *p = NULL;
 
     if(!This->nscontainer)
-        return S_OK;
+        return E_FAIL;
 
     nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
     if(NS_FAILED(nsres)) {
         ERR("GetDocument failed: %08x\n", nsres);
-        return S_OK;
+        return E_FAIL;
     }
 
     if(NS_FAILED(nsres) || !nsdoc) 
-        return S_OK;
+        return E_FAIL;
 
     nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
     nsIDOMDocument_Release(nsdoc);
@@ -299,7 +299,7 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
 
     if(NS_FAILED(nsres) || !nsbody) {
         TRACE("Could not get body: %08x\n", nsres);
-        return S_OK;
+        return E_FAIL;
     }
 
     node = get_node(This, (nsIDOMNode*)nsbody);
diff --git a/dlls/mshtml/htmldoc3.c b/dlls/mshtml/htmldoc3.c
index 75c089d..04f2cad 100644
--- a/dlls/mshtml/htmldoc3.c
+++ b/dlls/mshtml/htmldoc3.c
@@ -124,17 +124,22 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
 
     if(!This->nscontainer) {
         *p = NULL;
-        return S_OK;
+	WARN("No nscontainer, return failure.\n");
+        return E_FAIL;
     }
 
     nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
-    if(NS_FAILED(nsres))
+    if(NS_FAILED(nsres)) {
         ERR("GetDocument failed: %08x\n", nsres);
+        return E_FAIL;
+    }
 
     if(nsdoc) {
         nsres = nsIDOMHTMLDocument_GetDocumentElement(nsdoc, &nselem);
-        if(NS_FAILED(nsres))
+        if(NS_FAILED(nsres)) {
             ERR("GetDocumentElement failed: %08x\n", nsres);
+            return E_FAIL;
+        }
     }
     if(nselem) {
         node = get_node(This, (nsIDOMNode *)nselem);
@@ -143,6 +148,8 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
         IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
     }else {
         *p = NULL;
+        FIXME("No nselem for node, but no failure detected.\n");
+        return E_FAIL;
     }
 
     return S_OK;
-- 
1.5.2.4



More information about the wine-patches mailing list