shdocvw: Return IHTMLDocument2's IDispatch in get_Document.
This commit is contained in:
parent
1eced6053d
commit
2c354b8bbb
|
@ -4515,6 +4515,11 @@ static void test_QueryInterface(IHTMLDocument2 *doc)
|
|||
hres = IUnknown_QueryInterface(doc, &IID_IStdMarshalInfo, (void**)&qi);
|
||||
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
|
||||
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
|
||||
|
||||
hres = IUnknown_QueryInterface(doc, &IID_IDispatch, (void**)&qi);
|
||||
ok(hres == S_OK, "Could not get IDispatch interface: %08x\n", hres);
|
||||
ok(qi != (IUnknown*)doc, "disp == doc\n");
|
||||
IUnknown_Release(qi);
|
||||
}
|
||||
|
||||
static void init_test(enum load_state_t ls) {
|
||||
|
|
|
@ -2369,6 +2369,7 @@ static void test_IServiceProvider(IUnknown *unk)
|
|||
#define get_document(u) _get_document(__LINE__,u)
|
||||
static IDispatch *_get_document(unsigned line, IUnknown *unk)
|
||||
{
|
||||
IHTMLDocument2 *html_doc;
|
||||
IWebBrowser2 *wb;
|
||||
IDispatch *disp;
|
||||
HRESULT hres;
|
||||
|
@ -2382,6 +2383,11 @@ static IDispatch *_get_document(unsigned line, IUnknown *unk)
|
|||
ok_(__FILE__,line)(hres == S_OK, "get_Document failed: %08x\n", hres);
|
||||
ok_(__FILE__,line)(disp != NULL, "doc_disp == NULL\n");
|
||||
|
||||
hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
|
||||
ok_(__FILE__,line)(hres == S_OK, "Could not get IHTMLDocument iface: %08x\n", hres);
|
||||
ok(disp == (IDispatch*)html_doc, "disp != html_doc\n");
|
||||
IHTMLDocument_Release(html_doc);
|
||||
|
||||
return disp;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "wine/debug.h"
|
||||
#include "shdocvw.h"
|
||||
#include "exdispid.h"
|
||||
#include "mshtml.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
|
||||
|
||||
|
@ -334,13 +335,28 @@ static HRESULT WINAPI WebBrowser_get_Container(IWebBrowser2 *iface, IDispatch **
|
|||
static HRESULT WINAPI WebBrowser_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
|
||||
{
|
||||
WebBrowser *This = WEBBROWSER_THIS(iface);
|
||||
IDispatch *disp = NULL;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, ppDisp);
|
||||
|
||||
*ppDisp = NULL;
|
||||
if(This->doc_host.document)
|
||||
IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)ppDisp);
|
||||
if(This->doc_host.document) {
|
||||
HRESULT hres;
|
||||
|
||||
hres = IUnknown_QueryInterface(This->doc_host.document, &IID_IDispatch, (void**)&disp);
|
||||
if(SUCCEEDED(hres)) {
|
||||
IDispatch *html_doc;
|
||||
|
||||
/* Some broken apps cast returned IDispatch to IHTMLDocument2
|
||||
* without QueryInterface call */
|
||||
hres = IDispatch_QueryInterface(disp, &IID_IHTMLDocument2, (void**)&html_doc);
|
||||
if(SUCCEEDED(hres)) {
|
||||
IDispatch_Release(disp);
|
||||
disp = html_doc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*ppDisp = disp;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue