wined3d: Pass a wined3d_device_context to wined3d_cs_emit_blt_sub_resource().
[wine/zf.git] / dlls / mshtml / omnavigator.c
blob43067b813a10f0b9115fcf80faccfe26c15cca03
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>
20 #include <assert.h>
22 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winuser.h"
27 #include "ole2.h"
29 #include "wine/debug.h"
31 #include "mshtml_private.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
35 typedef struct HTMLPluginsCollection HTMLPluginsCollection;
36 typedef struct HTMLMimeTypesCollection HTMLMimeTypesCollection;
38 typedef struct {
39 DispatchEx dispex;
40 IOmNavigator IOmNavigator_iface;
42 LONG ref;
44 HTMLPluginsCollection *plugins;
45 HTMLMimeTypesCollection *mime_types;
46 } OmNavigator;
48 typedef struct {
49 DispatchEx dispex;
50 IHTMLDOMImplementation IHTMLDOMImplementation_iface;
51 IHTMLDOMImplementation2 IHTMLDOMImplementation2_iface;
53 LONG ref;
55 nsIDOMDOMImplementation *implementation;
56 GeckoBrowser *browser;
57 } HTMLDOMImplementation;
59 static inline HTMLDOMImplementation *impl_from_IHTMLDOMImplementation(IHTMLDOMImplementation *iface)
61 return CONTAINING_RECORD(iface, HTMLDOMImplementation, IHTMLDOMImplementation_iface);
64 static HRESULT WINAPI HTMLDOMImplementation_QueryInterface(IHTMLDOMImplementation *iface, REFIID riid, void **ppv)
66 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
68 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
70 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IHTMLDOMImplementation, riid)) {
71 *ppv = &This->IHTMLDOMImplementation_iface;
72 }else if(IsEqualGUID(&IID_IHTMLDOMImplementation2, riid)) {
73 *ppv = &This->IHTMLDOMImplementation2_iface;
74 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
75 return *ppv ? S_OK : E_NOINTERFACE;
76 }else {
77 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
78 *ppv = NULL;
79 return E_NOINTERFACE;
82 IUnknown_AddRef((IUnknown*)*ppv);
83 return S_OK;
86 static ULONG WINAPI HTMLDOMImplementation_AddRef(IHTMLDOMImplementation *iface)
88 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
89 LONG ref = InterlockedIncrement(&This->ref);
91 TRACE("(%p) ref=%d\n", This, ref);
93 return ref;
96 static ULONG WINAPI HTMLDOMImplementation_Release(IHTMLDOMImplementation *iface)
98 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
99 LONG ref = InterlockedDecrement(&This->ref);
101 TRACE("(%p) ref=%d\n", This, ref);
103 if(!ref) {
104 assert(!This->browser);
105 if(This->implementation)
106 nsIDOMDOMImplementation_Release(This->implementation);
107 release_dispex(&This->dispex);
108 heap_free(This);
111 return ref;
114 static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfoCount(IHTMLDOMImplementation *iface, UINT *pctinfo)
116 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
118 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
121 static HRESULT WINAPI HTMLDOMImplementation_GetTypeInfo(IHTMLDOMImplementation *iface, UINT iTInfo,
122 LCID lcid, ITypeInfo **ppTInfo)
124 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
126 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
129 static HRESULT WINAPI HTMLDOMImplementation_GetIDsOfNames(IHTMLDOMImplementation *iface, REFIID riid,
130 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
132 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
134 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
135 cNames, lcid, rgDispId);
138 static HRESULT WINAPI HTMLDOMImplementation_Invoke(IHTMLDOMImplementation *iface, DISPID dispIdMember,
139 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
140 EXCEPINFO *pExcepInfo, UINT *puArgErr)
142 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
144 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid,
145 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
148 static HRESULT WINAPI HTMLDOMImplementation_hasFeature(IHTMLDOMImplementation *iface, BSTR feature,
149 VARIANT version, VARIANT_BOOL *pfHasFeature)
151 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation(iface);
153 FIXME("(%p)->(%s %s %p) returning false\n", This, debugstr_w(feature), debugstr_variant(&version), pfHasFeature);
155 *pfHasFeature = VARIANT_FALSE;
156 return S_OK;
159 static const IHTMLDOMImplementationVtbl HTMLDOMImplementationVtbl = {
160 HTMLDOMImplementation_QueryInterface,
161 HTMLDOMImplementation_AddRef,
162 HTMLDOMImplementation_Release,
163 HTMLDOMImplementation_GetTypeInfoCount,
164 HTMLDOMImplementation_GetTypeInfo,
165 HTMLDOMImplementation_GetIDsOfNames,
166 HTMLDOMImplementation_Invoke,
167 HTMLDOMImplementation_hasFeature
170 static inline HTMLDOMImplementation *impl_from_IHTMLDOMImplementation2(IHTMLDOMImplementation2 *iface)
172 return CONTAINING_RECORD(iface, HTMLDOMImplementation, IHTMLDOMImplementation2_iface);
175 static HRESULT WINAPI HTMLDOMImplementation2_QueryInterface(IHTMLDOMImplementation2 *iface, REFIID riid, void **ppv)
177 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
178 return IHTMLDOMImplementation_QueryInterface(&This->IHTMLDOMImplementation_iface, riid, ppv);
181 static ULONG WINAPI HTMLDOMImplementation2_AddRef(IHTMLDOMImplementation2 *iface)
183 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
184 return IHTMLDOMImplementation_AddRef(&This->IHTMLDOMImplementation_iface);
187 static ULONG WINAPI HTMLDOMImplementation2_Release(IHTMLDOMImplementation2 *iface)
189 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
190 return IHTMLDOMImplementation_Release(&This->IHTMLDOMImplementation_iface);
193 static HRESULT WINAPI HTMLDOMImplementation2_GetTypeInfoCount(IHTMLDOMImplementation2 *iface, UINT *pctinfo)
195 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
196 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
199 static HRESULT WINAPI HTMLDOMImplementation2_GetTypeInfo(IHTMLDOMImplementation2 *iface, UINT iTInfo,
200 LCID lcid, ITypeInfo **ppTInfo)
202 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
203 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
206 static HRESULT WINAPI HTMLDOMImplementation2_GetIDsOfNames(IHTMLDOMImplementation2 *iface, REFIID riid,
207 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
209 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
210 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames,
211 cNames, lcid, rgDispId);
214 static HRESULT WINAPI HTMLDOMImplementation2_Invoke(IHTMLDOMImplementation2 *iface, DISPID dispIdMember,
215 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
216 EXCEPINFO *pExcepInfo, UINT *puArgErr)
218 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
219 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid,
220 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
223 static HRESULT WINAPI HTMLDOMImplementation2_createDocumentType(IHTMLDOMImplementation2 *iface, BSTR name,
224 VARIANT *public_id, VARIANT *system_id, IDOMDocumentType **new_type)
226 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
227 FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_w(name), debugstr_variant(public_id),
228 debugstr_variant(system_id), new_type);
229 return E_NOTIMPL;
232 static HRESULT WINAPI HTMLDOMImplementation2_createDocument(IHTMLDOMImplementation2 *iface, VARIANT *ns,
233 VARIANT *tag_name, IDOMDocumentType *document_type, IHTMLDocument7 **new_document)
235 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
236 FIXME("(%p)->(%s %s %p %p)\n", This, debugstr_variant(ns), debugstr_variant(tag_name),
237 document_type, new_document);
238 return E_NOTIMPL;
241 static HRESULT WINAPI HTMLDOMImplementation2_createHTMLDocument(IHTMLDOMImplementation2 *iface, BSTR title,
242 IHTMLDocument7 **new_document)
244 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
245 HTMLDocumentNode *new_document_node;
246 nsIDOMHTMLDocument *html_doc;
247 nsIDOMDocument *doc;
248 nsAString title_str;
249 nsresult nsres;
250 HRESULT hres;
252 FIXME("(%p)->(%s %p)\n", This, debugstr_w(title), new_document);
254 if(!This->browser)
255 return E_UNEXPECTED;
257 nsAString_InitDepend(&title_str, title);
258 nsres = nsIDOMDOMImplementation_CreateHTMLDocument(This->implementation, &title_str, &doc);
259 nsAString_Finish(&title_str);
260 if(NS_FAILED(nsres)) {
261 ERR("CreateHTMLDocument failed: %08x\n", nsres);
262 return E_FAIL;
265 nsres = nsIDOMDocument_QueryInterface(doc, &IID_nsIDOMHTMLDocument, (void**)&html_doc);
266 nsIDOMDocument_Release(doc);
267 assert(nsres == NS_OK);
269 hres = create_document_node(html_doc, This->browser, NULL, dispex_compat_mode(&This->dispex), &new_document_node);
270 nsIDOMHTMLDocument_Release(html_doc);
271 if(FAILED(hres))
272 return hres;
274 *new_document = &new_document_node->basedoc.IHTMLDocument7_iface;
275 return S_OK;
278 static HRESULT WINAPI HTMLDOMImplementation2_hasFeature(IHTMLDOMImplementation2 *iface, BSTR feature,
279 VARIANT version, VARIANT_BOOL *pfHasFeature)
281 HTMLDOMImplementation *This = impl_from_IHTMLDOMImplementation2(iface);
283 FIXME("(%p)->(%s %s %p) returning false\n", This, debugstr_w(feature), debugstr_variant(&version), pfHasFeature);
285 *pfHasFeature = VARIANT_FALSE;
286 return S_OK;
289 static const IHTMLDOMImplementation2Vtbl HTMLDOMImplementation2Vtbl = {
290 HTMLDOMImplementation2_QueryInterface,
291 HTMLDOMImplementation2_AddRef,
292 HTMLDOMImplementation2_Release,
293 HTMLDOMImplementation2_GetTypeInfoCount,
294 HTMLDOMImplementation2_GetTypeInfo,
295 HTMLDOMImplementation2_GetIDsOfNames,
296 HTMLDOMImplementation2_Invoke,
297 HTMLDOMImplementation2_createDocumentType,
298 HTMLDOMImplementation2_createDocument,
299 HTMLDOMImplementation2_createHTMLDocument,
300 HTMLDOMImplementation2_hasFeature
303 static const tid_t HTMLDOMImplementation_iface_tids[] = {
304 IHTMLDOMImplementation_tid,
307 static dispex_static_data_t HTMLDOMImplementation_dispex = {
308 NULL,
309 DispHTMLDOMImplementation_tid,
310 HTMLDOMImplementation_iface_tids
313 HRESULT create_dom_implementation(HTMLDocumentNode *doc_node, IHTMLDOMImplementation **ret)
315 HTMLDOMImplementation *dom_implementation;
316 nsresult nsres;
318 if(!doc_node->browser)
319 return E_UNEXPECTED;
321 dom_implementation = heap_alloc_zero(sizeof(*dom_implementation));
322 if(!dom_implementation)
323 return E_OUTOFMEMORY;
325 dom_implementation->IHTMLDOMImplementation_iface.lpVtbl = &HTMLDOMImplementationVtbl;
326 dom_implementation->IHTMLDOMImplementation2_iface.lpVtbl = &HTMLDOMImplementation2Vtbl;
327 dom_implementation->ref = 1;
328 dom_implementation->browser = doc_node->browser;
330 init_dispatch(&dom_implementation->dispex, (IUnknown*)&dom_implementation->IHTMLDOMImplementation_iface,
331 &HTMLDOMImplementation_dispex, doc_node->document_mode);
333 nsres = nsIDOMHTMLDocument_GetImplementation(doc_node->nsdoc, &dom_implementation->implementation);
334 if(NS_FAILED(nsres)) {
335 ERR("GetDOMImplementation failed: %08x\n", nsres);
336 IHTMLDOMImplementation_Release(&dom_implementation->IHTMLDOMImplementation_iface);
337 return E_FAIL;
340 *ret = &dom_implementation->IHTMLDOMImplementation_iface;
341 return S_OK;
344 void detach_dom_implementation(IHTMLDOMImplementation *iface)
346 HTMLDOMImplementation *dom_implementation = impl_from_IHTMLDOMImplementation(iface);
347 dom_implementation->browser = NULL;
350 typedef struct {
351 DispatchEx dispex;
352 IHTMLScreen IHTMLScreen_iface;
354 LONG ref;
355 } HTMLScreen;
357 static inline HTMLScreen *impl_from_IHTMLScreen(IHTMLScreen *iface)
359 return CONTAINING_RECORD(iface, HTMLScreen, IHTMLScreen_iface);
362 static HRESULT WINAPI HTMLScreen_QueryInterface(IHTMLScreen *iface, REFIID riid, void **ppv)
364 HTMLScreen *This = impl_from_IHTMLScreen(iface);
366 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
368 if(IsEqualGUID(&IID_IUnknown, riid)) {
369 *ppv = &This->IHTMLScreen_iface;
370 }else if(IsEqualGUID(&IID_IHTMLScreen, riid)) {
371 *ppv = &This->IHTMLScreen_iface;
372 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
373 return *ppv ? S_OK : E_NOINTERFACE;
374 }else {
375 *ppv = NULL;
376 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
377 return E_NOINTERFACE;
380 IUnknown_AddRef((IUnknown*)*ppv);
381 return S_OK;
384 static ULONG WINAPI HTMLScreen_AddRef(IHTMLScreen *iface)
386 HTMLScreen *This = impl_from_IHTMLScreen(iface);
387 LONG ref = InterlockedIncrement(&This->ref);
389 TRACE("(%p) ref=%d\n", This, ref);
391 return ref;
394 static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface)
396 HTMLScreen *This = impl_from_IHTMLScreen(iface);
397 LONG ref = InterlockedDecrement(&This->ref);
399 TRACE("(%p) ref=%d\n", This, ref);
401 if(!ref) {
402 release_dispex(&This->dispex);
403 heap_free(This);
406 return ref;
409 static HRESULT WINAPI HTMLScreen_GetTypeInfoCount(IHTMLScreen *iface, UINT *pctinfo)
411 HTMLScreen *This = impl_from_IHTMLScreen(iface);
412 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
415 static HRESULT WINAPI HTMLScreen_GetTypeInfo(IHTMLScreen *iface, UINT iTInfo,
416 LCID lcid, ITypeInfo **ppTInfo)
418 HTMLScreen *This = impl_from_IHTMLScreen(iface);
419 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
422 static HRESULT WINAPI HTMLScreen_GetIDsOfNames(IHTMLScreen *iface, REFIID riid,
423 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
425 HTMLScreen *This = impl_from_IHTMLScreen(iface);
426 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
427 lcid, rgDispId);
430 static HRESULT WINAPI HTMLScreen_Invoke(IHTMLScreen *iface, DISPID dispIdMember,
431 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
432 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
434 HTMLScreen *This = impl_from_IHTMLScreen(iface);
435 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
436 pDispParams, pVarResult, pExcepInfo, puArgErr);
439 static HRESULT WINAPI HTMLScreen_get_colorDepth(IHTMLScreen *iface, LONG *p)
441 HTMLScreen *This = impl_from_IHTMLScreen(iface);
442 HDC hdc = GetDC(0);
444 TRACE("(%p)->(%p)\n", This, p);
446 *p = GetDeviceCaps(hdc, BITSPIXEL);
447 ReleaseDC(0, hdc);
448 return S_OK;
451 static HRESULT WINAPI HTMLScreen_put_bufferDepth(IHTMLScreen *iface, LONG v)
453 HTMLScreen *This = impl_from_IHTMLScreen(iface);
454 FIXME("(%p)->(%d)\n", This, v);
455 return E_NOTIMPL;
458 static HRESULT WINAPI HTMLScreen_get_bufferDepth(IHTMLScreen *iface, LONG *p)
460 HTMLScreen *This = impl_from_IHTMLScreen(iface);
461 FIXME("(%p)->(%p)\n", This, p);
462 return E_NOTIMPL;
465 static HRESULT WINAPI HTMLScreen_get_width(IHTMLScreen *iface, LONG *p)
467 HTMLScreen *This = impl_from_IHTMLScreen(iface);
469 TRACE("(%p)->(%p)\n", This, p);
471 *p = GetSystemMetrics(SM_CXSCREEN);
472 return S_OK;
475 static HRESULT WINAPI HTMLScreen_get_height(IHTMLScreen *iface, LONG *p)
477 HTMLScreen *This = impl_from_IHTMLScreen(iface);
479 TRACE("(%p)->(%p)\n", This, p);
481 *p = GetSystemMetrics(SM_CYSCREEN);
482 return S_OK;
485 static HRESULT WINAPI HTMLScreen_put_updateInterval(IHTMLScreen *iface, LONG v)
487 HTMLScreen *This = impl_from_IHTMLScreen(iface);
488 FIXME("(%p)->(%d)\n", This, v);
489 return E_NOTIMPL;
492 static HRESULT WINAPI HTMLScreen_get_updateInterval(IHTMLScreen *iface, LONG *p)
494 HTMLScreen *This = impl_from_IHTMLScreen(iface);
495 FIXME("(%p)->(%p)\n", This, p);
496 return E_NOTIMPL;
499 static HRESULT WINAPI HTMLScreen_get_availHeight(IHTMLScreen *iface, LONG *p)
501 HTMLScreen *This = impl_from_IHTMLScreen(iface);
502 RECT work_area;
504 TRACE("(%p)->(%p)\n", This, p);
506 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
507 return E_FAIL;
509 *p = work_area.bottom-work_area.top;
510 return S_OK;
513 static HRESULT WINAPI HTMLScreen_get_availWidth(IHTMLScreen *iface, LONG *p)
515 HTMLScreen *This = impl_from_IHTMLScreen(iface);
516 RECT work_area;
518 TRACE("(%p)->(%p)\n", This, p);
520 if(!SystemParametersInfoW(SPI_GETWORKAREA, 0, &work_area, 0))
521 return E_FAIL;
523 *p = work_area.right-work_area.left;
524 return S_OK;
527 static HRESULT WINAPI HTMLScreen_get_fontSmoothingEnabled(IHTMLScreen *iface, VARIANT_BOOL *p)
529 HTMLScreen *This = impl_from_IHTMLScreen(iface);
530 FIXME("(%p)->(%p)\n", This, p);
531 return E_NOTIMPL;
534 static const IHTMLScreenVtbl HTMLSreenVtbl = {
535 HTMLScreen_QueryInterface,
536 HTMLScreen_AddRef,
537 HTMLScreen_Release,
538 HTMLScreen_GetTypeInfoCount,
539 HTMLScreen_GetTypeInfo,
540 HTMLScreen_GetIDsOfNames,
541 HTMLScreen_Invoke,
542 HTMLScreen_get_colorDepth,
543 HTMLScreen_put_bufferDepth,
544 HTMLScreen_get_bufferDepth,
545 HTMLScreen_get_width,
546 HTMLScreen_get_height,
547 HTMLScreen_put_updateInterval,
548 HTMLScreen_get_updateInterval,
549 HTMLScreen_get_availHeight,
550 HTMLScreen_get_availWidth,
551 HTMLScreen_get_fontSmoothingEnabled
554 static const tid_t HTMLScreen_iface_tids[] = {
555 IHTMLScreen_tid,
558 static dispex_static_data_t HTMLScreen_dispex = {
559 NULL,
560 DispHTMLScreen_tid,
561 HTMLScreen_iface_tids
564 HRESULT create_html_screen(compat_mode_t compat_mode, IHTMLScreen **ret)
566 HTMLScreen *screen;
568 screen = heap_alloc_zero(sizeof(HTMLScreen));
569 if(!screen)
570 return E_OUTOFMEMORY;
572 screen->IHTMLScreen_iface.lpVtbl = &HTMLSreenVtbl;
573 screen->ref = 1;
575 init_dispatch(&screen->dispex, (IUnknown*)&screen->IHTMLScreen_iface, &HTMLScreen_dispex, compat_mode);
577 *ret = &screen->IHTMLScreen_iface;
578 return S_OK;
581 static inline OmHistory *impl_from_IOmHistory(IOmHistory *iface)
583 return CONTAINING_RECORD(iface, OmHistory, IOmHistory_iface);
586 static HRESULT WINAPI OmHistory_QueryInterface(IOmHistory *iface, REFIID riid, void **ppv)
588 OmHistory *This = impl_from_IOmHistory(iface);
590 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
592 if(IsEqualGUID(&IID_IUnknown, riid)) {
593 *ppv = &This->IOmHistory_iface;
594 }else if(IsEqualGUID(&IID_IOmHistory, riid)) {
595 *ppv = &This->IOmHistory_iface;
596 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
597 return *ppv ? S_OK : E_NOINTERFACE;
598 }else {
599 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
600 *ppv = NULL;
601 return E_NOINTERFACE;
604 IUnknown_AddRef((IUnknown*)*ppv);
605 return S_OK;
608 static ULONG WINAPI OmHistory_AddRef(IOmHistory *iface)
610 OmHistory *This = impl_from_IOmHistory(iface);
611 LONG ref = InterlockedIncrement(&This->ref);
613 TRACE("(%p) ref=%d\n", This, ref);
615 return ref;
618 static ULONG WINAPI OmHistory_Release(IOmHistory *iface)
620 OmHistory *This = impl_from_IOmHistory(iface);
621 LONG ref = InterlockedDecrement(&This->ref);
623 TRACE("(%p) ref=%d\n", This, ref);
625 if(!ref) {
626 release_dispex(&This->dispex);
627 heap_free(This);
630 return ref;
633 static HRESULT WINAPI OmHistory_GetTypeInfoCount(IOmHistory *iface, UINT *pctinfo)
635 OmHistory *This = impl_from_IOmHistory(iface);
636 FIXME("(%p)->(%p)\n", This, pctinfo);
637 return E_NOTIMPL;
640 static HRESULT WINAPI OmHistory_GetTypeInfo(IOmHistory *iface, UINT iTInfo,
641 LCID lcid, ITypeInfo **ppTInfo)
643 OmHistory *This = impl_from_IOmHistory(iface);
645 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
648 static HRESULT WINAPI OmHistory_GetIDsOfNames(IOmHistory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
649 LCID lcid, DISPID *rgDispId)
651 OmHistory *This = impl_from_IOmHistory(iface);
653 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
654 lcid, rgDispId);
657 static HRESULT WINAPI OmHistory_Invoke(IOmHistory *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
658 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
660 OmHistory *This = impl_from_IOmHistory(iface);
662 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
663 pDispParams, pVarResult, pExcepInfo, puArgErr);
666 static HRESULT WINAPI OmHistory_get_length(IOmHistory *iface, short *p)
668 OmHistory *This = impl_from_IOmHistory(iface);
669 GeckoBrowser *browser = NULL;
671 TRACE("(%p)->(%p)\n", This, p);
673 if(This->window && This->window->base.outer_window)
674 browser = This->window->base.outer_window->browser;
676 *p = browser->doc->travel_log
677 ? ITravelLog_CountEntries(browser->doc->travel_log, browser->doc->browser_service)
678 : 0;
679 return S_OK;
682 static HRESULT WINAPI OmHistory_back(IOmHistory *iface, VARIANT *pvargdistance)
684 OmHistory *This = impl_from_IOmHistory(iface);
685 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
686 return E_NOTIMPL;
689 static HRESULT WINAPI OmHistory_forward(IOmHistory *iface, VARIANT *pvargdistance)
691 OmHistory *This = impl_from_IOmHistory(iface);
692 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
693 return E_NOTIMPL;
696 static HRESULT WINAPI OmHistory_go(IOmHistory *iface, VARIANT *pvargdistance)
698 OmHistory *This = impl_from_IOmHistory(iface);
699 FIXME("(%p)->(%s)\n", This, debugstr_variant(pvargdistance));
700 return E_NOTIMPL;
703 static const IOmHistoryVtbl OmHistoryVtbl = {
704 OmHistory_QueryInterface,
705 OmHistory_AddRef,
706 OmHistory_Release,
707 OmHistory_GetTypeInfoCount,
708 OmHistory_GetTypeInfo,
709 OmHistory_GetIDsOfNames,
710 OmHistory_Invoke,
711 OmHistory_get_length,
712 OmHistory_back,
713 OmHistory_forward,
714 OmHistory_go
717 static const tid_t OmHistory_iface_tids[] = {
718 IOmHistory_tid,
721 static dispex_static_data_t OmHistory_dispex = {
722 NULL,
723 DispHTMLHistory_tid,
724 OmHistory_iface_tids
728 HRESULT create_history(HTMLInnerWindow *window, OmHistory **ret)
730 OmHistory *history;
732 history = heap_alloc_zero(sizeof(*history));
733 if(!history)
734 return E_OUTOFMEMORY;
736 init_dispatch(&history->dispex, (IUnknown*)&history->IOmHistory_iface, &OmHistory_dispex,
737 dispex_compat_mode(&window->event_target.dispex));
738 history->IOmHistory_iface.lpVtbl = &OmHistoryVtbl;
739 history->ref = 1;
741 history->window = window;
743 *ret = history;
744 return S_OK;
747 struct HTMLPluginsCollection {
748 DispatchEx dispex;
749 IHTMLPluginsCollection IHTMLPluginsCollection_iface;
751 LONG ref;
753 OmNavigator *navigator;
756 static inline HTMLPluginsCollection *impl_from_IHTMLPluginsCollection(IHTMLPluginsCollection *iface)
758 return CONTAINING_RECORD(iface, HTMLPluginsCollection, IHTMLPluginsCollection_iface);
761 static HRESULT WINAPI HTMLPluginsCollection_QueryInterface(IHTMLPluginsCollection *iface, REFIID riid, void **ppv)
763 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
765 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
767 if(IsEqualGUID(&IID_IUnknown, riid)) {
768 *ppv = &This->IHTMLPluginsCollection_iface;
769 }else if(IsEqualGUID(&IID_IHTMLPluginsCollection, riid)) {
770 *ppv = &This->IHTMLPluginsCollection_iface;
771 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
772 return *ppv ? S_OK : E_NOINTERFACE;
773 }else {
774 *ppv = NULL;
775 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
776 return E_NOINTERFACE;
779 IUnknown_AddRef((IUnknown*)*ppv);
780 return S_OK;
783 static ULONG WINAPI HTMLPluginsCollection_AddRef(IHTMLPluginsCollection *iface)
785 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
786 LONG ref = InterlockedIncrement(&This->ref);
788 TRACE("(%p) ref=%d\n", This, ref);
790 return ref;
793 static ULONG WINAPI HTMLPluginsCollection_Release(IHTMLPluginsCollection *iface)
795 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
796 LONG ref = InterlockedDecrement(&This->ref);
798 TRACE("(%p) ref=%d\n", This, ref);
800 if(!ref) {
801 if(This->navigator)
802 This->navigator->plugins = NULL;
803 release_dispex(&This->dispex);
804 heap_free(This);
807 return ref;
810 static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfoCount(IHTMLPluginsCollection *iface, UINT *pctinfo)
812 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
813 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
816 static HRESULT WINAPI HTMLPluginsCollection_GetTypeInfo(IHTMLPluginsCollection *iface, UINT iTInfo,
817 LCID lcid, ITypeInfo **ppTInfo)
819 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
820 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
823 static HRESULT WINAPI HTMLPluginsCollection_GetIDsOfNames(IHTMLPluginsCollection *iface, REFIID riid,
824 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
826 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
827 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
828 lcid, rgDispId);
831 static HRESULT WINAPI HTMLPluginsCollection_Invoke(IHTMLPluginsCollection *iface, DISPID dispIdMember,
832 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
833 EXCEPINFO *pExcepInfo, UINT *puArgErr)
835 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
836 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
837 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
840 static HRESULT WINAPI HTMLPluginsCollection_get_length(IHTMLPluginsCollection *iface, LONG *p)
842 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
844 TRACE("(%p)->(%p)\n", This, p);
846 /* IE always returns 0 here */
847 *p = 0;
848 return S_OK;
851 static HRESULT WINAPI HTMLPluginsCollection_refresh(IHTMLPluginsCollection *iface, VARIANT_BOOL reload)
853 HTMLPluginsCollection *This = impl_from_IHTMLPluginsCollection(iface);
855 TRACE("(%p)->(%x)\n", This, reload);
857 /* Nothing to do here. */
858 return S_OK;
861 static const IHTMLPluginsCollectionVtbl HTMLPluginsCollectionVtbl = {
862 HTMLPluginsCollection_QueryInterface,
863 HTMLPluginsCollection_AddRef,
864 HTMLPluginsCollection_Release,
865 HTMLPluginsCollection_GetTypeInfoCount,
866 HTMLPluginsCollection_GetTypeInfo,
867 HTMLPluginsCollection_GetIDsOfNames,
868 HTMLPluginsCollection_Invoke,
869 HTMLPluginsCollection_get_length,
870 HTMLPluginsCollection_refresh
873 static const tid_t HTMLPluginsCollection_iface_tids[] = {
874 IHTMLPluginsCollection_tid,
877 static dispex_static_data_t HTMLPluginsCollection_dispex = {
878 NULL,
879 DispCPlugins_tid,
880 HTMLPluginsCollection_iface_tids
883 static HRESULT create_plugins_collection(OmNavigator *navigator, HTMLPluginsCollection **ret)
885 HTMLPluginsCollection *col;
887 col = heap_alloc_zero(sizeof(*col));
888 if(!col)
889 return E_OUTOFMEMORY;
891 col->IHTMLPluginsCollection_iface.lpVtbl = &HTMLPluginsCollectionVtbl;
892 col->ref = 1;
893 col->navigator = navigator;
895 init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLPluginsCollection_iface,
896 &HTMLPluginsCollection_dispex, dispex_compat_mode(&navigator->dispex));
898 *ret = col;
899 return S_OK;
902 struct HTMLMimeTypesCollection {
903 DispatchEx dispex;
904 IHTMLMimeTypesCollection IHTMLMimeTypesCollection_iface;
906 LONG ref;
908 OmNavigator *navigator;
911 static inline HTMLMimeTypesCollection *impl_from_IHTMLMimeTypesCollection(IHTMLMimeTypesCollection *iface)
913 return CONTAINING_RECORD(iface, HTMLMimeTypesCollection, IHTMLMimeTypesCollection_iface);
916 static HRESULT WINAPI HTMLMimeTypesCollection_QueryInterface(IHTMLMimeTypesCollection *iface, REFIID riid, void **ppv)
918 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
920 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
922 if(IsEqualGUID(&IID_IUnknown, riid)) {
923 *ppv = &This->IHTMLMimeTypesCollection_iface;
924 }else if(IsEqualGUID(&IID_IHTMLMimeTypesCollection, riid)) {
925 *ppv = &This->IHTMLMimeTypesCollection_iface;
926 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
927 return *ppv ? S_OK : E_NOINTERFACE;
928 }else {
929 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
930 *ppv = NULL;
931 return E_NOINTERFACE;
934 IUnknown_AddRef((IUnknown*)*ppv);
935 return S_OK;
938 static ULONG WINAPI HTMLMimeTypesCollection_AddRef(IHTMLMimeTypesCollection *iface)
940 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
941 LONG ref = InterlockedIncrement(&This->ref);
943 TRACE("(%p) ref=%d\n", This, ref);
945 return ref;
948 static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *iface)
950 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
951 LONG ref = InterlockedDecrement(&This->ref);
953 TRACE("(%p) ref=%d\n", This, ref);
955 if(!ref) {
956 if(This->navigator)
957 This->navigator->mime_types = NULL;
958 release_dispex(&This->dispex);
959 heap_free(This);
962 return ref;
965 static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfoCount(IHTMLMimeTypesCollection *iface, UINT *pctinfo)
967 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
968 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
971 static HRESULT WINAPI HTMLMimeTypesCollection_GetTypeInfo(IHTMLMimeTypesCollection *iface, UINT iTInfo,
972 LCID lcid, ITypeInfo **ppTInfo)
974 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
975 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
978 static HRESULT WINAPI HTMLMimeTypesCollection_GetIDsOfNames(IHTMLMimeTypesCollection *iface, REFIID riid,
979 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
981 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
982 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
983 lcid, rgDispId);
986 static HRESULT WINAPI HTMLMimeTypesCollection_Invoke(IHTMLMimeTypesCollection *iface, DISPID dispIdMember,
987 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
988 EXCEPINFO *pExcepInfo, UINT *puArgErr)
990 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
991 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid,
992 wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
995 static HRESULT WINAPI HTMLMimeTypesCollection_get_length(IHTMLMimeTypesCollection *iface, LONG *p)
997 HTMLMimeTypesCollection *This = impl_from_IHTMLMimeTypesCollection(iface);
999 TRACE("(%p)->(%p)\n", This, p);
1001 /* This is just a stub for compatibility with other browser in IE */
1002 *p = 0;
1003 return S_OK;
1006 static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl = {
1007 HTMLMimeTypesCollection_QueryInterface,
1008 HTMLMimeTypesCollection_AddRef,
1009 HTMLMimeTypesCollection_Release,
1010 HTMLMimeTypesCollection_GetTypeInfoCount,
1011 HTMLMimeTypesCollection_GetTypeInfo,
1012 HTMLMimeTypesCollection_GetIDsOfNames,
1013 HTMLMimeTypesCollection_Invoke,
1014 HTMLMimeTypesCollection_get_length
1017 static const tid_t HTMLMimeTypesCollection_iface_tids[] = {
1018 IHTMLMimeTypesCollection_tid,
1021 static dispex_static_data_t HTMLMimeTypesCollection_dispex = {
1022 NULL,
1023 IHTMLMimeTypesCollection_tid,
1024 HTMLMimeTypesCollection_iface_tids
1027 static HRESULT create_mime_types_collection(OmNavigator *navigator, HTMLMimeTypesCollection **ret)
1029 HTMLMimeTypesCollection *col;
1031 col = heap_alloc_zero(sizeof(*col));
1032 if(!col)
1033 return E_OUTOFMEMORY;
1035 col->IHTMLMimeTypesCollection_iface.lpVtbl = &HTMLMimeTypesCollectionVtbl;
1036 col->ref = 1;
1037 col->navigator = navigator;
1039 init_dispatch(&col->dispex, (IUnknown*)&col->IHTMLMimeTypesCollection_iface,
1040 &HTMLMimeTypesCollection_dispex, dispex_compat_mode(&navigator->dispex));
1042 *ret = col;
1043 return S_OK;
1046 static inline OmNavigator *impl_from_IOmNavigator(IOmNavigator *iface)
1048 return CONTAINING_RECORD(iface, OmNavigator, IOmNavigator_iface);
1051 static HRESULT WINAPI OmNavigator_QueryInterface(IOmNavigator *iface, REFIID riid, void **ppv)
1053 OmNavigator *This = impl_from_IOmNavigator(iface);
1055 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1057 if(IsEqualGUID(&IID_IUnknown, riid)) {
1058 *ppv = &This->IOmNavigator_iface;
1059 }else if(IsEqualGUID(&IID_IOmNavigator, riid)) {
1060 *ppv = &This->IOmNavigator_iface;
1061 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1062 return *ppv ? S_OK : E_NOINTERFACE;
1063 }else {
1064 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1065 *ppv = NULL;
1066 return E_NOINTERFACE;
1069 IUnknown_AddRef((IUnknown*)*ppv);
1070 return S_OK;
1073 static ULONG WINAPI OmNavigator_AddRef(IOmNavigator *iface)
1075 OmNavigator *This = impl_from_IOmNavigator(iface);
1076 LONG ref = InterlockedIncrement(&This->ref);
1078 TRACE("(%p) ref=%d\n", This, ref);
1080 return ref;
1083 static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
1085 OmNavigator *This = impl_from_IOmNavigator(iface);
1086 LONG ref = InterlockedDecrement(&This->ref);
1088 TRACE("(%p) ref=%d\n", This, ref);
1090 if(!ref) {
1091 if(This->plugins)
1092 This->plugins->navigator = NULL;
1093 if(This->mime_types)
1094 This->mime_types->navigator = NULL;
1095 release_dispex(&This->dispex);
1096 heap_free(This);
1099 return ref;
1102 static HRESULT WINAPI OmNavigator_GetTypeInfoCount(IOmNavigator *iface, UINT *pctinfo)
1104 OmNavigator *This = impl_from_IOmNavigator(iface);
1105 FIXME("(%p)->(%p)\n", This, pctinfo);
1106 return E_NOTIMPL;
1109 static HRESULT WINAPI OmNavigator_GetTypeInfo(IOmNavigator *iface, UINT iTInfo,
1110 LCID lcid, ITypeInfo **ppTInfo)
1112 OmNavigator *This = impl_from_IOmNavigator(iface);
1114 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1117 static HRESULT WINAPI OmNavigator_GetIDsOfNames(IOmNavigator *iface, REFIID riid,
1118 LPOLESTR *rgszNames, UINT cNames,
1119 LCID lcid, DISPID *rgDispId)
1121 OmNavigator *This = impl_from_IOmNavigator(iface);
1123 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1124 lcid, rgDispId);
1127 static HRESULT WINAPI OmNavigator_Invoke(IOmNavigator *iface, DISPID dispIdMember,
1128 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1129 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1131 OmNavigator *This = impl_from_IOmNavigator(iface);
1133 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1134 pDispParams, pVarResult, pExcepInfo, puArgErr);
1137 static HRESULT WINAPI OmNavigator_get_appCodeName(IOmNavigator *iface, BSTR *p)
1139 OmNavigator *This = impl_from_IOmNavigator(iface);
1141 TRACE("(%p)->(%p)\n", This, p);
1143 *p = SysAllocString(L"Mozilla");
1144 return S_OK;
1147 static HRESULT WINAPI OmNavigator_get_appName(IOmNavigator *iface, BSTR *p)
1149 OmNavigator *This = impl_from_IOmNavigator(iface);
1151 TRACE("(%p)->(%p)\n", This, p);
1153 *p = SysAllocString(dispex_compat_mode(&This->dispex) == COMPAT_MODE_IE11
1154 ? L"Netscape" : L"Microsoft Internet Explorer");
1155 if(!*p)
1156 return E_OUTOFMEMORY;
1158 return S_OK;
1161 static unsigned int get_ua_version(OmNavigator *navigator)
1163 switch(dispex_compat_mode(&navigator->dispex)) {
1164 case COMPAT_MODE_QUIRKS:
1165 case COMPAT_MODE_IE5:
1166 case COMPAT_MODE_IE7:
1167 return 7;
1168 case COMPAT_MODE_IE8:
1169 return 8;
1170 case COMPAT_MODE_IE9:
1171 return 9;
1172 case COMPAT_MODE_IE10:
1173 return 10;
1174 case COMPAT_MODE_IE11:
1175 return 11;
1177 assert(0);
1178 return 0;
1181 static HRESULT WINAPI OmNavigator_get_appVersion(IOmNavigator *iface, BSTR *p)
1183 OmNavigator *This = impl_from_IOmNavigator(iface);
1185 char user_agent[512];
1186 DWORD size;
1187 HRESULT hres;
1188 const unsigned skip_prefix = 8; /* strlen("Mozilla/") */
1190 TRACE("(%p)->(%p)\n", This, p);
1192 size = sizeof(user_agent);
1193 hres = ObtainUserAgentString(get_ua_version(This), user_agent, &size);
1194 if(FAILED(hres))
1195 return hres;
1197 if(size <= skip_prefix) {
1198 *p = NULL;
1199 return S_OK;
1202 size = MultiByteToWideChar(CP_ACP, 0, user_agent + skip_prefix, -1, NULL, 0);
1203 *p = SysAllocStringLen(NULL, size-1);
1204 if(!*p)
1205 return E_OUTOFMEMORY;
1207 MultiByteToWideChar(CP_ACP, 0, user_agent + skip_prefix, -1, *p, size);
1208 return S_OK;
1211 static HRESULT WINAPI OmNavigator_get_userAgent(IOmNavigator *iface, BSTR *p)
1213 OmNavigator *This = impl_from_IOmNavigator(iface);
1214 char user_agent[512];
1215 DWORD size;
1216 HRESULT hres;
1218 TRACE("(%p)->(%p)\n", This, p);
1220 size = sizeof(user_agent);
1221 hres = ObtainUserAgentString(get_ua_version(This), user_agent, &size);
1222 if(FAILED(hres))
1223 return hres;
1225 size = MultiByteToWideChar(CP_ACP, 0, user_agent, -1, NULL, 0);
1226 *p = SysAllocStringLen(NULL, size-1);
1227 if(!*p)
1228 return E_OUTOFMEMORY;
1230 MultiByteToWideChar(CP_ACP, 0, user_agent, -1, *p, size);
1231 return S_OK;
1234 static HRESULT WINAPI OmNavigator_javaEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
1236 OmNavigator *This = impl_from_IOmNavigator(iface);
1238 FIXME("(%p)->(%p) semi-stub\n", This, enabled);
1240 *enabled = VARIANT_TRUE;
1241 return S_OK;
1244 static HRESULT WINAPI OmNavigator_taintEnabled(IOmNavigator *iface, VARIANT_BOOL *enabled)
1246 OmNavigator *This = impl_from_IOmNavigator(iface);
1247 FIXME("(%p)->(%p)\n", This, enabled);
1248 return E_NOTIMPL;
1251 static HRESULT WINAPI OmNavigator_get_mimeTypes(IOmNavigator *iface, IHTMLMimeTypesCollection **p)
1253 OmNavigator *This = impl_from_IOmNavigator(iface);
1255 TRACE("(%p)->(%p)\n", This, p);
1257 if(!This->mime_types) {
1258 HRESULT hres;
1260 hres = create_mime_types_collection(This, &This->mime_types);
1261 if(FAILED(hres))
1262 return hres;
1263 }else {
1264 IHTMLMimeTypesCollection_AddRef(&This->mime_types->IHTMLMimeTypesCollection_iface);
1267 *p = &This->mime_types->IHTMLMimeTypesCollection_iface;
1268 return S_OK;
1271 static HRESULT WINAPI OmNavigator_get_plugins(IOmNavigator *iface, IHTMLPluginsCollection **p)
1273 OmNavigator *This = impl_from_IOmNavigator(iface);
1275 TRACE("(%p)->(%p)\n", This, p);
1277 if(!This->plugins) {
1278 HRESULT hres;
1280 hres = create_plugins_collection(This, &This->plugins);
1281 if(FAILED(hres))
1282 return hres;
1283 }else {
1284 IHTMLPluginsCollection_AddRef(&This->plugins->IHTMLPluginsCollection_iface);
1287 *p = &This->plugins->IHTMLPluginsCollection_iface;
1288 return S_OK;
1291 static HRESULT WINAPI OmNavigator_get_cookieEnabled(IOmNavigator *iface, VARIANT_BOOL *p)
1293 OmNavigator *This = impl_from_IOmNavigator(iface);
1295 WARN("(%p)->(%p) semi-stub\n", This, p);
1297 *p = VARIANT_TRUE;
1298 return S_OK;
1301 static HRESULT WINAPI OmNavigator_get_opsProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
1303 OmNavigator *This = impl_from_IOmNavigator(iface);
1304 FIXME("(%p)->(%p)\n", This, p);
1305 return E_NOTIMPL;
1308 static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String)
1310 OmNavigator *This = impl_from_IOmNavigator(iface);
1312 TRACE("(%p)->(%p)\n", This, String);
1314 if(!String)
1315 return E_INVALIDARG;
1317 *String = SysAllocString(dispex_compat_mode(&This->dispex) < COMPAT_MODE_IE9
1318 ? L"[object]" : L"[object Navigator]");
1319 return *String ? S_OK : E_OUTOFMEMORY;
1322 static HRESULT WINAPI OmNavigator_get_cpuClass(IOmNavigator *iface, BSTR *p)
1324 OmNavigator *This = impl_from_IOmNavigator(iface);
1326 TRACE("(%p)->(%p)\n", This, p);
1328 #ifdef _WIN64
1329 *p = SysAllocString(L"x64");
1330 #else
1331 *p = SysAllocString(L"x86");
1332 #endif
1333 return *p ? S_OK : E_OUTOFMEMORY;
1336 static HRESULT get_language_string(LCID lcid, BSTR *p)
1338 BSTR ret;
1339 int len;
1341 len = LCIDToLocaleName(lcid, NULL, 0, 0);
1342 if(!len) {
1343 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
1344 return E_FAIL;
1347 ret = SysAllocStringLen(NULL, len-1);
1348 if(!ret)
1349 return E_OUTOFMEMORY;
1351 len = LCIDToLocaleName(lcid, ret, len, 0);
1352 if(!len) {
1353 WARN("LCIDToLocaleName failed: %u\n", GetLastError());
1354 SysFreeString(ret);
1355 return E_FAIL;
1358 *p = ret;
1359 return S_OK;
1362 static HRESULT WINAPI OmNavigator_get_systemLanguage(IOmNavigator *iface, BSTR *p)
1364 OmNavigator *This = impl_from_IOmNavigator(iface);
1366 TRACE("(%p)->(%p)\n", This, p);
1368 return get_language_string(LOCALE_SYSTEM_DEFAULT, p);
1371 static HRESULT WINAPI OmNavigator_get_browserLanguage(IOmNavigator *iface, BSTR *p)
1373 OmNavigator *This = impl_from_IOmNavigator(iface);
1375 TRACE("(%p)->(%p)\n", This, p);
1377 return get_language_string(GetUserDefaultUILanguage(), p);
1380 static HRESULT WINAPI OmNavigator_get_userLanguage(IOmNavigator *iface, BSTR *p)
1382 OmNavigator *This = impl_from_IOmNavigator(iface);
1384 TRACE("(%p)->(%p)\n", This, p);
1386 return get_language_string(LOCALE_USER_DEFAULT, p);
1389 static HRESULT WINAPI OmNavigator_get_platform(IOmNavigator *iface, BSTR *p)
1391 OmNavigator *This = impl_from_IOmNavigator(iface);
1393 TRACE("(%p)->(%p)\n", This, p);
1395 #ifdef _WIN64
1396 *p = SysAllocString(L"Win64");
1397 #else
1398 *p = SysAllocString(L"Win32");
1399 #endif
1400 return S_OK;
1403 static HRESULT WINAPI OmNavigator_get_appMinorVersion(IOmNavigator *iface, BSTR *p)
1405 OmNavigator *This = impl_from_IOmNavigator(iface);
1407 TRACE("(%p)->(%p)\n", This, p);
1409 /* NOTE: MSIE returns "0" or values like ";SP2;". Returning "0" should be enough. */
1410 *p = SysAllocString(L"0");
1411 return S_OK;
1414 static HRESULT WINAPI OmNavigator_get_connectionSpeed(IOmNavigator *iface, LONG *p)
1416 OmNavigator *This = impl_from_IOmNavigator(iface);
1417 FIXME("(%p)->(%p)\n", This, p);
1418 return E_NOTIMPL;
1421 static HRESULT WINAPI OmNavigator_get_onLine(IOmNavigator *iface, VARIANT_BOOL *p)
1423 OmNavigator *This = impl_from_IOmNavigator(iface);
1425 WARN("(%p)->(%p) semi-stub, returning true\n", This, p);
1427 *p = VARIANT_TRUE;
1428 return S_OK;
1431 static HRESULT WINAPI OmNavigator_get_userProfile(IOmNavigator *iface, IHTMLOpsProfile **p)
1433 OmNavigator *This = impl_from_IOmNavigator(iface);
1434 FIXME("(%p)->(%p)\n", This, p);
1435 return E_NOTIMPL;
1438 static const IOmNavigatorVtbl OmNavigatorVtbl = {
1439 OmNavigator_QueryInterface,
1440 OmNavigator_AddRef,
1441 OmNavigator_Release,
1442 OmNavigator_GetTypeInfoCount,
1443 OmNavigator_GetTypeInfo,
1444 OmNavigator_GetIDsOfNames,
1445 OmNavigator_Invoke,
1446 OmNavigator_get_appCodeName,
1447 OmNavigator_get_appName,
1448 OmNavigator_get_appVersion,
1449 OmNavigator_get_userAgent,
1450 OmNavigator_javaEnabled,
1451 OmNavigator_taintEnabled,
1452 OmNavigator_get_mimeTypes,
1453 OmNavigator_get_plugins,
1454 OmNavigator_get_cookieEnabled,
1455 OmNavigator_get_opsProfile,
1456 OmNavigator_toString,
1457 OmNavigator_get_cpuClass,
1458 OmNavigator_get_systemLanguage,
1459 OmNavigator_get_browserLanguage,
1460 OmNavigator_get_userLanguage,
1461 OmNavigator_get_platform,
1462 OmNavigator_get_appMinorVersion,
1463 OmNavigator_get_connectionSpeed,
1464 OmNavigator_get_onLine,
1465 OmNavigator_get_userProfile
1468 static const tid_t OmNavigator_iface_tids[] = {
1469 IOmNavigator_tid,
1472 static dispex_static_data_t OmNavigator_dispex = {
1473 NULL,
1474 DispHTMLNavigator_tid,
1475 OmNavigator_iface_tids
1478 HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator)
1480 OmNavigator *ret;
1482 ret = heap_alloc_zero(sizeof(*ret));
1483 if(!ret)
1484 return E_OUTOFMEMORY;
1486 ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl;
1487 ret->ref = 1;
1489 init_dispatch(&ret->dispex, (IUnknown*)&ret->IOmNavigator_iface, &OmNavigator_dispex, compat_mode);
1491 *navigator = &ret->IOmNavigator_iface;
1492 return S_OK;
1495 typedef struct {
1496 DispatchEx dispex;
1497 IHTMLPerformanceTiming IHTMLPerformanceTiming_iface;
1499 LONG ref;
1500 } HTMLPerformanceTiming;
1502 static inline HTMLPerformanceTiming *impl_from_IHTMLPerformanceTiming(IHTMLPerformanceTiming *iface)
1504 return CONTAINING_RECORD(iface, HTMLPerformanceTiming, IHTMLPerformanceTiming_iface);
1507 static HRESULT WINAPI HTMLPerformanceTiming_QueryInterface(IHTMLPerformanceTiming *iface, REFIID riid, void **ppv)
1509 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1511 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1513 if(IsEqualGUID(&IID_IUnknown, riid)) {
1514 *ppv = &This->IHTMLPerformanceTiming_iface;
1515 }else if(IsEqualGUID(&IID_IHTMLPerformanceTiming, riid)) {
1516 *ppv = &This->IHTMLPerformanceTiming_iface;
1517 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1518 return *ppv ? S_OK : E_NOINTERFACE;
1519 }else {
1520 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1521 *ppv = NULL;
1522 return E_NOINTERFACE;
1525 IUnknown_AddRef((IUnknown*)*ppv);
1526 return S_OK;
1529 static ULONG WINAPI HTMLPerformanceTiming_AddRef(IHTMLPerformanceTiming *iface)
1531 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1532 LONG ref = InterlockedIncrement(&This->ref);
1534 TRACE("(%p) ref=%d\n", This, ref);
1536 return ref;
1539 static ULONG WINAPI HTMLPerformanceTiming_Release(IHTMLPerformanceTiming *iface)
1541 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1542 LONG ref = InterlockedDecrement(&This->ref);
1544 TRACE("(%p) ref=%d\n", This, ref);
1546 if(!ref) {
1547 release_dispex(&This->dispex);
1548 heap_free(This);
1551 return ref;
1554 static HRESULT WINAPI HTMLPerformanceTiming_GetTypeInfoCount(IHTMLPerformanceTiming *iface, UINT *pctinfo)
1556 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1557 FIXME("(%p)->(%p)\n", This, pctinfo);
1558 return E_NOTIMPL;
1561 static HRESULT WINAPI HTMLPerformanceTiming_GetTypeInfo(IHTMLPerformanceTiming *iface, UINT iTInfo,
1562 LCID lcid, ITypeInfo **ppTInfo)
1564 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1566 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1569 static HRESULT WINAPI HTMLPerformanceTiming_GetIDsOfNames(IHTMLPerformanceTiming *iface, REFIID riid,
1570 LPOLESTR *rgszNames, UINT cNames,
1571 LCID lcid, DISPID *rgDispId)
1573 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1575 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1576 lcid, rgDispId);
1579 static HRESULT WINAPI HTMLPerformanceTiming_Invoke(IHTMLPerformanceTiming *iface, DISPID dispIdMember,
1580 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1581 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1583 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1585 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1586 pDispParams, pVarResult, pExcepInfo, puArgErr);
1589 #define TIMING_FAKE_TIMESTAMP 0xdeadbeef
1591 static HRESULT WINAPI HTMLPerformanceTiming_get_navigationStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1593 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1595 FIXME("(%p)->(%p) returning fake value\n", This, p);
1597 *p = TIMING_FAKE_TIMESTAMP;
1598 return S_OK;
1601 static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1603 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1605 FIXME("(%p)->(%p) returning fake value\n", This, p);
1607 *p = TIMING_FAKE_TIMESTAMP;
1608 return S_OK;
1611 static HRESULT WINAPI HTMLPerformanceTiming_get_unloadEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1613 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1615 FIXME("(%p)->(%p) returning fake value\n", This, p);
1617 *p = TIMING_FAKE_TIMESTAMP;
1618 return S_OK;
1621 static HRESULT WINAPI HTMLPerformanceTiming_get_redirectStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1623 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1625 FIXME("(%p)->(%p) returning fake value\n", This, p);
1627 *p = TIMING_FAKE_TIMESTAMP;
1628 return S_OK;
1631 static HRESULT WINAPI HTMLPerformanceTiming_get_redirectEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1633 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1635 FIXME("(%p)->(%p) returning fake value\n", This, p);
1637 *p = TIMING_FAKE_TIMESTAMP;
1638 return S_OK;
1641 static HRESULT WINAPI HTMLPerformanceTiming_get_fetchStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1643 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1645 FIXME("(%p)->(%p) returning fake value\n", This, p);
1647 *p = TIMING_FAKE_TIMESTAMP;
1648 return S_OK;
1651 static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1653 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1655 FIXME("(%p)->(%p) returning fake value\n", This, p);
1657 *p = TIMING_FAKE_TIMESTAMP;
1658 return S_OK;
1661 static HRESULT WINAPI HTMLPerformanceTiming_get_domainLookupEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1663 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1665 FIXME("(%p)->(%p) returning fake value\n", This, p);
1667 *p = TIMING_FAKE_TIMESTAMP;
1668 return S_OK;
1671 static HRESULT WINAPI HTMLPerformanceTiming_get_connectStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1673 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1675 FIXME("(%p)->(%p) returning fake value\n", This, p);
1677 *p = TIMING_FAKE_TIMESTAMP;
1678 return S_OK;
1681 static HRESULT WINAPI HTMLPerformanceTiming_get_connectEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1683 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1685 FIXME("(%p)->(%p) returning fake value\n", This, p);
1687 *p = TIMING_FAKE_TIMESTAMP;
1688 return S_OK;
1691 static HRESULT WINAPI HTMLPerformanceTiming_get_requestStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1693 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1695 FIXME("(%p)->(%p) returning fake value\n", This, p);
1697 *p = TIMING_FAKE_TIMESTAMP;
1698 return S_OK;
1701 static HRESULT WINAPI HTMLPerformanceTiming_get_responseStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1703 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1705 FIXME("(%p)->(%p) returning fake value\n", This, p);
1707 *p = TIMING_FAKE_TIMESTAMP;
1708 return S_OK;
1711 static HRESULT WINAPI HTMLPerformanceTiming_get_responseEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1713 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1715 FIXME("(%p)->(%p) returning fake value\n", This, p);
1717 *p = TIMING_FAKE_TIMESTAMP;
1718 return S_OK;
1721 static HRESULT WINAPI HTMLPerformanceTiming_get_domLoading(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1723 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1725 FIXME("(%p)->(%p) returning fake value\n", This, p);
1727 *p = TIMING_FAKE_TIMESTAMP;
1728 return S_OK;
1731 static HRESULT WINAPI HTMLPerformanceTiming_get_domInteractive(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1733 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1735 FIXME("(%p)->(%p) returning fake value\n", This, p);
1737 *p = TIMING_FAKE_TIMESTAMP;
1738 return S_OK;
1741 static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1743 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1745 FIXME("(%p)->(%p) returning fake value\n", This, p);
1747 *p = TIMING_FAKE_TIMESTAMP;
1748 return S_OK;
1751 static HRESULT WINAPI HTMLPerformanceTiming_get_domContentLoadedEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1753 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1755 FIXME("(%p)->(%p) returning fake value\n", This, p);
1757 *p = TIMING_FAKE_TIMESTAMP;
1758 return S_OK;
1761 static HRESULT WINAPI HTMLPerformanceTiming_get_domComplete(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1763 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1765 FIXME("(%p)->(%p) returning fake value\n", This, p);
1767 *p = TIMING_FAKE_TIMESTAMP;
1768 return S_OK;
1771 static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventStart(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1773 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1775 FIXME("(%p)->(%p) returning fake value\n", This, p);
1777 *p = TIMING_FAKE_TIMESTAMP;
1778 return S_OK;
1781 static HRESULT WINAPI HTMLPerformanceTiming_get_loadEventEnd(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1783 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1785 FIXME("(%p)->(%p) returning fake value\n", This, p);
1787 *p = TIMING_FAKE_TIMESTAMP;
1788 return S_OK;
1791 static HRESULT WINAPI HTMLPerformanceTiming_get_msFirstPaint(IHTMLPerformanceTiming *iface, ULONGLONG *p)
1793 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1795 FIXME("(%p)->(%p) returning fake value\n", This, p);
1797 *p = TIMING_FAKE_TIMESTAMP;
1798 return S_OK;
1801 static HRESULT WINAPI HTMLPerformanceTiming_toString(IHTMLPerformanceTiming *iface, BSTR *string)
1803 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1804 FIXME("(%p)->(%p)\n", This, string);
1805 return E_NOTIMPL;
1808 static HRESULT WINAPI HTMLPerformanceTiming_toJSON(IHTMLPerformanceTiming *iface, VARIANT *p)
1810 HTMLPerformanceTiming *This = impl_from_IHTMLPerformanceTiming(iface);
1811 FIXME("(%p)->(%p)\n", This, p);
1812 return E_NOTIMPL;
1815 static const IHTMLPerformanceTimingVtbl HTMLPerformanceTimingVtbl = {
1816 HTMLPerformanceTiming_QueryInterface,
1817 HTMLPerformanceTiming_AddRef,
1818 HTMLPerformanceTiming_Release,
1819 HTMLPerformanceTiming_GetTypeInfoCount,
1820 HTMLPerformanceTiming_GetTypeInfo,
1821 HTMLPerformanceTiming_GetIDsOfNames,
1822 HTMLPerformanceTiming_Invoke,
1823 HTMLPerformanceTiming_get_navigationStart,
1824 HTMLPerformanceTiming_get_unloadEventStart,
1825 HTMLPerformanceTiming_get_unloadEventEnd,
1826 HTMLPerformanceTiming_get_redirectStart,
1827 HTMLPerformanceTiming_get_redirectEnd,
1828 HTMLPerformanceTiming_get_fetchStart,
1829 HTMLPerformanceTiming_get_domainLookupStart,
1830 HTMLPerformanceTiming_get_domainLookupEnd,
1831 HTMLPerformanceTiming_get_connectStart,
1832 HTMLPerformanceTiming_get_connectEnd,
1833 HTMLPerformanceTiming_get_requestStart,
1834 HTMLPerformanceTiming_get_responseStart,
1835 HTMLPerformanceTiming_get_responseEnd,
1836 HTMLPerformanceTiming_get_domLoading,
1837 HTMLPerformanceTiming_get_domInteractive,
1838 HTMLPerformanceTiming_get_domContentLoadedEventStart,
1839 HTMLPerformanceTiming_get_domContentLoadedEventEnd,
1840 HTMLPerformanceTiming_get_domComplete,
1841 HTMLPerformanceTiming_get_loadEventStart,
1842 HTMLPerformanceTiming_get_loadEventEnd,
1843 HTMLPerformanceTiming_get_msFirstPaint,
1844 HTMLPerformanceTiming_toString,
1845 HTMLPerformanceTiming_toJSON
1848 static const tid_t HTMLPerformanceTiming_iface_tids[] = {
1849 IHTMLPerformanceTiming_tid,
1852 static dispex_static_data_t HTMLPerformanceTiming_dispex = {
1853 NULL,
1854 IHTMLPerformanceTiming_tid,
1855 HTMLPerformanceTiming_iface_tids
1858 typedef struct {
1859 DispatchEx dispex;
1860 IHTMLPerformanceNavigation IHTMLPerformanceNavigation_iface;
1862 LONG ref;
1863 } HTMLPerformanceNavigation;
1865 static inline HTMLPerformanceNavigation *impl_from_IHTMLPerformanceNavigation(IHTMLPerformanceNavigation *iface)
1867 return CONTAINING_RECORD(iface, HTMLPerformanceNavigation, IHTMLPerformanceNavigation_iface);
1870 static HRESULT WINAPI HTMLPerformanceNavigation_QueryInterface(IHTMLPerformanceNavigation *iface, REFIID riid, void **ppv)
1872 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1874 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
1876 if(IsEqualGUID(&IID_IUnknown, riid)) {
1877 *ppv = &This->IHTMLPerformanceNavigation_iface;
1878 }else if(IsEqualGUID(&IID_IHTMLPerformanceNavigation, riid)) {
1879 *ppv = &This->IHTMLPerformanceNavigation_iface;
1880 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
1881 return *ppv ? S_OK : E_NOINTERFACE;
1882 }else {
1883 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
1884 *ppv = NULL;
1885 return E_NOINTERFACE;
1888 IUnknown_AddRef((IUnknown*)*ppv);
1889 return S_OK;
1892 static ULONG WINAPI HTMLPerformanceNavigation_AddRef(IHTMLPerformanceNavigation *iface)
1894 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1895 LONG ref = InterlockedIncrement(&This->ref);
1897 TRACE("(%p) ref=%d\n", This, ref);
1899 return ref;
1902 static ULONG WINAPI HTMLPerformanceNavigation_Release(IHTMLPerformanceNavigation *iface)
1904 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1905 LONG ref = InterlockedDecrement(&This->ref);
1907 TRACE("(%p) ref=%d\n", This, ref);
1909 if(!ref) {
1910 release_dispex(&This->dispex);
1911 heap_free(This);
1914 return ref;
1917 static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfoCount(IHTMLPerformanceNavigation *iface, UINT *pctinfo)
1919 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1920 FIXME("(%p)->(%p)\n", This, pctinfo);
1921 return E_NOTIMPL;
1924 static HRESULT WINAPI HTMLPerformanceNavigation_GetTypeInfo(IHTMLPerformanceNavigation *iface, UINT iTInfo,
1925 LCID lcid, ITypeInfo **ppTInfo)
1927 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1929 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1932 static HRESULT WINAPI HTMLPerformanceNavigation_GetIDsOfNames(IHTMLPerformanceNavigation *iface, REFIID riid,
1933 LPOLESTR *rgszNames, UINT cNames,
1934 LCID lcid, DISPID *rgDispId)
1936 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1938 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
1939 lcid, rgDispId);
1942 static HRESULT WINAPI HTMLPerformanceNavigation_Invoke(IHTMLPerformanceNavigation *iface, DISPID dispIdMember,
1943 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
1944 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
1946 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1948 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
1949 pDispParams, pVarResult, pExcepInfo, puArgErr);
1952 static HRESULT WINAPI HTMLPerformanceNavigation_get_type(IHTMLPerformanceNavigation *iface, ULONG *p)
1954 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1956 FIXME("(%p)->(%p) returning TYPE_NAVIGATE\n", This, p);
1958 *p = 0; /* TYPE_NAVIGATE */
1959 return S_OK;
1962 static HRESULT WINAPI HTMLPerformanceNavigation_get_redirectCount(IHTMLPerformanceNavigation *iface, ULONG *p)
1964 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1965 FIXME("(%p)->(%p)\n", This, p);
1966 return E_NOTIMPL;
1969 static HRESULT WINAPI HTMLPerformanceNavigation_toString(IHTMLPerformanceNavigation *iface, BSTR *string)
1971 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1972 FIXME("(%p)->(%p)\n", This, string);
1973 return E_NOTIMPL;
1976 static HRESULT WINAPI HTMLPerformanceNavigation_toJSON(IHTMLPerformanceNavigation *iface, VARIANT *p)
1978 HTMLPerformanceNavigation *This = impl_from_IHTMLPerformanceNavigation(iface);
1979 FIXME("(%p)->(%p)\n", This, p);
1980 return E_NOTIMPL;
1983 static const IHTMLPerformanceNavigationVtbl HTMLPerformanceNavigationVtbl = {
1984 HTMLPerformanceNavigation_QueryInterface,
1985 HTMLPerformanceNavigation_AddRef,
1986 HTMLPerformanceNavigation_Release,
1987 HTMLPerformanceNavigation_GetTypeInfoCount,
1988 HTMLPerformanceNavigation_GetTypeInfo,
1989 HTMLPerformanceNavigation_GetIDsOfNames,
1990 HTMLPerformanceNavigation_Invoke,
1991 HTMLPerformanceNavigation_get_type,
1992 HTMLPerformanceNavigation_get_redirectCount,
1993 HTMLPerformanceNavigation_toString,
1994 HTMLPerformanceNavigation_toJSON
1997 static const tid_t HTMLPerformanceNavigation_iface_tids[] = {
1998 IHTMLPerformanceNavigation_tid,
2001 static dispex_static_data_t HTMLPerformanceNavigation_dispex = {
2002 NULL,
2003 IHTMLPerformanceNavigation_tid,
2004 HTMLPerformanceNavigation_iface_tids
2007 typedef struct {
2008 DispatchEx dispex;
2009 IHTMLPerformance IHTMLPerformance_iface;
2011 LONG ref;
2013 IHTMLPerformanceNavigation *navigation;
2014 IHTMLPerformanceTiming *timing;
2015 } HTMLPerformance;
2017 static inline HTMLPerformance *impl_from_IHTMLPerformance(IHTMLPerformance *iface)
2019 return CONTAINING_RECORD(iface, HTMLPerformance, IHTMLPerformance_iface);
2022 static HRESULT WINAPI HTMLPerformance_QueryInterface(IHTMLPerformance *iface, REFIID riid, void **ppv)
2024 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2026 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
2028 if(IsEqualGUID(&IID_IUnknown, riid)) {
2029 *ppv = &This->IHTMLPerformance_iface;
2030 }else if(IsEqualGUID(&IID_IHTMLPerformance, riid)) {
2031 *ppv = &This->IHTMLPerformance_iface;
2032 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
2033 return *ppv ? S_OK : E_NOINTERFACE;
2034 }else {
2035 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
2036 *ppv = NULL;
2037 return E_NOINTERFACE;
2040 IUnknown_AddRef((IUnknown*)*ppv);
2041 return S_OK;
2044 static ULONG WINAPI HTMLPerformance_AddRef(IHTMLPerformance *iface)
2046 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2047 LONG ref = InterlockedIncrement(&This->ref);
2049 TRACE("(%p) ref=%d\n", This, ref);
2051 return ref;
2054 static ULONG WINAPI HTMLPerformance_Release(IHTMLPerformance *iface)
2056 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2057 LONG ref = InterlockedDecrement(&This->ref);
2059 TRACE("(%p) ref=%d\n", This, ref);
2061 if(!ref) {
2062 if(This->timing)
2063 IHTMLPerformanceTiming_Release(This->timing);
2064 if(This->navigation)
2065 IHTMLPerformanceNavigation_Release(This->navigation);
2066 release_dispex(&This->dispex);
2067 heap_free(This);
2070 return ref;
2073 static HRESULT WINAPI HTMLPerformance_GetTypeInfoCount(IHTMLPerformance *iface, UINT *pctinfo)
2075 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2076 FIXME("(%p)->(%p)\n", This, pctinfo);
2077 return E_NOTIMPL;
2080 static HRESULT WINAPI HTMLPerformance_GetTypeInfo(IHTMLPerformance *iface, UINT iTInfo,
2081 LCID lcid, ITypeInfo **ppTInfo)
2083 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2085 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2088 static HRESULT WINAPI HTMLPerformance_GetIDsOfNames(IHTMLPerformance *iface, REFIID riid,
2089 LPOLESTR *rgszNames, UINT cNames,
2090 LCID lcid, DISPID *rgDispId)
2092 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2094 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2095 lcid, rgDispId);
2098 static HRESULT WINAPI HTMLPerformance_Invoke(IHTMLPerformance *iface, DISPID dispIdMember,
2099 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2100 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2102 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2104 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2105 pDispParams, pVarResult, pExcepInfo, puArgErr);
2108 static HRESULT WINAPI HTMLPerformance_get_navigation(IHTMLPerformance *iface,
2109 IHTMLPerformanceNavigation **p)
2111 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2113 TRACE("(%p)->(%p)\n", This, p);
2115 if(!This->navigation) {
2116 HTMLPerformanceNavigation *navigation;
2118 navigation = heap_alloc_zero(sizeof(*navigation));
2119 if(!navigation)
2120 return E_OUTOFMEMORY;
2122 navigation->IHTMLPerformanceNavigation_iface.lpVtbl = &HTMLPerformanceNavigationVtbl;
2123 navigation->ref = 1;
2124 init_dispatch(&navigation->dispex, (IUnknown*)&navigation->IHTMLPerformanceNavigation_iface,
2125 &HTMLPerformanceNavigation_dispex, dispex_compat_mode(&This->dispex));
2127 This->navigation = &navigation->IHTMLPerformanceNavigation_iface;
2130 IHTMLPerformanceNavigation_AddRef(*p = This->navigation);
2131 return S_OK;
2134 static HRESULT WINAPI HTMLPerformance_get_timing(IHTMLPerformance *iface, IHTMLPerformanceTiming **p)
2136 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2138 TRACE("(%p)->(%p)\n", This, p);
2140 if(!This->timing) {
2141 HTMLPerformanceTiming *timing;
2143 timing = heap_alloc_zero(sizeof(*timing));
2144 if(!timing)
2145 return E_OUTOFMEMORY;
2147 timing->IHTMLPerformanceTiming_iface.lpVtbl = &HTMLPerformanceTimingVtbl;
2148 timing->ref = 1;
2149 init_dispatch(&timing->dispex, (IUnknown*)&timing->IHTMLPerformanceTiming_iface,
2150 &HTMLPerformanceTiming_dispex, dispex_compat_mode(&This->dispex));
2152 This->timing = &timing->IHTMLPerformanceTiming_iface;
2155 IHTMLPerformanceTiming_AddRef(*p = This->timing);
2156 return S_OK;
2159 static HRESULT WINAPI HTMLPerformance_toString(IHTMLPerformance *iface, BSTR *string)
2161 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2162 FIXME("(%p)->(%p)\n", This, string);
2163 return E_NOTIMPL;
2166 static HRESULT WINAPI HTMLPerformance_toJSON(IHTMLPerformance *iface, VARIANT *var)
2168 HTMLPerformance *This = impl_from_IHTMLPerformance(iface);
2169 FIXME("(%p)->(%p)\n", This, var);
2170 return E_NOTIMPL;
2173 static const IHTMLPerformanceVtbl HTMLPerformanceVtbl = {
2174 HTMLPerformance_QueryInterface,
2175 HTMLPerformance_AddRef,
2176 HTMLPerformance_Release,
2177 HTMLPerformance_GetTypeInfoCount,
2178 HTMLPerformance_GetTypeInfo,
2179 HTMLPerformance_GetIDsOfNames,
2180 HTMLPerformance_Invoke,
2181 HTMLPerformance_get_navigation,
2182 HTMLPerformance_get_timing,
2183 HTMLPerformance_toString,
2184 HTMLPerformance_toJSON
2187 static const tid_t HTMLPerformance_iface_tids[] = {
2188 IHTMLPerformance_tid,
2191 static dispex_static_data_t HTMLPerformance_dispex = {
2192 NULL,
2193 IHTMLPerformance_tid,
2194 HTMLPerformance_iface_tids
2197 HRESULT create_performance(compat_mode_t compat_mode, IHTMLPerformance **ret)
2199 HTMLPerformance *performance;
2201 performance = heap_alloc_zero(sizeof(*performance));
2202 if(!performance)
2203 return E_OUTOFMEMORY;
2205 performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl;
2206 performance->ref = 1;
2208 init_dispatch(&performance->dispex, (IUnknown*)&performance->IHTMLPerformance_iface,
2209 &HTMLPerformance_dispex, compat_mode);
2211 *ret = &performance->IHTMLPerformance_iface;
2212 return S_OK;
2215 typedef struct {
2216 DispatchEx dispex;
2217 IHTMLNamespaceCollection IHTMLNamespaceCollection_iface;
2219 LONG ref;
2220 } HTMLNamespaceCollection;
2222 static inline HTMLNamespaceCollection *impl_from_IHTMLNamespaceCollection(IHTMLNamespaceCollection *iface)
2224 return CONTAINING_RECORD(iface, HTMLNamespaceCollection, IHTMLNamespaceCollection_iface);
2227 static HRESULT WINAPI HTMLNamespaceCollection_QueryInterface(IHTMLNamespaceCollection *iface, REFIID riid, void **ppv)
2229 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2231 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
2233 if(IsEqualGUID(&IID_IUnknown, riid)) {
2234 *ppv = &This->IHTMLNamespaceCollection_iface;
2235 }else if(IsEqualGUID(&IID_IHTMLNamespaceCollection, riid)) {
2236 *ppv = &This->IHTMLNamespaceCollection_iface;
2237 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
2238 return *ppv ? S_OK : E_NOINTERFACE;
2239 }else {
2240 WARN("Unsupported interface %s\n", debugstr_mshtml_guid(riid));
2241 *ppv = NULL;
2242 return E_NOINTERFACE;
2245 IUnknown_AddRef((IUnknown*)*ppv);
2246 return S_OK;
2249 static ULONG WINAPI HTMLNamespaceCollection_AddRef(IHTMLNamespaceCollection *iface)
2251 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2252 LONG ref = InterlockedIncrement(&This->ref);
2254 TRACE("(%p) ref=%d\n", This, ref);
2256 return ref;
2259 static ULONG WINAPI HTMLNamespaceCollection_Release(IHTMLNamespaceCollection *iface)
2261 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2262 LONG ref = InterlockedDecrement(&This->ref);
2264 TRACE("(%p) ref=%d\n", This, ref);
2266 if(!ref) {
2267 release_dispex(&This->dispex);
2268 heap_free(This);
2271 return ref;
2274 static HRESULT WINAPI HTMLNamespaceCollection_GetTypeInfoCount(IHTMLNamespaceCollection *iface, UINT *pctinfo)
2276 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2277 FIXME("(%p)->(%p)\n", This, pctinfo);
2278 return E_NOTIMPL;
2281 static HRESULT WINAPI HTMLNamespaceCollection_GetTypeInfo(IHTMLNamespaceCollection *iface, UINT iTInfo,
2282 LCID lcid, ITypeInfo **ppTInfo)
2284 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2286 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
2289 static HRESULT WINAPI HTMLNamespaceCollection_GetIDsOfNames(IHTMLNamespaceCollection *iface, REFIID riid,
2290 LPOLESTR *rgszNames, UINT cNames,
2291 LCID lcid, DISPID *rgDispId)
2293 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2295 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
2296 lcid, rgDispId);
2299 static HRESULT WINAPI HTMLNamespaceCollection_Invoke(IHTMLNamespaceCollection *iface, DISPID dispIdMember,
2300 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
2301 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
2303 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2305 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
2306 pDispParams, pVarResult, pExcepInfo, puArgErr);
2309 static HRESULT WINAPI HTMLNamespaceCollection_get_length(IHTMLNamespaceCollection *iface, LONG *p)
2311 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2312 FIXME("(%p)->(%p) returning 0\n", This, p);
2313 *p = 0;
2314 return S_OK;
2317 static HRESULT WINAPI HTMLNamespaceCollection_item(IHTMLNamespaceCollection *iface, VARIANT index, IDispatch **p)
2319 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2320 FIXME("(%p)->(%s %p)\n", This, debugstr_variant(&index), p);
2321 return E_NOTIMPL;
2324 static HRESULT WINAPI HTMLNamespaceCollection_add(IHTMLNamespaceCollection *iface, BSTR namespace, BSTR urn,
2325 VARIANT implementation_url, IDispatch **p)
2327 HTMLNamespaceCollection *This = impl_from_IHTMLNamespaceCollection(iface);
2328 FIXME("(%p)->(%s %s %s %p)\n", This, debugstr_w(namespace), debugstr_w(urn), debugstr_variant(&implementation_url), p);
2329 return E_NOTIMPL;
2332 static const IHTMLNamespaceCollectionVtbl HTMLNamespaceCollectionVtbl = {
2333 HTMLNamespaceCollection_QueryInterface,
2334 HTMLNamespaceCollection_AddRef,
2335 HTMLNamespaceCollection_Release,
2336 HTMLNamespaceCollection_GetTypeInfoCount,
2337 HTMLNamespaceCollection_GetTypeInfo,
2338 HTMLNamespaceCollection_GetIDsOfNames,
2339 HTMLNamespaceCollection_Invoke,
2340 HTMLNamespaceCollection_get_length,
2341 HTMLNamespaceCollection_item,
2342 HTMLNamespaceCollection_add
2345 static const tid_t HTMLNamespaceCollection_iface_tids[] = {
2346 IHTMLNamespaceCollection_tid,
2349 static dispex_static_data_t HTMLNamespaceCollection_dispex = {
2350 NULL,
2351 DispHTMLNamespaceCollection_tid,
2352 HTMLNamespaceCollection_iface_tids
2355 HRESULT create_namespace_collection(compat_mode_t compat_mode, IHTMLNamespaceCollection **ret)
2357 HTMLNamespaceCollection *namespaces;
2359 if (!(namespaces = heap_alloc_zero(sizeof(*namespaces))))
2360 return E_OUTOFMEMORY;
2362 namespaces->IHTMLNamespaceCollection_iface.lpVtbl = &HTMLNamespaceCollectionVtbl;
2363 namespaces->ref = 1;
2364 init_dispatch(&namespaces->dispex, (IUnknown*)&namespaces->IHTMLNamespaceCollection_iface,
2365 &HTMLNamespaceCollection_dispex, compat_mode);
2366 *ret = &namespaces->IHTMLNamespaceCollection_iface;
2367 return S_OK;