Module: wine Branch: master Commit: 8fce028694d3b0b2ec18350ed5a975556103fae3 URL: http://source.winehq.org/git/wine.git/?a=commit;h=8fce028694d3b0b2ec18350ed5...
Author: Jacek Caban jacek@codeweavers.com Date: Tue May 31 12:20:15 2011 +0200
mshtml: Added IDispatchEx support to HTMLMimeTypesCollection object.
---
dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/omnavigator.c | 32 ++++++++++++++++++++++++-------- dlls/mshtml/tests/dom.c | 21 +++++++++++++++++++++ 3 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 6fc78ec..275bd81 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -138,6 +138,7 @@ typedef struct event_target_t event_target_t; XIID(IHTMLImgElement) \ XIID(IHTMLInputElement) \ XIID(IHTMLLocation) \ + XIID(IHTMLMimeTypesCollection) \ XIID(IHTMLObjectElement) \ XIID(IHTMLOptionElement) \ XIID(IHTMLPluginsCollection) \ diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 611f07d..92afc98 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -199,6 +199,7 @@ static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsColl }
struct HTMLMimeTypesCollection { + DispatchEx dispex; IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface;
LONG ref; @@ -221,6 +222,8 @@ static HRESULT WINAPI HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesColle }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection, riid)) { TRACE("(%p)->(IID_IHTMLMimeTypesCollection %p)\n", This, ppv); *ppv = &This->IHTMLMimeTypesCollection_iface; + }else if(dispex_query_interface(&This->dispex, riid, ppv)) { + return *ppv ? S_OK : E_NOINTERFACE; }else { *ppv = NULL; WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); @@ -251,6 +254,7 @@ static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *if if(!ref) { if(This->navigator) This->navigator->mime_types = NULL; + release_dispex(&This->dispex); heap_free(This); }
@@ -260,24 +264,22 @@ static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *if static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection *iface, UINT *pctinfo) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - FIXME("%p\n", This); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo); }
static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - FIXME("%p\n", This); - return E_NOTIMPL; + return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo); }
static HRESULT WINAPI HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - FIXME("%p\n", This); - return E_NOTIMPL; + return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames, + lcid, rgDispId); }
static HRESULT WINAPI HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection *iface, DISPID dispIdMember, @@ -285,8 +287,8 @@ static HRESULT WINAPI HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection *i EXCEPINFO *pExcepInfo, UINT *puArgErr) { HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface); - FIXME("%p\n", This); - return E_NOTIMPL; + return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); }
static HRESULT WINAPI HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection *iface, LONG *p) @@ -307,6 +309,17 @@ static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl = { HTMLMimeTypesCollection_get_length };
+static const tid_t HTMLMimeTypesCollection_iface_tids[] = { + IHTMLMimeTypesCollection_tid, + 0 +}; +static dispex_static_data_t HTMLMimeTypesCollection_dispex = { + NULL, + IHTMLMimeTypesCollection_tid, + NULL, + HTMLMimeTypesCollection_iface_tids +}; + static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeTypesCollection **ret) { HTMLMimeTypesCollection *col; @@ -319,6 +332,9 @@ static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeType col->ref = 1; col->navigator = navigator;
+ init_dispex(&col->dispex, (IUnknown*)&col->IHTMLMimeTypesCollection_iface, + &HTMLMimeTypesCollection_dispex); + *ret = col; return S_OK; } diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 03eb48a..9712605 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -3827,6 +3827,26 @@ static void test_plugins_col(IOmNavigator *nav) ok(!ref, "ref=%d\n", ref); }
+static void test_mime_types_col(IOmNavigator *nav) +{ + IHTMLMimeTypesCollection *col, *col2; + ULONG ref; + HRESULT hres; + + hres = IOmNavigator_get_mimeTypes(nav, &col); + ok(hres == S_OK, "get_mimeTypes failed: %08x\n", hres); + + hres = IOmNavigator_get_mimeTypes(nav, &col2); + ok(hres == S_OK, "get_mimeTypes failed: %08x\n", hres); + ok(iface_cmp((IUnknown*)col, (IUnknown*)col2), "col != col2\n"); + IHTMLMimeTypesCollection_Release(col2); + + test_disp((IUnknown*)col, &IID_IHTMLMimeTypesCollection, "[object]"); + + ref = IHTMLMimeTypesCollection_Release(col); + ok(!ref, "ref=%d\n", ref); +} + static void test_navigator(IHTMLDocument2 *doc) { IHTMLWindow2 *window; @@ -3914,6 +3934,7 @@ static void test_navigator(IHTMLDocument2 *doc) }
test_plugins_col(navigator); + test_mime_types_col(navigator);
ref = IOmNavigator_Release(navigator); ok(!ref, "navigator should be destroyed here\n");