dinput: Delete the action mapping registry key on SetActionMap.
[wine.git] / dlls / mshtml / omnavigator.c
blob298d99f86ebd941a85dbb544af6b39bafbfe8213
1 /*
2 * Copyright 2008,2009 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct HTMLPluginsCollection HTMLPluginsCollection;
35 typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection;
37 typedef struct {
38 DispatchEx dispex;
39 IOmNavigator IOmNavigator_iface;
41 LONG ref;
43 HTMLPluginsCollection *plugins;
44 HTMLMimeTypesCollection *mime_types;
45 } OmNavigator;
47 typedef struct {
48 DispatchEx dispex;
49 IHTMLDOMImplementation IHTMLDOMImplementation_iface;
50 IHTMLDOMImplementation2 IHTMLDOMImplementation2_iface;
52 LONG ref;
54 nsIDOMDOMImplementation *implementation;
55 GeckoBrowser *browser;
56 } HTMLDOMImplementation;
58 static inline HTMLDOMImplementation *impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation *iface)
60 return CONTAINING_RECORD(iface, HTMLDOMImplementation, IHTMLDOMImplementation_iface);
63 static HRESULT WINAPI HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementation *iface, REFIID riid, void **ppv)
65 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
67 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
69 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IHTMLDOMImplementation, riid)) {
70 *ppv = &This->IHTMLDOMImplementation_iface;
71 }else if(IsEqualGUID(&IID_IHTMLDOMImplementation2, riid)) {
72 *ppv = &This->IHTMLDOMImplementation2_iface;
73 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
74 return *ppv ? S_OK : E_NOINTERFACE;
75 }else {
76 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
77 *ppv = NULL;
78 return E_NOINTERFACE;
81 IUnknown_AddRef((IUnknown*)*ppv);
82 return S_OK;
85 static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface)
87 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
88 LONG ref = InterlockedIncrement(&This->ref);
90 TRACE("(%p) ref=%ld\n", This, ref);
92 return ref;
95 static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface)
97 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
98 LONG ref = InterlockedDecrement(&This->ref);
100 TRACE("(%p) ref=%ld\n", This, ref);
102 if(!ref) {
103 assert(!This->browser);
104 if(This->implementation)
105 nsIDOMDOMImplementation_Release(This->implementation);
106 release_dispex(&This->dispex);
107 free(This);
110 return ref;
113 static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfoCount(IHTMLDOMImplementation *iface, UINT *pctinfo)
115 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
117 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
120 static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfo(IHTMLDOMImplementation *iface, UINT iTInfo,
121 LCID lcid, ITypeInfo **ppTInfo)
123 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
125 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
128 static HRESULT WINAPI HTMLDOMImplementation_GetIDsOfNames(IHTMLDOMImplementation *iface, REFIID riid,
129 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
131 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
133 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
134 cNames, lcid, rgDispId);
137 static HRESULT WINAPI HTMLDOMImplementation_Invoke(IHTMLDOMImplementation *iface, DISPID dispIdMember,
138 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
139 EXCEPINFO *pExcepInfo, UINT *puArgErr)
141 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
143 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid,
144 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
147 static HRESULT WINAPI HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation *iface, BSTR feature,
148 VARIANT version, VARIANT_BOOL *pfHasFeature)
150 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
152 FIXME("(%p)->(%s %s %p) returning false\n", This, debugstr_w(feature), debugstr_variant(&version), pfHasFeature);
154 *pfHasFeature = VARIANT_FALSE;
155 return S_OK;
158 static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl = {
159 HTMLDOMImplementation_QueryInterface,
160 HTMLDOMImplementation_AddRef,
161 HTMLDOMImplementation_Release,
162 HTMLDOMImplementation_GetTypeInfoCount,
163 HTMLDOMImplementation_GetTypeInfo,
164 HTMLDOMImplementation_GetIDsOfNames,
165 HTMLDOMImplementation_Invoke,
166 HTMLDOMImplementation_hasFeature
169 static inline HTMLDOMImplementation *impl_from_IHTMLDOMImplementation2(IHTMLDOMImplementation2 *iface)
171 return CONTAINING_RECORD(iface, HTMLDOMImplementation, IHTMLDOMImplementation2_iface);
174 static HRESULT WINAPI HTMLDOMImplementation2_QueryInterface(IHTMLDOMImplementation2 *iface, REFIID riid, void **ppv)
176 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
177 return IHTMLDOMImplementation_QueryInterface(&This->IHTMLDOMImplementation_iface, riid, ppv);
180 static ULONG WINAPI HTMLDOMImplementation2_AddRef(IHTMLDOMImplementation2 *iface)
182 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
183 return IHTMLDOMImplementation_AddRef(&This->IHTMLDOMImplementation_iface);
186 static ULONG WINAPI HTMLDOMImplementation2_Release(IHTMLDOMImplementation2 *iface)
188 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
189 return IHTMLDOMImplementation_Release(&This->IHTMLDOMImplementation_iface);
192 static HRESULT WINAPI HTMLDOMImplementation2_GetTypeInfoCount(IHTMLDOMImplementation2 *iface, UINT *pctinfo)
194 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
195 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
198 static HRESULT WINAPI HTMLDOMImplementation2_GetTypeInfo(IHTMLDOMImplementation2 *iface, UINT iTInfo,
199 LCID lcid, ITypeInfo **ppTInfo)
201 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
202 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
205 static HRESULT WINAPI HTMLDOMImplementation2_GetIDsOfNames(IHTMLDOMImplementation2 *iface, REFIID riid,
206 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
208 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
209 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
210 cNames, lcid, rgDispId);
213 static HRESULT WINAPI HTMLDOMImplementation2_Invoke(IHTMLDOMImplementation2 *iface, DISPID dispIdMember,
214 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
215 EXCEPINFO *pExcepInfo, UINT *puArgErr)
217 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
218 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid,
219 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
222 static HRESULT WINAPI HTMLDOMImplementation2_createDocumentType(IHTMLDOMImplementation2 *iface, BSTR name,
223 VARIANT *public_id, VARIANT *system_id, IDOMDocumentType **new_type)
225 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
226 FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_w(name), debugstr_variant(public_id),
227 debugstr_variant(system_id), new_type);
228 return E_NOTIMPL;
231 static HRESULT WINAPI HTMLDOMImplementation2_createDocument(IHTMLDOMImplementation2 *iface, VARIANT *ns,
232 VARIANT *tag_name, IDOMDocumentType *document_type, IHTMLDocument7 **new_document)
234 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
235 FIXME("(%p)->(%s %s %p %p)\n", This, debugstr_variant(ns), debugstr_variant(tag_name),
236 document_type, new_document);
237 return E_NOTIMPL;
240 static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplementation2 *iface, BSTR title,
241 IHTMLDocument7 **new_document)
243 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
244 HTMLDocumentNode *new_document_node;
245 nsIDOMDocument *doc;
246 nsAString title_str;
247 nsresult nsres;
248 HRESULT hres;
250 FIXME("(%p)->(%s %p)\n", This, debugstr_w(title), new_document);
252 if(!This->browser)
253 return E_UNEXPECTED;
255 nsAString_InitDepend(&title_str, title);
256 nsres = nsIDOMDOMImplementation_CreateHTMLDocument(This->implementation, &title_str, &doc);
257 nsAString_Finish(&title_str);
258 if(NS_FAILED(nsres)) {
259 ERR("CreateHTMLDocument failed: %08lx\n", nsres);
260 return E_FAIL;
263 hres = create_document_node(doc, This->browser, NULL, dispex_compat_mode(&This->dispex), &new_document_node);
264 nsIDOMDocument_Release(doc);
265 if(FAILED(hres))
266 return hres;
268 *new_document = &new_document_node->IHTMLDocument7_iface;
269 return S_OK;
272 static HRESULT WINAPI HTMLDOMImplementation2_hasFeature(IHTMLDOMImplementation2 *iface, BSTR feature,
273 VARIANT version, VARIANT_BOOL *pfHasFeature)
275 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
277 FIXME("(%p)->(%s %s %p) returning false\n", This, debugstr_w(feature), debugstr_variant(&version), pfHasFeature);
279 *pfHasFeature = VARIANT_FALSE;
280 return S_OK;
283 static const IHTMLDOMImplementation2Vtbl HTMLDOMImplementation2Vtbl = {
284 HTMLDOMImplementation2_QueryInterface,
285 HTMLDOMImplementation2_AddRef,
286 HTMLDOMImplementation2_Release,
287 HTMLDOMImplementation2_GetTypeInfoCount,
288 HTMLDOMImplementation2_GetTypeInfo,
289 HTMLDOMImplementation2_GetIDsOfNames,
290 HTMLDOMImplementation2_Invoke,
291 HTMLDOMImplementation2_createDocumentType,
292 HTMLDOMImplementation2_createDocument,
293 HTMLDOMImplementation2_createHTMLDocument,
294 HTMLDOMImplementation2_hasFeature
297 static void HTMLDOMImplementation_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
299 if(compat_mode >= COMPAT_MODE_IE9)
300 dispex_info_add_interface(info, IHTMLDOMImplementation2_tid, NULL);
303 static const tid_t HTMLDOMImplementation_iface_tids[] = {
304 IHTMLDOMImplementation_tid,
307 static dispex_static_data_t HTMLDOMImplementation_dispex = {
308 L"DOMImplementation",
309 NULL,
310 DispHTMLDOMImplementation_tid,
311 HTMLDOMImplementation_iface_tids,
312 HTMLDOMImplementation_init_dispex_info
315 HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementation **ret)
317 HTMLDOMImplementation *dom_implementation;
318 nsresult nsres;
320 if(!doc_node->browser)
321 return E_UNEXPECTED;
323 dom_implementation = calloc(1, sizeof(*dom_implementation));
324 if(!dom_implementation)
325 return E_OUTOFMEMORY;
327 dom_implementation->IHTMLDOMImplementation_iface.lpVtbl = &HTMLDOMImplementationVtbl;
328 dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl;
329 dom_implementation->ref = 1;
330 dom_implementation->browser = doc_node->browser;
332 init_dispatch(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface,
333 &HTMLDOMImplementation_dispex, doc_node->document_mode);
335 nsres = nsIDOMDocument_GetImplementation(doc_node->dom_document, &dom_implementation->implementation);
336 if(NS_FAILED(nsres)) {
337 ERR("GetDOMImplementation failed: %08lx\n", nsres);
338 IHTMLDOMImplementation_Release(&dom_implementation->IHTMLDOMImplementation_iface);
339 return E_FAIL;
342 *ret = &dom_implementation->IHTMLDOMImplementation_iface;
343 return S_OK;
346 void detach_dom_implementation(IHTMLDOMImplementation *iface)
348 HTMLDOMImplementation *dom_implementation = impl_from_IHTMLDOMImplementation(iface);
349 dom_implementation->browser = NULL;
352 typedef struct {
353 DispatchEx dispex;
354 IHTMLScreen IHTMLScreen_iface;
356 LONG ref;
357 } HTMLScreen;
359 static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface)
361 return CONTAINING_RECORD(iface, HTMLScreen, IHTMLScreen_iface);
364 static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
366 HTMLScreen *This = impl_from_IHTMLScreen(iface);
368 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
370 if(IsEqualGUID(&IID_IUnknown, riid)) {
371 *ppv = &This->IHTMLScreen_iface;
372 }else if(IsEqualGUID(&IID_IHTMLScreen, riid)) {
373 *ppv = &This->IHTMLScreen_iface;
374 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
375 return *ppv ? S_OK : E_NOINTERFACE;
376 }else {
377 *ppv = NULL;
378 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
379 return E_NOINTERFACE;
382 IUnknown_AddRef((IUnknown*)*ppv);
383 return S_OK;
386 static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
388 HTMLScreen *This = impl_from_IHTMLScreen(iface);
389 LONG ref = InterlockedIncrement(&This->ref);
391 TRACE("(%p) ref=%ld\n", This, ref);
393 return ref;
396 static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
398 HTMLScreen *This = impl_from_IHTMLScreen(iface);
399 LONG ref = InterlockedDecrement(&This->ref);
401 TRACE("(%p) ref=%ld\n", This, ref);
403 if(!ref) {
404 release_dispex(&This->dispex);
405 free(This);
408 return ref;
411 static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
413 HTMLScreen *This = impl_from_IHTMLScreen(iface);
414 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
417 static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo,
418 LCID lcid, ITypeInfo **ppTInfo)
420 HTMLScreen *This = impl_from_IHTMLScreen(iface);
421 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
424 static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid,
425 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
427 HTMLScreen *This = impl_from_IHTMLScreen(iface);
428 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
429 lcid, rgDispId);
432 static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember,
433 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
434 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
436 HTMLScreen *This = impl_from_IHTMLScreen(iface);
437 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
438 pDispParams, pVarResult, pExcepInfo, puArgErr);
441 static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
443 HTMLScreen *This = impl_from_IHTMLScreen(iface);
444 HDC hdc = GetDC(0);
446 TRACE("(%p)->(%p)\n", This, p);
448 *p = GetDeviceCaps(hdc, BITSPIXEL);
449 ReleaseDC(0, hdc);
450 return S_OK;
453 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
455 HTMLScreen *This = impl_from_IHTMLScreen(iface);
456 FIXME("(%p)->(%ld)\n", This, v);
457 return E_NOTIMPL;
460 static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
462 HTMLScreen *This = impl_from_IHTMLScreen(iface);
463 FIXME("(%p)->(%p)\n", This, p);
464 return E_NOTIMPL;
467 static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
469 HTMLScreen *This = impl_from_IHTMLScreen(iface);
471 TRACE("(%p)->(%p)\n", This, p);
473 *p = GetSystemMetrics(SM_CXSCREEN);
474 return S_OK;
477 static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
479 HTMLScreen *This = impl_from_IHTMLScreen(iface);
481 TRACE("(%p)->(%p)\n", This, p);
483 *p = GetSystemMetrics(SM_CYSCREEN);
484 return S_OK;
487 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
489 HTMLScreen *This = impl_from_IHTMLScreen(iface);
490 FIXME("(%p)->(%ld)\n", This, v);
491 return E_NOTIMPL;
494 static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
496 HTMLScreen *This = impl_from_IHTMLScreen(iface);
497 FIXME("(%p)->(%p)\n", This, p);
498 return E_NOTIMPL;
501 static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
503 HTMLScreen *This = impl_from_IHTMLScreen(iface);
504 RECT work_area;
506 TRACE("(%p)->(%p)\n", This, p);
508 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
509 return E_FAIL;
511 *p = work_area.bottom-work_area.top;
512 return S_OK;
515 static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
517 HTMLScreen *This = impl_from_IHTMLScreen(iface);
518 RECT work_area;
520 TRACE("(%p)->(%p)\n", This, p);
522 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
523 return E_FAIL;
525 *p = work_area.right-work_area.left;
526 return S_OK;
529 static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
531 HTMLScreen *This = impl_from_IHTMLScreen(iface);
532 FIXME("(%p)->(%p)\n", This, p);
533 return E_NOTIMPL;
536 static const IHTMLScreenVtbl HTMLSreenVtbl = {
537 HTMLScreen_QueryInterface,
538 HTMLScreen_AddRef,
539 HTMLScreen_Release,
540 HTMLScreen_GetTypeInfoCount,
541 HTMLScreen_GetTypeInfo,
542 HTMLScreen_GetIDsOfNames,
543 HTMLScreen_Invoke,
544 HTMLScreen_get_colorDepth,
545 HTMLScreen_put_bufferDepth,
546 HTMLScreen_get_bufferDepth,
547 HTMLScreen_get_width,
548 HTMLScreen_get_height,
549 HTMLScreen_put_updateInterval,
550 HTMLScreen_get_updateInterval,
551 HTMLScreen_get_availHeight,
552 HTMLScreen_get_availWidth,
553 HTMLScreen_get_fontSmoothingEnabled
556 static const tid_t HTMLScreen_iface_tids[] = {
557 IHTMLScreen_tid,
560 static dispex_static_data_t HTMLScreen_dispex = {
561 L"Screen",
562 NULL,
563 DispHTMLScreen_tid,
564 HTMLScreen_iface_tids
567 HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret)
569 HTMLScreen *screen;
571 screen = calloc(1, sizeof(HTMLScreen));
572 if(!screen)
573 return E_OUTOFMEMORY;
575 screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
576 screen->ref = 1;
578 init_dispatch(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex, compat_mode);
580 *ret = &screen->IHTMLScreen_iface;
581 return S_OK;
584 static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface)
586 return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface);
589 static HRESULT WINAPI OmHistory_QueryInterface(IOmHistory *iface, REFIID riid, void **ppv)
591 OmHistory *This = impl_from_IOmHistory(iface);
593 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
595 if(IsEqualGUID(&IID_IUnknown, riid)) {
596 *ppv = &This->IOmHistory_iface;
597 }else if(IsEqualGUID(&IID_IOmHistory, riid)) {
598 *ppv = &This->IOmHistory_iface;
599 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
600 return *ppv ? S_OK : E_NOINTERFACE;
601 }else {
602 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
603 *ppv = NULL;
604 return E_NOINTERFACE;
607 IUnknown_AddRef((IUnknown*)*ppv);
608 return S_OK;
611 static ULONG WINAPI OmHistory_AddRef(IOmHistory *iface)
613 OmHistory *This = impl_from_IOmHistory(iface);
614 LONG ref = InterlockedIncrement(&This->ref);
616 TRACE("(%p) ref=%ld\n", This, ref);
618 return ref;
621 static ULONG WINAPI OmHistory_Release(IOmHistory *iface)
623 OmHistory *This = impl_from_IOmHistory(iface);
624 LONG ref = InterlockedDecrement(&This->ref);
626 TRACE("(%p) ref=%ld\n", This, ref);
628 if(!ref) {
629 release_dispex(&This->dispex);
630 free(This);
633 return ref;
636 static HRESULT WINAPI OmHistory_GetTypeInfoCount(IOmHistory *iface, UINT *pctinfo)
638 OmHistory *This = impl_from_IOmHistory(iface);
639 FIXME("(%p)->(%p)\n", This, pctinfo);
640 return E_NOTIMPL;
643 static HRESULT WINAPI OmHistory_GetTypeInfo(IOmHistory *iface, UINT iTInfo,
644 LCID lcid, ITypeInfo **ppTInfo)
646 OmHistory *This = impl_from_IOmHistory(iface);
648 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
651 static HRESULT WINAPI OmHistory_GetIDsOfNames(IOmHistory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
652 LCID lcid, DISPID *rgDispId)
654 OmHistory *This = impl_from_IOmHistory(iface);
656 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
657 lcid, rgDispId);
660 static HRESULT WINAPI OmHistory_Invoke(IOmHistory *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
661 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
663 OmHistory *This = impl_from_IOmHistory(iface);
665 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
666 pDispParams, pVarResult, pExcepInfo, puArgErr);
669 static HRESULT WINAPI OmHistory_get_length(IOmHistory *iface, short *p)
671 OmHistory *This = impl_from_IOmHistory(iface);
672 GeckoBrowser *browser = NULL;
674 TRACE("(%p)->(%p)\n", This, p);
676 if(This->window && This->window->base.outer_window)
677 browser = This->window->base.outer_window->browser;
679 *p = browser && browser->doc->travel_log
680 ? ITravelLog_CountEntries(browser->doc->travel_log, browser->doc->browser_service)
681 : 0;
682 return S_OK;
685 static HRESULT WINAPI OmHistory_back(IOmHistory *iface, VARIANT *pvargdistance)
687 OmHistory *This = impl_from_IOmHistory(iface);
688 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
689 return E_NOTIMPL;
692 static HRESULT WINAPI OmHistory_forward(IOmHistory *iface, VARIANT *pvargdistance)
694 OmHistory *This = impl_from_IOmHistory(iface);
695 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
696 return E_NOTIMPL;
699 static HRESULT WINAPI OmHistory_go(IOmHistory *iface, VARIANT *pvargdistance)
701 OmHistory *This = impl_from_IOmHistory(iface);
702 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
703 return E_NOTIMPL;
706 static const IOmHistoryVtbl OmHistoryVtbl = {
707 OmHistory_QueryInterface,
708 OmHistory_AddRef,
709 OmHistory_Release,
710 OmHistory_GetTypeInfoCount,
711 OmHistory_GetTypeInfo,
712 OmHistory_GetIDsOfNames,
713 OmHistory_Invoke,
714 OmHistory_get_length,
715 OmHistory_back,
716 OmHistory_forward,
717 OmHistory_go
720 static const tid_t OmHistory_iface_tids[] = {
721 IOmHistory_tid,
724 static dispex_static_data_t OmHistory_dispex = {
725 L"History",
726 NULL,
727 DispHTMLHistory_tid,
728 OmHistory_iface_tids
732 HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret)
734 OmHistory *history;
736 history = calloc(1, sizeof(*history));
737 if(!history)
738 return E_OUTOFMEMORY;
740 init_dispatch(&history->dispex, (IUnknown*)&history->IOmHistory_iface, &OmHistory_dispex,
741 dispex_compat_mode(&window->event_target.dispex));
742 history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl;
743 history->ref = 1;
745 history->window = window;
747 *ret = history;
748 return S_OK;
751 struct HTMLPluginsCollection {
752 DispatchEx dispex;
753 IHTMLPluginsCollection IHTMLPluginsCollection_iface;
755 LONG ref;
757 OmNavigator *navigator;
760 static inline HTMLPluginsCollection *impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection *iface)
762 return CONTAINING_RECORD(iface, HTMLPluginsCollection, IHTMLPluginsCollection_iface);
765 static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection *iface, REFIID riid, void **ppv)
767 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
769 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
771 if(IsEqualGUID(&IID_IUnknown, riid)) {
772 *ppv = &This->IHTMLPluginsCollection_iface;
773 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection, riid)) {
774 *ppv = &This->IHTMLPluginsCollection_iface;
775 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
776 return *ppv ? S_OK : E_NOINTERFACE;
777 }else {
778 *ppv = NULL;
779 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
780 return E_NOINTERFACE;
783 IUnknown_AddRef((IUnknown*)*ppv);
784 return S_OK;
787 static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface)
789 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
790 LONG ref = InterlockedIncrement(&This->ref);
792 TRACE("(%p) ref=%ld\n", This, ref);
794 return ref;
797 static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface)
799 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
800 LONG ref = InterlockedDecrement(&This->ref);
802 TRACE("(%p) ref=%ld\n", This, ref);
804 if(!ref) {
805 if(This->navigator)
806 This->navigator->plugins = NULL;
807 release_dispex(&This->dispex);
808 free(This);
811 return ref;
814 static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection *iface, UINT *pctinfo)
816 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
817 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
820 static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection *iface, UINT iTInfo,
821 LCID lcid, ITypeInfo **ppTInfo)
823 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
824 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
827 static HRESULT WINAPI HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection *iface, REFIID riid,
828 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
830 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
831 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
832 lcid, rgDispId);
835 static HRESULT WINAPI HTMLPluginsCollection_Invoke(IHTMLPluginsCollection *iface, DISPID dispIdMember,
836 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
837 EXCEPINFO *pExcepInfo, UINT *puArgErr)
839 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
840 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
841 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
844 static HRESULT WINAPI HTMLPluginsCollection_get_length(IHTMLPluginsCollection *iface, LONG *p)
846 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
848 TRACE("(%p)->(%p)\n", This, p);
850 /* IE always returns 0 here */
851 *p = 0;
852 return S_OK;
855 static HRESULT WINAPI HTMLPluginsCollection_refresh(IHTMLPluginsCollection *iface, VARIANT_BOOL reload)
857 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
859 TRACE("(%p)->(%x)\n", This, reload);
861 /* Nothing to do here. */
862 return S_OK;
865 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl = {
866 HTMLPluginsCollection_QueryInterface,
867 HTMLPluginsCollection_AddRef,
868 HTMLPluginsCollection_Release,
869 HTMLPluginsCollection_GetTypeInfoCount,
870 HTMLPluginsCollection_GetTypeInfo,
871 HTMLPluginsCollection_GetIDsOfNames,
872 HTMLPluginsCollection_Invoke,
873 HTMLPluginsCollection_get_length,
874 HTMLPluginsCollection_refresh
877 static const tid_t HTMLPluginsCollection_iface_tids[] = {
878 IHTMLPluginsCollection_tid,
881 static dispex_static_data_t HTMLPluginsCollection_dispex = {
882 L"PluginArray",
883 NULL,
884 DispCPlugins_tid,
885 HTMLPluginsCollection_iface_tids
888 static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsCollection **ret)
890 HTMLPluginsCollection *col;
892 col = calloc(1, sizeof(*col));
893 if(!col)
894 return E_OUTOFMEMORY;
896 col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl;
897 col->ref = 1;
898 col->navigator = navigator;
900 init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLPluginsCollection_iface,
901 &HTMLPluginsCollection_dispex, dispex_compat_mode(&navigator->dispex));
903 *ret = col;
904 return S_OK;
907 struct HTMLMimeTypesCollection {
908 DispatchEx dispex;
909 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface;
911 LONG ref;
913 OmNavigator *navigator;
916 static inline HTMLMimeTypesCollection *impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection *iface)
918 return CONTAINING_RECORD(iface, HTMLMimeTypesCollection, IHTMLMimeTypesCollection_iface);
921 static HRESULT WINAPI HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection *iface, REFIID riid, void **ppv)
923 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
925 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
927 if(IsEqualGUID(&IID_IUnknown, riid)) {
928 *ppv = &This->IHTMLMimeTypesCollection_iface;
929 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection, riid)) {
930 *ppv = &This->IHTMLMimeTypesCollection_iface;
931 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
932 return *ppv ? S_OK : E_NOINTERFACE;
933 }else {
934 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
935 *ppv = NULL;
936 return E_NOINTERFACE;
939 IUnknown_AddRef((IUnknown*)*ppv);
940 return S_OK;
943 static ULONG WINAPI HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection *iface)
945 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
946 LONG ref = InterlockedIncrement(&This->ref);
948 TRACE("(%p) ref=%ld\n", This, ref);
950 return ref;
953 static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *iface)
955 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
956 LONG ref = InterlockedDecrement(&This->ref);
958 TRACE("(%p) ref=%ld\n", This, ref);
960 if(!ref) {
961 if(This->navigator)
962 This->navigator->mime_types = NULL;
963 release_dispex(&This->dispex);
964 free(This);
967 return ref;
970 static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection *iface, UINT *pctinfo)
972 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
973 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
976 static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection *iface, UINT iTInfo,
977 LCID lcid, ITypeInfo **ppTInfo)
979 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
980 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
983 static HRESULT WINAPI HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection *iface, REFIID riid,
984 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
986 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
987 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
988 lcid, rgDispId);
991 static HRESULT WINAPI HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection *iface, DISPID dispIdMember,
992 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
993 EXCEPINFO *pExcepInfo, UINT *puArgErr)
995 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
996 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
997 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1000 static HRESULT WINAPI HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection *iface, LONG *p)
1002 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
1004 TRACE("(%p)->(%p)\n", This, p);
1006 /* This is just a stub for compatibility with other browser in IE */
1007 *p = 0;
1008 return S_OK;
1011 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl = {
1012 HTMLMimeTypesCollection_QueryInterface,
1013 HTMLMimeTypesCollection_AddRef,
1014 HTMLMimeTypesCollection_Release,
1015 HTMLMimeTypesCollection_GetTypeInfoCount,
1016 HTMLMimeTypesCollection_GetTypeInfo,
1017 HTMLMimeTypesCollection_GetIDsOfNames,
1018 HTMLMimeTypesCollection_Invoke,
1019 HTMLMimeTypesCollection_get_length
1022 static const tid_t HTMLMimeTypesCollection_iface_tids[] = {
1023 IHTMLMimeTypesCollection_tid,
1026 static dispex_static_data_t HTMLMimeTypesCollection_dispex = {
1027 L"MimeTypeArray",
1028 NULL,
1029 IHTMLMimeTypesCollection_tid,
1030 HTMLMimeTypesCollection_iface_tids
1033 static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeTypesCollection **ret)
1035 HTMLMimeTypesCollection *col;
1037 col = calloc(1, sizeof(*col));
1038 if(!col)
1039 return E_OUTOFMEMORY;
1041 col->IHTMLMimeTypesCollection_iface.lpVtbl = &HTMLMimeTypesCollectionVtbl;
1042 col->ref = 1;
1043 col->navigator = navigator;
1045 init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLMimeTypesCollection_iface,
1046 &HTMLMimeTypesCollection_dispex, dispex_compat_mode(&navigator->dispex));
1048 *ret = col;
1049 return S_OK;
1052 static inline OmNavigator *impl_from_IOmNavigator(IOmNavigator *iface)
1054 return CONTAINING_RECORD(iface, OmNavigator, IOmNavigator_iface);
1057 static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID riid, void **ppv)
1059 OmNavigator *This = impl_from_IOmNavigator(iface);
1061 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1063 if(IsEqualGUID(&IID_IUnknown, riid)) {
1064 *ppv = &This->IOmNavigator_iface;
1065 }else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
1066 *ppv = &This->IOmNavigator_iface;
1067 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1068 return *ppv ? S_OK : E_NOINTERFACE;
1069 }else {
1070 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1071 *ppv = NULL;
1072 return E_NOINTERFACE;
1075 IUnknown_AddRef((IUnknown*)*ppv);
1076 return S_OK;
1079 static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface)
1081 OmNavigator *This = impl_from_IOmNavigator(iface);
1082 LONG ref = InterlockedIncrement(&This->ref);
1084 TRACE("(%p) ref=%ld\n", This, ref);
1086 return ref;
1089 static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
1091 OmNavigator *This = impl_from_IOmNavigator(iface);
1092 LONG ref = InterlockedDecrement(&This->ref);
1094 TRACE("(%p) ref=%ld\n", This, ref);
1096 if(!ref) {
1097 if(This->plugins)
1098 This->plugins->navigator = NULL;
1099 if(This->mime_types)
1100 This->mime_types->navigator = NULL;
1101 release_dispex(&This->dispex);
1102 free(This);
1105 return ref;
1108 static HRESULT WINAPI OmNavigator_GetTypeInfoCount(IOmNavigator *iface, UINT *pctinfo)
1110 OmNavigator *This = impl_from_IOmNavigator(iface);
1111 FIXME("(%p)->(%p)\n", This, pctinfo);
1112 return E_NOTIMPL;
1115 static HRESULT WINAPI OmNavigator_GetTypeInfo(IOmNavigator *iface, UINT iTInfo,
1116 LCID lcid, ITypeInfo **ppTInfo)
1118 OmNavigator *This = impl_from_IOmNavigator(iface);
1120 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1123 static HRESULT WINAPI OmNavigator_GetIDsOfNames(IOmNavigator *iface, REFIID riid,
1124 LPOLESTR *rgszNames, UINT cNames,
1125 LCID lcid, DISPID *rgDispId)
1127 OmNavigator *This = impl_from_IOmNavigator(iface);
1129 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1130 lcid, rgDispId);
1133 static HRESULT WINAPI OmNavigator_Invoke(IOmNavigator *iface, DISPID dispIdMember,
1134 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1135 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1137 OmNavigator *This = impl_from_IOmNavigator(iface);
1139 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1140 pDispParams, pVarResult, pExcepInfo, puArgErr);
1143 static HRESULT WINAPI OmNavigator_get_appCodeName(IOmNavigator *iface, BSTR *p)
1145 OmNavigator *This = impl_from_IOmNavigator(iface);
1147 TRACE("(%p)->(%p)\n", This, p);
1149 *p = SysAllocString(L"Mozilla");
1150 return S_OK;
1153 static HRESULT WINAPI OmNavigator_get_appName(IOmNavigator *iface, BSTR *p)
1155 OmNavigator *This = impl_from_IOmNavigator(iface);
1157 TRACE("(%p)->(%p)\n", This, p);
1159 *p = SysAllocString(dispex_compat_mode(&This->dispex) == COMPAT_MODE_IE11
1160 ? L"Netscape" : L"Microsoft Internet Explorer");
1161 if(!*p)
1162 return E_OUTOFMEMORY;
1164 return S_OK;
1167 /* undocumented, added in IE8 */
1168 extern HRESULT WINAPI MapBrowserEmulationModeToUserAgent(const void*,WCHAR**);
1170 /* Retrieves allocated user agent via CoTaskMemAlloc */
1171 static HRESULT get_user_agent(OmNavigator *navigator, WCHAR **user_agent)
1173 DWORD version = get_compat_mode_version(dispex_compat_mode(&navigator->dispex));
1175 return MapBrowserEmulationModeToUserAgent(&version, user_agent);
1178 static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
1180 OmNavigator *This = impl_from_IOmNavigator(iface);
1181 WCHAR *user_agent;
1182 unsigned len;
1183 HRESULT hres;
1184 const unsigned skip_prefix = 8; /* strlen("Mozilla/") */
1186 TRACE("(%p)->(%p)\n", This, p);
1188 hres = get_user_agent(This, &user_agent);
1189 if(FAILED(hres))
1190 return hres;
1191 len = wcslen(user_agent);
1193 if(len < skip_prefix) {
1194 CoTaskMemFree(user_agent);
1195 *p = NULL;
1196 return S_OK;
1199 *p = SysAllocStringLen(user_agent + skip_prefix, len - skip_prefix);
1200 CoTaskMemFree(user_agent);
1201 return *p ? S_OK : E_OUTOFMEMORY;
1204 static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
1206 OmNavigator *This = impl_from_IOmNavigator(iface);
1207 WCHAR *user_agent;
1208 HRESULT hres;
1210 TRACE("(%p)->(%p)\n", This, p);
1212 hres = get_user_agent(This, &user_agent);
1213 if(FAILED(hres))
1214 return hres;
1216 *p = SysAllocString(user_agent);
1217 CoTaskMemFree(user_agent);
1218 return *p ? S_OK : E_OUTOFMEMORY;
1221 static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
1223 OmNavigator *This = impl_from_IOmNavigator(iface);
1225 FIXME("(%p)->(%p) semi-stub\n", This, enabled);
1227 *enabled = VARIANT_TRUE;
1228 return S_OK;
1231 static HRESULT WINAPI OmNavigator_taintEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
1233 OmNavigator *This = impl_from_IOmNavigator(iface);
1234 FIXME("(%p)->(%p)\n", This, enabled);
1235 return E_NOTIMPL;
1238 static HRESULT WINAPI OmNavigator_get_mimeTypes(IOmNavigator *iface, IHTMLMimeTypesCollection **p)
1240 OmNavigator *This = impl_from_IOmNavigator(iface);
1242 TRACE("(%p)->(%p)\n", This, p);
1244 if(!This->mime_types) {
1245 HRESULT hres;
1247 hres = create_mime_types_collection(This, &This->mime_types);
1248 if(FAILED(hres))
1249 return hres;
1250 }else {
1251 IHTMLMimeTypesCollection_AddRef(&This->mime_types->IHTMLMimeTypesCollection_iface);
1254 *p = &This->mime_types->IHTMLMimeTypesCollection_iface;
1255 return S_OK;
1258 static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsCollection **p)
1260 OmNavigator *This = impl_from_IOmNavigator(iface);
1262 TRACE("(%p)->(%p)\n", This, p);
1264 if(!This->plugins) {
1265 HRESULT hres;
1267 hres = create_plugins_collection(This, &This->plugins);
1268 if(FAILED(hres))
1269 return hres;
1270 }else {
1271 IHTMLPluginsCollection_AddRef(&This->plugins->IHTMLPluginsCollection_iface);
1274 *p = &This->plugins->IHTMLPluginsCollection_iface;
1275 return S_OK;
1278 static HRESULT WINAPI OmNavigator_get_cookieEnabled(IOmNavigator *iface, VARIANT_BOOL *p)
1280 OmNavigator *This = impl_from_IOmNavigator(iface);
1282 WARN("(%p)->(%p) semi-stub\n", This, p);
1284 *p = VARIANT_TRUE;
1285 return S_OK;
1288 static HRESULT WINAPI OmNavigator_get_opsProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
1290 OmNavigator *This = impl_from_IOmNavigator(iface);
1291 FIXME("(%p)->(%p)\n", This, p);
1292 return E_NOTIMPL;
1295 static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String)
1297 OmNavigator *This = impl_from_IOmNavigator(iface);
1299 TRACE("(%p)->(%p)\n", This, String);
1301 return dispex_to_string(&This->dispex, String);
1304 static HRESULT WINAPI OmNavigator_get_cpuClass(IOmNavigator *iface, BSTR *p)
1306 OmNavigator *This = impl_from_IOmNavigator(iface);
1308 TRACE("(%p)->(%p)\n", This, p);
1310 #ifdef _WIN64
1311 *p = SysAllocString(L"x64");
1312 #else
1313 *p = SysAllocString(L"x86");
1314 #endif
1315 return *p ? S_OK : E_OUTOFMEMORY;
1318 static HRESULT get_language_string(LCID lcid, BSTR *p)
1320 BSTR ret;
1321 int len;
1323 len = LCIDToLocaleName(lcid, NULL, 0, 0);
1324 if(!len) {
1325 WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
1326 return E_FAIL;
1329 ret = SysAllocStringLen(NULL, len-1);
1330 if(!ret)
1331 return E_OUTOFMEMORY;
1333 len = LCIDToLocaleName(lcid, ret, len, 0);
1334 if(!len) {
1335 WARN("LCIDToLocaleName failed: %lu\n", GetLastError());
1336 SysFreeString(ret);
1337 return E_FAIL;
1340 *p = ret;
1341 return S_OK;
1344 static HRESULT WINAPI OmNavigator_get_systemLanguage(IOmNavigator *iface, BSTR *p)
1346 OmNavigator *This = impl_from_IOmNavigator(iface);
1348 TRACE("(%p)->(%p)\n", This, p);
1350 return get_language_string(LOCALE_SYSTEM_DEFAULT, p);
1353 static HRESULT WINAPI OmNavigator_get_browserLanguage(IOmNavigator *iface, BSTR *p)
1355 OmNavigator *This = impl_from_IOmNavigator(iface);
1357 TRACE("(%p)->(%p)\n", This, p);
1359 return get_language_string(GetUserDefaultUILanguage(), p);
1362 static HRESULT WINAPI OmNavigator_get_userLanguage(IOmNavigator *iface, BSTR *p)
1364 OmNavigator *This = impl_from_IOmNavigator(iface);
1366 TRACE("(%p)->(%p)\n", This, p);
1368 return get_language_string(LOCALE_USER_DEFAULT, p);
1371 static HRESULT WINAPI OmNavigator_get_platform(IOmNavigator *iface, BSTR *p)
1373 OmNavigator *This = impl_from_IOmNavigator(iface);
1375 TRACE("(%p)->(%p)\n", This, p);
1377 #ifdef _WIN64
1378 *p = SysAllocString(L"Win64");
1379 #else
1380 *p = SysAllocString(L"Win32");
1381 #endif
1382 return S_OK;
1385 static HRESULT WINAPI OmNavigator_get_appMinorVersion(IOmNavigator *iface, BSTR *p)
1387 OmNavigator *This = impl_from_IOmNavigator(iface);
1389 TRACE("(%p)->(%p)\n", This, p);
1391 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
1392 *p = SysAllocString(L"0");
1393 return S_OK;
1396 static HRESULT WINAPI OmNavigator_get_connectionSpeed(IOmNavigator *iface, LONG *p)
1398 OmNavigator *This = impl_from_IOmNavigator(iface);
1399 FIXME("(%p)->(%p)\n", This, p);
1400 return E_NOTIMPL;
1403 static HRESULT WINAPI OmNavigator_get_onLine(IOmNavigator *iface, VARIANT_BOOL *p)
1405 OmNavigator *This = impl_from_IOmNavigator(iface);
1407 WARN("(%p)->(%p) semi-stub, returning true\n", This, p);
1409 *p = VARIANT_TRUE;
1410 return S_OK;
1413 static HRESULT WINAPI OmNavigator_get_userProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
1415 OmNavigator *This = impl_from_IOmNavigator(iface);
1416 FIXME("(%p)->(%p)\n", This, p);
1417 return E_NOTIMPL;
1420 static const IOmNavigatorVtbl OmNavigatorVtbl = {
1421 OmNavigator_QueryInterface,
1422 OmNavigator_AddRef,
1423 OmNavigator_Release,
1424 OmNavigator_GetTypeInfoCount,
1425 OmNavigator_GetTypeInfo,
1426 OmNavigator_GetIDsOfNames,
1427 OmNavigator_Invoke,
1428 OmNavigator_get_appCodeName,
1429 OmNavigator_get_appName,
1430 OmNavigator_get_appVersion,
1431 OmNavigator_get_userAgent,
1432 OmNavigator_javaEnabled,
1433 OmNavigator_taintEnabled,
1434 OmNavigator_get_mimeTypes,
1435 OmNavigator_get_plugins,
1436 OmNavigator_get_cookieEnabled,
1437 OmNavigator_get_opsProfile,
1438 OmNavigator_toString,
1439 OmNavigator_get_cpuClass,
1440 OmNavigator_get_systemLanguage,
1441 OmNavigator_get_browserLanguage,
1442 OmNavigator_get_userLanguage,
1443 OmNavigator_get_platform,
1444 OmNavigator_get_appMinorVersion,
1445 OmNavigator_get_connectionSpeed,
1446 OmNavigator_get_onLine,
1447 OmNavigator_get_userProfile
1450 static const tid_t OmNavigator_iface_tids[] = {
1451 IOmNavigator_tid,
1454 static dispex_static_data_t OmNavigator_dispex = {
1455 L"Navigator",
1456 NULL,
1457 DispHTMLNavigator_tid,
1458 OmNavigator_iface_tids
1461 HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator)
1463 OmNavigator *ret;
1465 ret = calloc(1, sizeof(*ret));
1466 if(!ret)
1467 return E_OUTOFMEMORY;
1469 ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl;
1470 ret->ref = 1;
1472 init_dispatch(&ret->dispex, (IUnknown*)&ret->IOmNavigator_iface, &OmNavigator_dispex, compat_mode);
1474 *navigator = &ret->IOmNavigator_iface;
1475 return S_OK;
1478 static inline HTMLPerformanceTiming *impl_from_IHTMLPerformanceTiming(IHTMLPerformanceTiming *iface)
1480 return CONTAINING_RECORD(iface, HTMLPerformanceTiming, IHTMLPerformanceTiming_iface);
1483 static HRESULT WINAPI HTMLPerformanceTiming_QueryInterface(IHTMLPerformanceTiming *iface, REFIID riid, void **ppv)
1485 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1487 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1489 if(IsEqualGUID(&IID_IUnknown, riid)) {
1490 *ppv = &This->IHTMLPerformanceTiming_iface;
1491 }else if(IsEqualGUID(&IID_IHTMLPerformanceTiming, riid)) {
1492 *ppv = &This->IHTMLPerformanceTiming_iface;
1493 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1494 return *ppv ? S_OK : E_NOINTERFACE;
1495 }else {
1496 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1497 *ppv = NULL;
1498 return E_NOINTERFACE;
1501 IUnknown_AddRef((IUnknown*)*ppv);
1502 return S_OK;
1505 static ULONG WINAPI HTMLPerformanceTiming_AddRef(IHTMLPerformanceTiming *iface)
1507 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1508 LONG ref = InterlockedIncrement(&This->ref);
1510 TRACE("(%p) ref=%ld\n", This, ref);
1512 return ref;
1515 static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface)
1517 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1518 LONG ref = InterlockedDecrement(&This->ref);
1520 TRACE("(%p) ref=%ld\n", This, ref);
1522 if(!ref) {
1523 if(This->dispex.outer)
1524 release_dispex(&This->dispex);
1525 free(This);
1528 return ref;
1531 static HRESULT WINAPI HTMLPerformanceTiming_GetTypeInfoCount(IHTMLPerformanceTiming *iface, UINT *pctinfo)
1533 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1534 FIXME("(%p)->(%p)\n", This, pctinfo);
1535 return E_NOTIMPL;
1538 static HRESULT WINAPI HTMLPerformanceTiming_GetTypeInfo(IHTMLPerformanceTiming *iface, UINT iTInfo,
1539 LCID lcid, ITypeInfo **ppTInfo)
1541 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1543 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1546 static HRESULT WINAPI HTMLPerformanceTiming_GetIDsOfNames(IHTMLPerformanceTiming *iface, REFIID riid,
1547 LPOLESTR *rgszNames, UINT cNames,
1548 LCID lcid, DISPID *rgDispId)
1550 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1552 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1553 lcid, rgDispId);
1556 static HRESULT WINAPI HTMLPerformanceTiming_Invoke(IHTMLPerformanceTiming *iface, DISPID dispIdMember,
1557 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1558 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1560 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1562 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1563 pDispParams, pVarResult, pExcepInfo, puArgErr);
1566 static ULONGLONG get_fetch_time(HTMLPerformanceTiming *This)
1568 /* If there's no prior doc unloaded and no redirects, fetch time == navigationStart time */
1569 if(!This->unload_event_end_time && !This->redirect_time)
1570 return This->navigation_start_time;
1572 if(This->dns_lookup_time)
1573 return This->dns_lookup_time;
1574 if(This->connect_time)
1575 return This->connect_time;
1576 if(This->request_time)
1577 return This->request_time;
1578 if(This->unload_event_end_time)
1579 return This->unload_event_end_time;
1581 return This->redirect_time;
1584 static HRESULT WINAPI HTMLPerformanceTiming_get_navigationStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1586 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1588 TRACE("(%p)->(%p)\n", This, p);
1590 *p = This->navigation_start_time;
1591 return S_OK;
1594 static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1596 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1598 TRACE("(%p)->(%p)\n", This, p);
1600 *p = This->unload_event_start_time;
1601 return S_OK;
1604 static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1606 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1608 TRACE("(%p)->(%p)\n", This, p);
1610 *p = This->unload_event_end_time;
1611 return S_OK;
1614 static HRESULT WINAPI HTMLPerformanceTiming_get_redirectStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1616 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1618 TRACE("(%p)->(%p)\n", This, p);
1620 *p = This->redirect_time;
1621 return S_OK;
1624 static HRESULT WINAPI HTMLPerformanceTiming_get_redirectEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1626 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1628 TRACE("(%p)->(%p)\n", This, p);
1630 *p = This->redirect_time ? get_fetch_time(This) : 0;
1631 return S_OK;
1634 static HRESULT WINAPI HTMLPerformanceTiming_get_fetchStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1636 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1638 TRACE("(%p)->(%p)\n", This, p);
1640 *p = get_fetch_time(This);
1641 return S_OK;
1644 static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1646 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1648 TRACE("(%p)->(%p)\n", This, p);
1650 *p = This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
1651 return S_OK;
1654 static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1656 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1658 TRACE("(%p)->(%p)\n", This, p);
1660 *p = This->connect_time ? This->connect_time :
1661 This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
1662 return S_OK;
1665 static HRESULT WINAPI HTMLPerformanceTiming_get_connectStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1667 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1669 TRACE("(%p)->(%p)\n", This, p);
1671 *p = This->connect_time ? This->connect_time :
1672 This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
1673 return S_OK;
1676 static HRESULT WINAPI HTMLPerformanceTiming_get_connectEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1678 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1680 TRACE("(%p)->(%p)\n", This, p);
1682 *p = This->request_time ? This->request_time :
1683 This->connect_time ? This->connect_time :
1684 This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
1685 return S_OK;
1688 static HRESULT WINAPI HTMLPerformanceTiming_get_requestStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1690 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1692 TRACE("(%p)->(%p)\n", This, p);
1694 *p = This->request_time ? This->request_time :
1695 This->connect_time ? This->connect_time :
1696 This->dns_lookup_time ? This->dns_lookup_time : get_fetch_time(This);
1697 return S_OK;
1700 static HRESULT WINAPI HTMLPerformanceTiming_get_responseStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1702 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1704 TRACE("(%p)->(%p)\n", This, p);
1706 *p = This->response_start_time;
1707 return S_OK;
1710 static HRESULT WINAPI HTMLPerformanceTiming_get_responseEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1712 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1714 TRACE("(%p)->(%p)\n", This, p);
1716 *p = This->response_end_time;
1717 return S_OK;
1720 static HRESULT WINAPI HTMLPerformanceTiming_get_domLoading(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1722 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1724 TRACE("(%p)->(%p)\n", This, p);
1726 /* Make sure this is after responseEnd, when the Gecko parser starts */
1727 *p = This->response_end_time;
1728 return S_OK;
1731 static HRESULT WINAPI HTMLPerformanceTiming_get_domInteractive(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1733 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1735 TRACE("(%p)->(%p)\n", This, p);
1737 *p = This->dom_interactive_time;
1738 return S_OK;
1741 static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1743 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1745 TRACE("(%p)->(%p)\n", This, p);
1747 *p = This->dom_content_loaded_event_start_time;
1748 return S_OK;
1751 static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1753 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1755 TRACE("(%p)->(%p)\n", This, p);
1757 *p = This->dom_content_loaded_event_end_time;
1758 return S_OK;
1761 static HRESULT WINAPI HTMLPerformanceTiming_get_domComplete(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1763 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1765 TRACE("(%p)->(%p)\n", This, p);
1767 *p = This->dom_complete_time;
1768 return S_OK;
1771 static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1773 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1775 TRACE("(%p)->(%p)\n", This, p);
1777 *p = This->load_event_start_time;
1778 return S_OK;
1781 static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1783 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1785 TRACE("(%p)->(%p)\n", This, p);
1787 *p = This->load_event_end_time;
1788 return S_OK;
1791 static HRESULT WINAPI HTMLPerformanceTiming_get_msFirstPaint(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1793 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1795 TRACE("(%p)->(%p)\n", This, p);
1797 *p = This->first_paint_time;
1798 return S_OK;
1801 static HRESULT WINAPI HTMLPerformanceTiming_toString(IHTMLPerformanceTiming *iface, BSTR *string)
1803 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1805 TRACE("(%p)->(%p)\n", This, string);
1807 return dispex_to_string(&This->dispex, string);
1810 static HRESULT WINAPI HTMLPerformanceTiming_toJSON(IHTMLPerformanceTiming *iface, VARIANT *p)
1812 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1813 FIXME("(%p)->(%p)\n", This, p);
1814 return E_NOTIMPL;
1817 static const IHTMLPerformanceTimingVtbl HTMLPerformanceTimingVtbl = {
1818 HTMLPerformanceTiming_QueryInterface,
1819 HTMLPerformanceTiming_AddRef,
1820 HTMLPerformanceTiming_Release,
1821 HTMLPerformanceTiming_GetTypeInfoCount,
1822 HTMLPerformanceTiming_GetTypeInfo,
1823 HTMLPerformanceTiming_GetIDsOfNames,
1824 HTMLPerformanceTiming_Invoke,
1825 HTMLPerformanceTiming_get_navigationStart,
1826 HTMLPerformanceTiming_get_unloadEventStart,
1827 HTMLPerformanceTiming_get_unloadEventEnd,
1828 HTMLPerformanceTiming_get_redirectStart,
1829 HTMLPerformanceTiming_get_redirectEnd,
1830 HTMLPerformanceTiming_get_fetchStart,
1831 HTMLPerformanceTiming_get_domainLookupStart,
1832 HTMLPerformanceTiming_get_domainLookupEnd,
1833 HTMLPerformanceTiming_get_connectStart,
1834 HTMLPerformanceTiming_get_connectEnd,
1835 HTMLPerformanceTiming_get_requestStart,
1836 HTMLPerformanceTiming_get_responseStart,
1837 HTMLPerformanceTiming_get_responseEnd,
1838 HTMLPerformanceTiming_get_domLoading,
1839 HTMLPerformanceTiming_get_domInteractive,
1840 HTMLPerformanceTiming_get_domContentLoadedEventStart,
1841 HTMLPerformanceTiming_get_domContentLoadedEventEnd,
1842 HTMLPerformanceTiming_get_domComplete,
1843 HTMLPerformanceTiming_get_loadEventStart,
1844 HTMLPerformanceTiming_get_loadEventEnd,
1845 HTMLPerformanceTiming_get_msFirstPaint,
1846 HTMLPerformanceTiming_toString,
1847 HTMLPerformanceTiming_toJSON
1850 static const tid_t HTMLPerformanceTiming_iface_tids[] = {
1851 IHTMLPerformanceTiming_tid,
1854 static dispex_static_data_t HTMLPerformanceTiming_dispex = {
1855 L"PerformanceTiming",
1856 NULL,
1857 IHTMLPerformanceTiming_tid,
1858 HTMLPerformanceTiming_iface_tids
1861 HRESULT create_performance_timing(HTMLPerformanceTiming **ret)
1863 HTMLPerformanceTiming *timing;
1865 timing = calloc(1, sizeof(*timing));
1866 if(!timing)
1867 return E_OUTOFMEMORY;
1869 timing->IHTMLPerformanceTiming_iface.lpVtbl = &HTMLPerformanceTimingVtbl;
1870 timing->ref = 1;
1872 /* Defer initializing the dispex until it's actually needed (for compat mode) */
1873 *ret = timing;
1874 return S_OK;
1877 typedef struct {
1878 DispatchEx dispex;
1879 IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
1881 LONG ref;
1882 HTMLPerformanceTiming *timing;
1883 } HTMLPerformanceNavigation;
1885 static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface)
1887 return CONTAINING_RECORD(iface, HTMLPerformanceNavigation, IHTMLPerformanceNavigation_iface);
1890 static HRESULT WINAPI HTMLPerformanceNavigation_QueryInterface(IHTMLPerformanceNavigation *iface, REFIID riid, void **ppv)
1892 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1894 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1896 if(IsEqualGUID(&IID_IUnknown, riid)) {
1897 *ppv = &This->IHTMLPerformanceNavigation_iface;
1898 }else if(IsEqualGUID(&IID_IHTMLPerformanceNavigation, riid)) {
1899 *ppv = &This->IHTMLPerformanceNavigation_iface;
1900 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1901 return *ppv ? S_OK : E_NOINTERFACE;
1902 }else {
1903 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1904 *ppv = NULL;
1905 return E_NOINTERFACE;
1908 IUnknown_AddRef((IUnknown*)*ppv);
1909 return S_OK;
1912 static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation *iface)
1914 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1915 LONG ref = InterlockedIncrement(&This->ref);
1917 TRACE("(%p) ref=%ld\n", This, ref);
1919 return ref;
1922 static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation *iface)
1924 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1925 LONG ref = InterlockedDecrement(&This->ref);
1927 TRACE("(%p) ref=%ld\n", This, ref);
1929 if(!ref) {
1930 IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface);
1931 release_dispex(&This->dispex);
1932 free(This);
1935 return ref;
1938 static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfoCount(IHTMLPerformanceNavigation *iface, UINT *pctinfo)
1940 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1941 FIXME("(%p)->(%p)\n", This, pctinfo);
1942 return E_NOTIMPL;
1945 static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfo(IHTMLPerformanceNavigation *iface, UINT iTInfo,
1946 LCID lcid, ITypeInfo **ppTInfo)
1948 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1950 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1953 static HRESULT WINAPI HTMLPerformanceNavigation_GetIDsOfNames(IHTMLPerformanceNavigation *iface, REFIID riid,
1954 LPOLESTR *rgszNames, UINT cNames,
1955 LCID lcid, DISPID *rgDispId)
1957 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1959 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1960 lcid, rgDispId);
1963 static HRESULT WINAPI HTMLPerformanceNavigation_Invoke(IHTMLPerformanceNavigation *iface, DISPID dispIdMember,
1964 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1965 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1967 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1969 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1970 pDispParams, pVarResult, pExcepInfo, puArgErr);
1973 static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigation *iface, ULONG *p)
1975 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1977 TRACE("(%p)->(%p)\n", This, p);
1979 *p = This->timing->navigation_type;
1980 return S_OK;
1983 static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation *iface, ULONG *p)
1985 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1987 TRACE("(%p)->(%p)\n", This, p);
1989 *p = This->timing->redirect_count;
1990 return S_OK;
1993 static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation *iface, BSTR *string)
1995 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1997 TRACE("(%p)->(%p)\n", This, string);
1999 return dispex_to_string(&This->dispex, string);
2002 static HRESULT WINAPI HTMLPerformanceNavigation_toJSON(IHTMLPerformanceNavigation *iface, VARIANT *p)
2004 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
2005 FIXME("(%p)->(%p)\n", This, p);
2006 return E_NOTIMPL;
2009 static const IHTMLPerformanceNavigationVtbl HTMLPerformanceNavigationVtbl = {
2010 HTMLPerformanceNavigation_QueryInterface,
2011 HTMLPerformanceNavigation_AddRef,
2012 HTMLPerformanceNavigation_Release,
2013 HTMLPerformanceNavigation_GetTypeInfoCount,
2014 HTMLPerformanceNavigation_GetTypeInfo,
2015 HTMLPerformanceNavigation_GetIDsOfNames,
2016 HTMLPerformanceNavigation_Invoke,
2017 HTMLPerformanceNavigation_get_type,
2018 HTMLPerformanceNavigation_get_redirectCount,
2019 HTMLPerformanceNavigation_toString,
2020 HTMLPerformanceNavigation_toJSON
2023 static const tid_t HTMLPerformanceNavigation_iface_tids[] = {
2024 IHTMLPerformanceNavigation_tid,
2027 static dispex_static_data_t HTMLPerformanceNavigation_dispex = {
2028 L"PerformanceNavigation",
2029 NULL,
2030 IHTMLPerformanceNavigation_tid,
2031 HTMLPerformanceNavigation_iface_tids
2034 typedef struct {
2035 DispatchEx dispex;
2036 IHTMLPerformance IHTMLPerformance_iface;
2038 LONG ref;
2040 IHTMLPerformanceNavigation *navigation;
2041 HTMLPerformanceTiming *timing;
2042 } HTMLPerformance;
2044 static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface)
2046 return CONTAINING_RECORD(iface, HTMLPerformance, IHTMLPerformance_iface);
2049 static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, REFIID riid, void **ppv)
2051 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2053 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
2055 if(IsEqualGUID(&IID_IUnknown, riid)) {
2056 *ppv = &This->IHTMLPerformance_iface;
2057 }else if(IsEqualGUID(&IID_IHTMLPerformance, riid)) {
2058 *ppv = &This->IHTMLPerformance_iface;
2059 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
2060 return *ppv ? S_OK : E_NOINTERFACE;
2061 }else {
2062 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
2063 *ppv = NULL;
2064 return E_NOINTERFACE;
2067 IUnknown_AddRef((IUnknown*)*ppv);
2068 return S_OK;
2071 static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface)
2073 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2074 LONG ref = InterlockedIncrement(&This->ref);
2076 TRACE("(%p) ref=%ld\n", This, ref);
2078 return ref;
2081 static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface)
2083 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2084 LONG ref = InterlockedDecrement(&This->ref);
2086 TRACE("(%p) ref=%ld\n", This, ref);
2088 if(!ref) {
2089 IHTMLPerformanceTiming_Release(&This->timing->IHTMLPerformanceTiming_iface);
2090 if(This->navigation)
2091 IHTMLPerformanceNavigation_Release(This->navigation);
2092 release_dispex(&This->dispex);
2093 free(This);
2096 return ref;
2099 static HRESULT WINAPI HTMLPerformance_GetTypeInfoCount(IHTMLPerformance *iface, UINT *pctinfo)
2101 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2102 FIXME("(%p)->(%p)\n", This, pctinfo);
2103 return E_NOTIMPL;
2106 static HRESULT WINAPI HTMLPerformance_GetTypeInfo(IHTMLPerformance *iface, UINT iTInfo,
2107 LCID lcid, ITypeInfo **ppTInfo)
2109 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2111 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2114 static HRESULT WINAPI HTMLPerformance_GetIDsOfNames(IHTMLPerformance *iface, REFIID riid,
2115 LPOLESTR *rgszNames, UINT cNames,
2116 LCID lcid, DISPID *rgDispId)
2118 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2120 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2121 lcid, rgDispId);
2124 static HRESULT WINAPI HTMLPerformance_Invoke(IHTMLPerformance *iface, DISPID dispIdMember,
2125 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2126 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2128 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2130 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2131 pDispParams, pVarResult, pExcepInfo, puArgErr);
2134 static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
2135 IHTMLPerformanceNavigation **p)
2137 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2139 TRACE("(%p)->(%p)\n", This, p);
2141 if(!This->navigation) {
2142 HTMLPerformanceNavigation *navigation;
2144 navigation = calloc(1, sizeof(*navigation));
2145 if(!navigation)
2146 return E_OUTOFMEMORY;
2148 navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl;
2149 navigation->ref = 1;
2150 navigation->timing = This->timing;
2151 IHTMLPerformanceTiming_AddRef(&This->timing->IHTMLPerformanceTiming_iface);
2153 init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface,
2154 &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
2156 This->navigation = &navigation->IHTMLPerformanceNavigation_iface;
2159 IHTMLPerformanceNavigation_AddRef(*p = This->navigation);
2160 return S_OK;
2163 static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLPerformanceTiming **p)
2165 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2167 TRACE("(%p)->(%p)\n", This, p);
2169 IHTMLPerformanceTiming_AddRef(*p = &This->timing->IHTMLPerformanceTiming_iface);
2170 return S_OK;
2173 static HRESULT WINAPI HTMLPerformance_toString(IHTMLPerformance *iface, BSTR *string)
2175 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2177 TRACE("(%p)->(%p)\n", This, string);
2179 return dispex_to_string(&This->dispex, string);
2182 static HRESULT WINAPI HTMLPerformance_toJSON(IHTMLPerformance *iface, VARIANT *var)
2184 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2185 FIXME("(%p)->(%p)\n", This, var);
2186 return E_NOTIMPL;
2189 static const IHTMLPerformanceVtbl HTMLPerformanceVtbl = {
2190 HTMLPerformance_QueryInterface,
2191 HTMLPerformance_AddRef,
2192 HTMLPerformance_Release,
2193 HTMLPerformance_GetTypeInfoCount,
2194 HTMLPerformance_GetTypeInfo,
2195 HTMLPerformance_GetIDsOfNames,
2196 HTMLPerformance_Invoke,
2197 HTMLPerformance_get_navigation,
2198 HTMLPerformance_get_timing,
2199 HTMLPerformance_toString,
2200 HTMLPerformance_toJSON
2203 static const tid_t HTMLPerformance_iface_tids[] = {
2204 IHTMLPerformance_tid,
2207 static dispex_static_data_t HTMLPerformance_dispex = {
2208 L"Performance",
2209 NULL,
2210 IHTMLPerformance_tid,
2211 HTMLPerformance_iface_tids
2214 HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret)
2216 compat_mode_t compat_mode = dispex_compat_mode(&window->event_target.dispex);
2217 HTMLPerformance *performance;
2219 performance = calloc(1, sizeof(*performance));
2220 if(!performance)
2221 return E_OUTOFMEMORY;
2223 performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl;
2224 performance->ref = 1;
2226 init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface,
2227 &HTMLPerformance_dispex, compat_mode);
2229 performance->timing = window->performance_timing;
2230 IHTMLPerformanceTiming_AddRef(&performance->timing->IHTMLPerformanceTiming_iface);
2232 init_dispatch(&performance->timing->dispex, (IUnknown*)&performance->timing->IHTMLPerformanceTiming_iface,
2233 &HTMLPerformanceTiming_dispex, compat_mode);
2235 *ret = &performance->IHTMLPerformance_iface;
2236 return S_OK;
2239 typedef struct {
2240 DispatchEx dispex;
2241 IHTMLNamespaceCollection IHTMLNamespaceCollection_iface;
2243 LONG ref;
2244 } HTMLNamespaceCollection;
2246 static inline HTMLNamespaceCollection *impl_from_IHTMLNamespaceCollection(IHTMLNamespaceCollection *iface)
2248 return CONTAINING_RECORD(iface, HTMLNamespaceCollection, IHTMLNamespaceCollection_iface);
2251 static HRESULT WINAPI HTMLNamespaceCollection_QueryInterface(IHTMLNamespaceCollection *iface, REFIID riid, void **ppv)
2253 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2255 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
2257 if(IsEqualGUID(&IID_IUnknown, riid)) {
2258 *ppv = &This->IHTMLNamespaceCollection_iface;
2259 }else if(IsEqualGUID(&IID_IHTMLNamespaceCollection, riid)) {
2260 *ppv = &This->IHTMLNamespaceCollection_iface;
2261 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
2262 return *ppv ? S_OK : E_NOINTERFACE;
2263 }else {
2264 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
2265 *ppv = NULL;
2266 return E_NOINTERFACE;
2269 IUnknown_AddRef((IUnknown*)*ppv);
2270 return S_OK;
2273 static ULONG WINAPI HTMLNamespaceCollection_AddRef(IHTMLNamespaceCollection *iface)
2275 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2276 LONG ref = InterlockedIncrement(&This->ref);
2278 TRACE("(%p) ref=%ld\n", This, ref);
2280 return ref;
2283 static ULONG WINAPI HTMLNamespaceCollection_Release(IHTMLNamespaceCollection *iface)
2285 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2286 LONG ref = InterlockedDecrement(&This->ref);
2288 TRACE("(%p) ref=%ld\n", This, ref);
2290 if(!ref) {
2291 release_dispex(&This->dispex);
2292 free(This);
2295 return ref;
2298 static HRESULT WINAPI HTMLNamespaceCollection_GetTypeInfoCount(IHTMLNamespaceCollection *iface, UINT *pctinfo)
2300 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2301 FIXME("(%p)->(%p)\n", This, pctinfo);
2302 return E_NOTIMPL;
2305 static HRESULT WINAPI HTMLNamespaceCollection_GetTypeInfo(IHTMLNamespaceCollection *iface, UINT iTInfo,
2306 LCID lcid, ITypeInfo **ppTInfo)
2308 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2310 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2313 static HRESULT WINAPI HTMLNamespaceCollection_GetIDsOfNames(IHTMLNamespaceCollection *iface, REFIID riid,
2314 LPOLESTR *rgszNames, UINT cNames,
2315 LCID lcid, DISPID *rgDispId)
2317 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2319 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2320 lcid, rgDispId);
2323 static HRESULT WINAPI HTMLNamespaceCollection_Invoke(IHTMLNamespaceCollection *iface, DISPID dispIdMember,
2324 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2325 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2327 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2329 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2330 pDispParams, pVarResult, pExcepInfo, puArgErr);
2333 static HRESULT WINAPI HTMLNamespaceCollection_get_length(IHTMLNamespaceCollection *iface, LONG *p)
2335 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2336 FIXME("(%p)->(%p) returning 0\n", This, p);
2337 *p = 0;
2338 return S_OK;
2341 static HRESULT WINAPI HTMLNamespaceCollection_item(IHTMLNamespaceCollection *iface, VARIANT index, IDispatch **p)
2343 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2344 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&index), p);
2345 return E_NOTIMPL;
2348 static HRESULT WINAPI HTMLNamespaceCollection_add(IHTMLNamespaceCollection *iface, BSTR namespace, BSTR urn,
2349 VARIANT implementation_url, IDispatch **p)
2351 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2352 FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_w(namespace), debugstr_w(urn), debugstr_variant(&implementation_url), p);
2353 return E_NOTIMPL;
2356 static const IHTMLNamespaceCollectionVtbl HTMLNamespaceCollectionVtbl = {
2357 HTMLNamespaceCollection_QueryInterface,
2358 HTMLNamespaceCollection_AddRef,
2359 HTMLNamespaceCollection_Release,
2360 HTMLNamespaceCollection_GetTypeInfoCount,
2361 HTMLNamespaceCollection_GetTypeInfo,
2362 HTMLNamespaceCollection_GetIDsOfNames,
2363 HTMLNamespaceCollection_Invoke,
2364 HTMLNamespaceCollection_get_length,
2365 HTMLNamespaceCollection_item,
2366 HTMLNamespaceCollection_add
2369 static const tid_t HTMLNamespaceCollection_iface_tids[] = {
2370 IHTMLNamespaceCollection_tid,
2373 static dispex_static_data_t HTMLNamespaceCollection_dispex = {
2374 L"MSNamespaceInfoCollection",
2375 NULL,
2376 DispHTMLNamespaceCollection_tid,
2377 HTMLNamespaceCollection_iface_tids
2380 HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCollection **ret)
2382 HTMLNamespaceCollection *namespaces;
2384 if (!(namespaces = calloc(1, sizeof(*namespaces))))
2385 return E_OUTOFMEMORY;
2387 namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl;
2388 namespaces->ref = 1;
2389 init_dispatch(&namespaces->dispex, (IUnknown*)&namespaces->IHTMLNamespaceCollection_iface,
2390 &HTMLNamespaceCollection_dispex, compat_mode);
2391 *ret = &namespaces->IHTMLNamespaceCollection_iface;
2392 return S_OK;
2395 struct console {
2396 DispatchEx dispex;
2397 IWineMSHTMLConsole IWineMSHTMLConsole_iface;
2398 LONG ref;
2401 static inline struct console *impl_from_IWineMSHTMLConsole(IWineMSHTMLConsole *iface)
2403 return CONTAINING_RECORD(iface, struct console, IWineMSHTMLConsole_iface);
2406 static HRESULT WINAPI console_QueryInterface(IWineMSHTMLConsole *iface, REFIID riid, void **ppv)
2408 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2410 TRACE("(%p)->(%s %p)\n", console, debugstr_mshtml_guid(riid), ppv);
2412 if(IsEqualGUID(&IID_IUnknown, riid)) {
2413 *ppv = &console->IWineMSHTMLConsole_iface;
2414 }else if(IsEqualGUID(&IID_IWineMSHTMLConsole, riid)) {
2415 *ppv = &console->IWineMSHTMLConsole_iface;
2416 }else if(dispex_query_interface(&console->dispex, riid, ppv)) {
2417 return *ppv ? S_OK : E_NOINTERFACE;
2418 }else {
2419 WARN("(%p)->(%s %p)\n", console, debugstr_mshtml_guid(riid), ppv);
2420 *ppv = NULL;
2421 return E_NOINTERFACE;
2424 IUnknown_AddRef((IUnknown*)*ppv);
2425 return S_OK;
2428 static ULONG WINAPI console_AddRef(IWineMSHTMLConsole *iface)
2430 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2431 LONG ref = InterlockedIncrement(&console->ref);
2433 TRACE("(%p) ref=%ld\n", console, ref);
2435 return ref;
2438 static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface)
2440 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2441 LONG ref = InterlockedDecrement(&console->ref);
2443 TRACE("(%p) ref=%ld\n", console, ref);
2445 if(!ref) {
2446 release_dispex(&console->dispex);
2447 free(console);
2450 return ref;
2453 static HRESULT WINAPI console_GetTypeInfoCount(IWineMSHTMLConsole *iface, UINT *pctinfo)
2455 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2456 FIXME("(%p)->(%p)\n", console, pctinfo);
2457 return E_NOTIMPL;
2460 static HRESULT WINAPI console_GetTypeInfo(IWineMSHTMLConsole *iface, UINT iTInfo,
2461 LCID lcid, ITypeInfo **ppTInfo)
2463 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2465 return IDispatchEx_GetTypeInfo(&console->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2468 static HRESULT WINAPI console_GetIDsOfNames(IWineMSHTMLConsole *iface, REFIID riid,
2469 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2471 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2473 return IDispatchEx_GetIDsOfNames(&console->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2474 lcid, rgDispId);
2477 static HRESULT WINAPI console_Invoke(IWineMSHTMLConsole *iface, DISPID dispIdMember,
2478 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2479 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2481 struct console *console = impl_from_IWineMSHTMLConsole(iface);
2483 return IDispatchEx_Invoke(&console->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2484 pDispParams, pVarResult, pExcepInfo, puArgErr);
2487 static HRESULT WINAPI console_assert(IWineMSHTMLConsole *iface, VARIANT_BOOL *assertion, VARIANT *vararg_start)
2489 FIXME("iface %p, assertion %p, vararg_start %p stub.\n", iface, assertion, vararg_start);
2491 return S_OK;
2494 static HRESULT WINAPI console_clear(IWineMSHTMLConsole *iface)
2496 FIXME("iface %p stub.\n", iface);
2498 return S_OK;
2501 static HRESULT WINAPI console_count(IWineMSHTMLConsole *iface, VARIANT *label)
2503 FIXME("iface %p, label %p stub.\n", iface, label);
2505 return S_OK;
2508 static HRESULT WINAPI console_debug(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2510 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2512 return S_OK;
2515 static HRESULT WINAPI console_dir(IWineMSHTMLConsole *iface, VARIANT *object)
2517 FIXME("iface %p, object %p stub.\n", iface, object);
2519 return S_OK;
2522 static HRESULT WINAPI console_dirxml(IWineMSHTMLConsole *iface, VARIANT *object)
2524 FIXME("iface %p, object %p stub.\n", iface, object);
2526 return S_OK;
2529 static HRESULT WINAPI console_error(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2531 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2533 return S_OK;
2536 static HRESULT WINAPI console_group(IWineMSHTMLConsole *iface, VARIANT *label)
2538 FIXME("iface %p, label %p stub.\n", iface, label);
2540 return S_OK;
2543 static HRESULT WINAPI console_group_collapsed(IWineMSHTMLConsole *iface, VARIANT *label)
2545 FIXME("iface %p, label %p stub.\n", iface, label);
2547 return S_OK;
2550 static HRESULT WINAPI console_group_end(IWineMSHTMLConsole *iface)
2552 FIXME("iface %p, stub.\n", iface);
2554 return S_OK;
2557 static HRESULT WINAPI console_info(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2559 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2561 return S_OK;
2564 static HRESULT WINAPI console_log(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2566 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2568 return S_OK;
2571 static HRESULT WINAPI console_time(IWineMSHTMLConsole *iface, VARIANT *label)
2573 FIXME("iface %p, label %p stub.\n", iface, label);
2575 return S_OK;
2578 static HRESULT WINAPI console_time_end(IWineMSHTMLConsole *iface, VARIANT *label)
2580 FIXME("iface %p, label %p stub.\n", iface, label);
2582 return S_OK;
2585 static HRESULT WINAPI console_trace(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2587 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2589 return S_OK;
2592 static HRESULT WINAPI console_warn(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
2594 FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
2596 return S_OK;
2599 static const IWineMSHTMLConsoleVtbl WineMSHTMLConsoleVtbl = {
2600 console_QueryInterface,
2601 console_AddRef,
2602 console_Release,
2603 console_GetTypeInfoCount,
2604 console_GetTypeInfo,
2605 console_GetIDsOfNames,
2606 console_Invoke,
2607 console_assert,
2608 console_clear,
2609 console_count,
2610 console_debug,
2611 console_dir,
2612 console_dirxml,
2613 console_error,
2614 console_group,
2615 console_group_collapsed,
2616 console_group_end,
2617 console_info,
2618 console_log,
2619 console_time,
2620 console_time_end,
2621 console_trace,
2622 console_warn,
2625 static const tid_t console_iface_tids[] = {
2626 IWineMSHTMLConsole_tid,
2629 static dispex_static_data_t console_dispex = {
2630 L"Console",
2631 NULL,
2632 IWineMSHTMLConsole_tid,
2633 console_iface_tids
2636 void create_console(compat_mode_t compat_mode, IWineMSHTMLConsole **ret)
2638 struct console *obj;
2640 obj = calloc(1, sizeof(*obj));
2641 if(!obj)
2643 ERR("No memory.\n");
2644 return;
2647 obj->IWineMSHTMLConsole_iface.lpVtbl = &WineMSHTMLConsoleVtbl;
2648 obj->ref = 1;
2649 init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLConsole_iface, &console_dispex, compat_mode);
2651 *ret = &obj->IWineMSHTMLConsole_iface;
2654 struct media_query_list_listener {
2655 struct list entry;
2656 IDispatch *function;
2659 struct media_query_list_callback;
2660 struct media_query_list {
2661 DispatchEx dispex;
2662 IWineMSHTMLMediaQueryList IWineMSHTMLMediaQueryList_iface;
2663 LONG ref;
2664 nsIDOMMediaQueryList *nsquerylist;
2665 struct media_query_list_callback *callback;
2666 struct list listeners;
2669 struct media_query_list_callback {
2670 nsIDOMMediaQueryListListener nsIDOMMediaQueryListListener_iface;
2671 struct media_query_list *media_query_list;
2672 LONG ref;
2675 static inline struct media_query_list *impl_from_IWineMSHTMLMediaQueryList(IWineMSHTMLMediaQueryList *iface)
2677 return CONTAINING_RECORD(iface, struct media_query_list, IWineMSHTMLMediaQueryList_iface);
2680 static HRESULT WINAPI media_query_list_QueryInterface(IWineMSHTMLMediaQueryList *iface, REFIID riid, void **ppv)
2682 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2684 TRACE("(%p)->(%s %p)\n", media_query_list, debugstr_mshtml_guid(riid), ppv);
2686 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IWineMSHTMLMediaQueryList, riid)) {
2687 *ppv = &media_query_list->IWineMSHTMLMediaQueryList_iface;
2688 }else if(dispex_query_interface(&media_query_list->dispex, riid, ppv)) {
2689 return *ppv ? S_OK : E_NOINTERFACE;
2690 }else {
2691 *ppv = NULL;
2692 return E_NOINTERFACE;
2695 IUnknown_AddRef((IUnknown*)*ppv);
2696 return S_OK;
2699 static ULONG WINAPI media_query_list_AddRef(IWineMSHTMLMediaQueryList *iface)
2701 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2702 LONG ref = InterlockedIncrement(&media_query_list->ref);
2704 TRACE("(%p) ref=%ld\n", media_query_list, ref);
2706 return ref;
2709 static ULONG WINAPI media_query_list_Release(IWineMSHTMLMediaQueryList *iface)
2711 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2712 LONG ref = InterlockedDecrement(&media_query_list->ref);
2713 struct media_query_list_listener *listener, *listener2;
2715 TRACE("(%p) ref=%ld\n", media_query_list, ref);
2717 if(!ref) {
2718 media_query_list->callback->media_query_list = NULL;
2719 LIST_FOR_EACH_ENTRY_SAFE(listener, listener2, &media_query_list->listeners, struct media_query_list_listener, entry) {
2720 IDispatch_Release(listener->function);
2721 free(listener);
2723 nsIDOMMediaQueryListListener_Release(&media_query_list->callback->nsIDOMMediaQueryListListener_iface);
2724 nsIDOMMediaQueryList_Release(media_query_list->nsquerylist);
2725 release_dispex(&media_query_list->dispex);
2726 free(media_query_list);
2729 return ref;
2732 static HRESULT WINAPI media_query_list_GetTypeInfoCount(IWineMSHTMLMediaQueryList *iface, UINT *pctinfo)
2734 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2736 TRACE("(%p)->(%p)\n", media_query_list, pctinfo);
2738 return IDispatchEx_GetTypeInfoCount(&media_query_list->dispex.IDispatchEx_iface, pctinfo);
2741 static HRESULT WINAPI media_query_list_GetTypeInfo(IWineMSHTMLMediaQueryList *iface, UINT iTInfo,
2742 LCID lcid, ITypeInfo **ppTInfo)
2744 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2746 return IDispatchEx_GetTypeInfo(&media_query_list->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2749 static HRESULT WINAPI media_query_list_GetIDsOfNames(IWineMSHTMLMediaQueryList *iface, REFIID riid,
2750 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
2752 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2754 return IDispatchEx_GetIDsOfNames(&media_query_list->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2755 lcid, rgDispId);
2758 static HRESULT WINAPI media_query_list_Invoke(IWineMSHTMLMediaQueryList *iface, DISPID dispIdMember,
2759 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2760 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2762 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2764 return IDispatchEx_Invoke(&media_query_list->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2765 pDispParams, pVarResult, pExcepInfo, puArgErr);
2768 static HRESULT WINAPI media_query_list_get_media(IWineMSHTMLMediaQueryList *iface, BSTR *p)
2770 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2771 nsAString nsstr;
2773 TRACE("(%p)->(%p)\n", media_query_list, p);
2775 nsAString_InitDepend(&nsstr, NULL);
2776 return return_nsstr(nsIDOMMediaQueryList_GetMedia(media_query_list->nsquerylist, &nsstr), &nsstr, p);
2779 static HRESULT WINAPI media_query_list_get_matches(IWineMSHTMLMediaQueryList *iface, VARIANT_BOOL *p)
2781 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2782 nsresult nsres;
2783 cpp_bool b;
2785 TRACE("(%p)->(%p)\n", media_query_list, p);
2787 nsres = nsIDOMMediaQueryList_GetMatches(media_query_list->nsquerylist, &b);
2788 if(NS_FAILED(nsres))
2789 return map_nsresult(nsres);
2790 *p = b ? VARIANT_TRUE : VARIANT_FALSE;
2791 return S_OK;
2794 static HRESULT WINAPI media_query_list_addListener(IWineMSHTMLMediaQueryList *iface, VARIANT *listener)
2796 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2797 struct media_query_list_listener *entry;
2799 TRACE("(%p)->(%s)\n", media_query_list, debugstr_variant(listener));
2801 if(V_VT(listener) != VT_DISPATCH || !V_DISPATCH(listener))
2802 return S_OK;
2804 LIST_FOR_EACH_ENTRY(entry, &media_query_list->listeners, struct media_query_list_listener, entry)
2805 if(entry->function == V_DISPATCH(listener))
2806 return S_OK;
2808 if(!(entry = malloc(sizeof(*entry))))
2809 return E_OUTOFMEMORY;
2810 entry->function = V_DISPATCH(listener);
2811 IDispatch_AddRef(V_DISPATCH(listener));
2813 list_add_tail(&media_query_list->listeners, &entry->entry);
2814 return S_OK;
2817 static HRESULT WINAPI media_query_list_removeListener(IWineMSHTMLMediaQueryList *iface, VARIANT *listener)
2819 struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface);
2820 struct media_query_list_listener *entry;
2822 TRACE("(%p)->(%s)\n", media_query_list, debugstr_variant(listener));
2824 if(V_VT(listener) != VT_DISPATCH || !V_DISPATCH(listener))
2825 return S_OK;
2827 LIST_FOR_EACH_ENTRY(entry, &media_query_list->listeners, struct media_query_list_listener, entry) {
2828 if(entry->function == V_DISPATCH(listener)) {
2829 list_remove(&entry->entry);
2830 IDispatch_Release(entry->function);
2831 free(entry);
2832 break;
2836 return S_OK;
2839 static const IWineMSHTMLMediaQueryListVtbl media_query_list_vtbl = {
2840 media_query_list_QueryInterface,
2841 media_query_list_AddRef,
2842 media_query_list_Release,
2843 media_query_list_GetTypeInfoCount,
2844 media_query_list_GetTypeInfo,
2845 media_query_list_GetIDsOfNames,
2846 media_query_list_Invoke,
2847 media_query_list_get_media,
2848 media_query_list_get_matches,
2849 media_query_list_addListener,
2850 media_query_list_removeListener
2853 static inline struct media_query_list_callback *impl_from_nsIDOMMediaQueryListListener(nsIDOMMediaQueryListListener *iface)
2855 return CONTAINING_RECORD(iface, struct media_query_list_callback, nsIDOMMediaQueryListListener_iface);
2858 static nsresult NSAPI media_query_list_callback_QueryInterface(nsIDOMMediaQueryListListener *iface,
2859 nsIIDRef riid, void **result)
2861 struct media_query_list_callback *callback = impl_from_nsIDOMMediaQueryListListener(iface);
2863 if(IsEqualGUID(&IID_nsISupports, riid) || IsEqualGUID(&IID_nsIDOMMediaQueryListListener, riid)) {
2864 *result = &callback->nsIDOMMediaQueryListListener_iface;
2865 }else {
2866 *result = NULL;
2867 return NS_NOINTERFACE;
2870 nsIDOMMediaQueryListListener_AddRef(&callback->nsIDOMMediaQueryListListener_iface);
2871 return NS_OK;
2874 static nsrefcnt NSAPI media_query_list_callback_AddRef(nsIDOMMediaQueryListListener *iface)
2876 struct media_query_list_callback *callback = impl_from_nsIDOMMediaQueryListListener(iface);
2877 LONG ref = InterlockedIncrement(&callback->ref);
2879 TRACE("(%p) ref=%ld\n", callback, ref);
2881 return ref;
2884 static nsrefcnt NSAPI media_query_list_callback_Release(nsIDOMMediaQueryListListener *iface)
2886 struct media_query_list_callback *callback = impl_from_nsIDOMMediaQueryListListener(iface);
2887 LONG ref = InterlockedDecrement(&callback->ref);
2889 TRACE("(%p) ref=%ld\n", callback, ref);
2891 if(!ref)
2892 free(callback);
2893 return ref;
2896 static nsresult NSAPI media_query_list_callback_HandleChange(nsIDOMMediaQueryListListener *iface, nsIDOMMediaQueryList *mql)
2898 struct media_query_list_callback *callback = impl_from_nsIDOMMediaQueryListListener(iface);
2899 IDispatch *listener_funcs_buf[4], **listener_funcs = listener_funcs_buf;
2900 struct media_query_list *media_query_list = callback->media_query_list;
2901 struct media_query_list_listener *listener;
2902 unsigned cnt, i = 0;
2903 VARIANT args[1], v;
2904 HRESULT hres;
2906 if(!media_query_list)
2907 return NS_OK;
2909 cnt = list_count(&media_query_list->listeners);
2910 if(cnt > ARRAY_SIZE(listener_funcs_buf) && !(listener_funcs = malloc(cnt * sizeof(*listener_funcs))))
2911 return NS_ERROR_OUT_OF_MEMORY;
2913 LIST_FOR_EACH_ENTRY(listener, &media_query_list->listeners, struct media_query_list_listener, entry) {
2914 listener_funcs[i] = listener->function;
2915 IDispatch_AddRef(listener_funcs[i++]);
2918 for(i = 0; i < cnt; i++) {
2919 DISPPARAMS dp = { args, NULL, 1, 0 };
2921 V_VT(args) = VT_DISPATCH;
2922 V_DISPATCH(args) = (IDispatch*)&media_query_list->dispex.IDispatchEx_iface;
2923 V_VT(&v) = VT_EMPTY;
2925 TRACE("%p >>>\n", media_query_list);
2926 hres = call_disp_func(listener_funcs[i], &dp, &v);
2927 if(hres == S_OK) {
2928 TRACE("%p <<< %s\n", media_query_list, debugstr_variant(&v));
2929 VariantClear(&v);
2930 }else {
2931 WARN("%p <<< %08lx\n", media_query_list, hres);
2933 IDispatch_Release(listener_funcs[i]);
2936 if(listener_funcs != listener_funcs_buf)
2937 free(listener_funcs);
2938 return NS_OK;
2941 static const nsIDOMMediaQueryListListenerVtbl media_query_list_callback_vtbl = {
2942 media_query_list_callback_QueryInterface,
2943 media_query_list_callback_AddRef,
2944 media_query_list_callback_Release,
2945 media_query_list_callback_HandleChange
2948 static const tid_t media_query_list_iface_tids[] = {
2949 IWineMSHTMLMediaQueryList_tid,
2952 static dispex_static_data_t media_query_list_dispex = {
2953 L"MediaQueryList",
2954 NULL,
2955 IWineMSHTMLMediaQueryList_tid,
2956 media_query_list_iface_tids
2959 HRESULT create_media_query_list(HTMLWindow *window, BSTR media_query, IDispatch **ret)
2961 struct media_query_list *media_query_list;
2962 nsISupports *nsunk;
2963 nsAString nsstr;
2964 nsresult nsres;
2966 if(!media_query || !media_query[0])
2967 return E_INVALIDARG;
2969 if(!(media_query_list = malloc(sizeof(*media_query_list))))
2970 return E_OUTOFMEMORY;
2972 if(!(media_query_list->callback = malloc(sizeof(*media_query_list->callback)))) {
2973 free(media_query_list);
2974 return E_OUTOFMEMORY;
2976 media_query_list->callback->nsIDOMMediaQueryListListener_iface.lpVtbl = &media_query_list_callback_vtbl;
2977 media_query_list->callback->media_query_list = media_query_list;
2978 media_query_list->callback->ref = 1;
2980 nsAString_InitDepend(&nsstr, media_query);
2981 nsres = nsIDOMWindow_MatchMedia(window->outer_window->nswindow, &nsstr, &nsunk);
2982 nsAString_Finish(&nsstr);
2983 if(NS_FAILED(nsres)) {
2984 free(media_query_list->callback);
2985 free(media_query_list);
2986 return map_nsresult(nsres);
2988 nsres = nsISupports_QueryInterface(nsunk, &IID_nsIDOMMediaQueryList, (void**)&media_query_list->nsquerylist);
2989 assert(NS_SUCCEEDED(nsres));
2990 nsISupports_Release(nsunk);
2992 nsres = nsIDOMMediaQueryList_SetListener(media_query_list->nsquerylist, &media_query_list->callback->nsIDOMMediaQueryListListener_iface);
2993 assert(NS_SUCCEEDED(nsres));
2995 media_query_list->IWineMSHTMLMediaQueryList_iface.lpVtbl = &media_query_list_vtbl;
2996 media_query_list->ref = 1;
2997 list_init(&media_query_list->listeners);
2998 init_dispatch(&media_query_list->dispex, (IUnknown*)&media_query_list->IWineMSHTMLMediaQueryList_iface,
2999 &media_query_list_dispex, dispex_compat_mode(&window->inner_window->event_target.dispex));
3001 *ret = (IDispatch*)&media_query_list->IWineMSHTMLMediaQueryList_iface;
3002 return S_OK;