mshtml: Always set the URL policy in the error cases?

Francois Gouget fgouget at
Mon Jul 16 03:37:41 CDT 2012

On Tue, 3 Jul 2012, Jacek Caban wrote:
> It would probably be more appropriate to add
> assert(SUCCEEDED(hres)); after IsClassOfCategories calls, which can't fail.

Ok. Would something like this be ok? It seems like this single assert() 
is enough to make gcc happy here.

commit 2c47407d6e11ddb66050890abd5403b302c7d6c6
Author: Francois Gouget <fgouget at>
Date:   Mon Jul 16 10:33:50 2012 +0200

    mshtml: Avoid returning with an unset URL policy in error cases.

diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c
index ff349ac..f961bca 100644
--- a/dlls/mshtml/secmgr.c
+++ b/dlls/mshtml/secmgr.c
@@ -20,6 +20,7 @@
 #include <stdarg.h>
 #include <stdio.h>
+#include <assert.h>
@@ -104,9 +105,7 @@ static HRESULT confirm_safety_load(HTMLDocumentNode *This, struct CONFIRMSAFETY
         CATID init_catid = CATID_SafeForInitializing;
         hres = ICatInformation_IsClassOfCategories(This->catmgr, &cs->clsid, 1, &init_catid, 0, NULL);
-        if(FAILED(hres))
-            return hres;
+        assert(SUCCEEDED(hres));
         *ret = hres == S_OK ? URLPOLICY_ALLOW : URLPOLICY_DISALLOW;

Francois Gouget <fgouget at>    
             Theory is where you know everything but nothing works.
            Practice is where everything works but nobody knows why.
      Sometimes they go hand in hand: nothing works and nobody knows why.

More information about the wine-devel mailing list