Jacek Caban : mshtml: Fail to create HTMLDocument if Gecko is not available .
Alexandre Julliard
julliard at winehq.org
Mon Oct 26 10:08:32 CDT 2009
Module: wine
Branch: master
Commit: 8a860e4c0f06f96ef71526c77ebf8db3c0d5fccb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a860e4c0f06f96ef71526c77ebf8db3c0d5fccb
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Oct 25 21:05:07 2009 +0100
mshtml: Fail to create HTMLDocument if Gecko is not available.
---
dlls/mshtml/htmldoc.c | 26 +++++++++++++++-----------
dlls/mshtml/tests/dom.c | 2 ++
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 49b0537..134b108 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -1957,6 +1957,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
{
HTMLDocumentObj *doc;
nsIDOMWindow *nswindow = NULL;
+ nsresult nsres;
HRESULT hres;
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
@@ -1972,23 +1973,26 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
doc->ref = 1;
doc->basedoc.doc_obj = doc;
+ list_init(&doc->bindings);
+ doc->usermode = UNKNOWN_USERMODE;
+ doc->readystate = READYSTATE_UNINITIALIZED;
+
+ doc->nscontainer = NSContainer_Create(doc, NULL);
+ if(!doc->nscontainer) {
+ ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
+ htmldoc_release(&doc->basedoc);
+ return CLASS_E_CLASSNOTAVAILABLE;
+ }
+
hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
htmldoc_release(&doc->basedoc);
if(FAILED(hres))
return hres;
- doc->nscontainer = NSContainer_Create(doc, NULL);
- list_init(&doc->bindings);
- doc->usermode = UNKNOWN_USERMODE;
- doc->readystate = READYSTATE_UNINITIALIZED;
-
- if(doc->nscontainer) {
- nsresult nsres;
- nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
- if(NS_FAILED(nsres))
- ERR("GetContentDOMWindow failed: %08x\n", nsres);
- }
+ nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
+ if(NS_FAILED(nsres))
+ ERR("GetContentDOMWindow failed: %08x\n", nsres);
hres = HTMLWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window);
if(nswindow)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index ba85130..d9642e1 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -438,6 +438,8 @@ static IHTMLDocument2 *create_document(void)
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IHTMLDocument2, (void**)&doc);
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
+ if(FAILED(hres))
+ return NULL;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
if(FAILED(hres)) {
More information about the wine-cvs
mailing list