From c14c3a6e91a7ba41c73496a619619ef5ab11afc9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 29 Sep 2009 00:11:06 +0200 Subject: [PATCH] mshtml: Added ScriptHost IServiceProvider stub implementation. --- dlls/mshtml/script.c | 42 ++++++++++++++++++++++++++++++++++++++ dlls/mshtml/tests/script.c | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index e66ba9042ce..c242242e7e6 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -47,6 +47,7 @@ struct ScriptHost { const IActiveScriptSiteInterruptPollVtbl *lpIActiveScriptSiteInterruptPollVtbl; const IActiveScriptSiteWindowVtbl *lpIActiveScriptSiteWindowVtbl; const IActiveScriptSiteDebug32Vtbl *lpIActiveScriptSiteDebug32Vtbl; + const IServiceProviderVtbl *lpServiceProviderVtbl; LONG ref; @@ -239,6 +240,9 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, }else if(IsEqualGUID(&IID_IActiveScriptSiteDebug32, riid)) { TRACE("(%p)->(IID_IActiveScriptSiteDebug32 %p)\n", This, ppv); *ppv = ACTSCPDBG32(This); + }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { + TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); + *ppv = SERVPROV(This); }else if(IsEqualGUID(&IID_ICanHandleException, riid)) { TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This, ppv); return E_NOINTERFACE; @@ -529,6 +533,43 @@ static const IActiveScriptSiteDebug32Vtbl ActiveScriptSiteDebug32Vtbl = { ActiveScriptSiteDebug32_OnScriptErrorDebug }; +#define SERVPROV_THIS(iface) DEFINE_THIS(ScriptHost, ServiceProvider, iface) + +static HRESULT WINAPI ASServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_QueryInterface(ACTSCPSITE(This), riid, ppv); +} + +static ULONG WINAPI ASServiceProvider_AddRef(IServiceProvider *iface) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_AddRef(ACTSCPSITE(This)); +} + +static ULONG WINAPI ASServiceProvider_Release(IServiceProvider *iface) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_Release(ACTSCPSITE(This)); +} + +static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + ScriptHost *This = SERVPROV_THIS(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +#undef SERVPROV_THIS + +static const IServiceProviderVtbl ASServiceProviderVtbl = { + ASServiceProvider_QueryInterface, + ASServiceProvider_AddRef, + ASServiceProvider_Release, + ASServiceProvider_QueryService +}; + static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid) { ScriptHost *ret; @@ -539,6 +580,7 @@ static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid) ret->lpIActiveScriptSiteInterruptPollVtbl = &ActiveScriptSiteInterruptPollVtbl; ret->lpIActiveScriptSiteWindowVtbl = &ActiveScriptSiteWindowVtbl; ret->lpIActiveScriptSiteDebug32Vtbl = &ActiveScriptSiteDebug32Vtbl; + ret->lpServiceProviderVtbl = &ASServiceProviderVtbl; ret->ref = 1; ret->window = window; ret->script_state = SCRIPTSTATE_UNINITIALIZED; diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index a4ef3d04475..6c6504bee63 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -1053,7 +1053,7 @@ static HRESULT WINAPI ActiveScript_SetScriptSite(IActiveScript *iface, IActiveSc ok(hres == E_NOINTERFACE, "Could not get IID_ICanHandleException interface: %08x\n", hres); hres = IActiveScriptSite_QueryInterface(pass, &IID_IServiceProvider, (void**)&service); - todo_wine ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres); + ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres); if(SUCCEEDED(hres)) IServiceProvider_Release(service);