2 * Copyright 2006-2010 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
31 #define NO_SHLWAPI_REG
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
37 #include "htmlevent.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
43 static struct list window_list
= LIST_INIT(window_list
);
45 static void window_set_docnode(HTMLWindow
*window
, HTMLDocumentNode
*doc_node
)
48 if(window
->doc_obj
&& window
== window
->doc_obj
->basedoc
.window
)
49 window
->doc
->basedoc
.cp_container
.forward_container
= NULL
;
50 detach_events(window
->doc
);
51 abort_document_bindings(window
->doc
);
52 window
->doc
->basedoc
.window
= NULL
;
53 htmldoc_release(&window
->doc
->basedoc
);
55 window
->doc
= doc_node
;
57 htmldoc_addref(&doc_node
->basedoc
);
59 if(window
->doc_obj
&& window
->doc_obj
->basedoc
.window
== window
) {
60 if(window
->doc_obj
->basedoc
.doc_node
)
61 htmldoc_release(&window
->doc_obj
->basedoc
.doc_node
->basedoc
);
62 window
->doc_obj
->basedoc
.doc_node
= doc_node
;
64 htmldoc_addref(&doc_node
->basedoc
);
67 if(doc_node
&& window
->doc_obj
&& window
->doc_obj
->usermode
== EDITMODE
) {
71 static const PRUnichar onW
[] = {'o','n',0};
73 nsAString_Init(&mode_str
, onW
);
74 nsres
= nsIDOMHTMLDocument_SetDesignMode(doc_node
->nsdoc
, &mode_str
);
75 nsAString_Finish(&mode_str
);
77 ERR("SetDesignMode failed: %08x\n", nsres
);
81 static void release_children(HTMLWindow
*This
)
85 while(!list_empty(&This
->children
)) {
86 child
= LIST_ENTRY(list_tail(&This
->children
), HTMLWindow
, sibling_entry
);
88 list_remove(&child
->sibling_entry
);
90 IHTMLWindow2_Release(&child
->IHTMLWindow2_iface
);
94 static HRESULT
get_location(HTMLWindow
*This
, HTMLLocation
**ret
)
97 IHTMLLocation_AddRef(&This
->location
->IHTMLLocation_iface
);
101 hres
= HTMLLocation_Create(This
, &This
->location
);
106 *ret
= This
->location
;
110 void get_top_window(HTMLWindow
*window
, HTMLWindow
**ret
)
114 for(iter
= window
; iter
->parent
; iter
= iter
->parent
);
118 static inline HRESULT
set_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
121 FIXME("No document\n");
125 return set_event_handler(&window
->doc
->body_event_target
, NULL
, window
->doc
, eid
, var
);
128 static inline HRESULT
get_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
131 FIXME("No document\n");
135 return get_event_handler(&window
->doc
->body_event_target
, eid
, var
);
138 static inline HTMLWindow
*impl_from_IHTMLWindow2(IHTMLWindow2
*iface
)
140 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow2_iface
);
143 static HRESULT WINAPI
HTMLWindow2_QueryInterface(IHTMLWindow2
*iface
, REFIID riid
, void **ppv
)
145 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
149 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
150 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
151 *ppv
= &This
->IHTMLWindow2_iface
;
152 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
153 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
154 *ppv
= &This
->IHTMLWindow2_iface
;
155 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
156 TRACE("(%p)->(IID_IDispatchEx %p)\n", This
, ppv
);
157 *ppv
= &This
->IDispatchEx_iface
;
158 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2
, riid
)) {
159 TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This
, ppv
);
160 *ppv
= &This
->IHTMLWindow2_iface
;
161 }else if(IsEqualGUID(&IID_IHTMLWindow2
, riid
)) {
162 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This
, ppv
);
163 *ppv
= &This
->IHTMLWindow2_iface
;
164 }else if(IsEqualGUID(&IID_IHTMLWindow3
, riid
)) {
165 TRACE("(%p)->(IID_IHTMLWindow3 %p)\n", This
, ppv
);
166 *ppv
= &This
->IHTMLWindow3_iface
;
167 }else if(IsEqualGUID(&IID_IHTMLWindow4
, riid
)) {
168 TRACE("(%p)->(IID_IHTMLWindow4 %p)\n", This
, ppv
);
169 *ppv
= &This
->IHTMLWindow4_iface
;
170 }else if(IsEqualGUID(&IID_IHTMLWindow5
, riid
)) {
171 TRACE("(%p)->(IID_IHTMLWindow5 %p)\n", This
, ppv
);
172 *ppv
= &This
->IHTMLWindow5_iface
;
173 }else if(IsEqualGUID(&IID_IHTMLWindow6
, riid
)) {
174 TRACE("(%p)->(IID_IHTMLWindow6 %p)\n", This
, ppv
);
175 *ppv
= &This
->IHTMLWindow6_iface
;
176 }else if(IsEqualGUID(&IID_IHTMLPrivateWindow
, riid
)) {
177 TRACE("(%p)->(IID_IHTMLPrivateWindow %p)\n", This
, ppv
);
178 *ppv
= &This
->IHTMLPrivateWindow_iface
;
179 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
180 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
181 *ppv
= &This
->IServiceProvider_iface
;
182 }else if(IsEqualGUID(&IID_ITravelLogClient
, riid
)) {
183 TRACE("(%p)->(IID_ITravelLogClient %p)\n", This
, ppv
);
184 *ppv
= &This
->ITravelLogClient_iface
;
185 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
186 return *ppv
? S_OK
: E_NOINTERFACE
;
190 IUnknown_AddRef((IUnknown
*)*ppv
);
194 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
195 return E_NOINTERFACE
;
198 static ULONG WINAPI
HTMLWindow2_AddRef(IHTMLWindow2
*iface
)
200 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
201 LONG ref
= InterlockedIncrement(&This
->ref
);
203 TRACE("(%p) ref=%d\n", This
, ref
);
208 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
210 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
211 LONG ref
= InterlockedDecrement(&This
->ref
);
213 TRACE("(%p) ref=%d\n", This
, ref
);
218 remove_target_tasks(This
->task_magic
);
219 set_window_bscallback(This
, NULL
);
220 set_current_mon(This
, NULL
);
221 window_set_docnode(This
, NULL
);
222 release_children(This
);
225 IInternetSecurityManager_Release(This
->secmgr
);
227 if(This
->frame_element
)
228 This
->frame_element
->content_window
= NULL
;
230 if(This
->option_factory
) {
231 This
->option_factory
->window
= NULL
;
232 IHTMLOptionElementFactory_Release(&This
->option_factory
->IHTMLOptionElementFactory_iface
);
235 if(This
->image_factory
) {
236 This
->image_factory
->window
= NULL
;
237 IHTMLImageElementFactory_Release(&This
->image_factory
->IHTMLImageElementFactory_iface
);
241 This
->location
->window
= NULL
;
242 IHTMLLocation_Release(&This
->location
->IHTMLLocation_iface
);
246 IHTMLScreen_Release(This
->screen
);
248 for(i
=0; i
< This
->global_prop_cnt
; i
++)
249 heap_free(This
->global_props
[i
].name
);
251 This
->window_ref
->window
= NULL
;
252 windowref_release(This
->window_ref
);
254 heap_free(This
->global_props
);
255 release_script_hosts(This
);
258 nsIDOMWindow_Release(This
->nswindow
);
260 list_remove(&This
->entry
);
261 release_dispex(&This
->dispex
);
268 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
270 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
272 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
275 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
276 LCID lcid
, ITypeInfo
**ppTInfo
)
278 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
280 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
283 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
284 LPOLESTR
*rgszNames
, UINT cNames
,
285 LCID lcid
, DISPID
*rgDispId
)
287 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
289 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
293 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
294 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
295 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
297 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
299 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
300 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
303 static HRESULT
get_frame_by_index(nsIDOMWindowCollection
*nsFrames
, PRUint32 index
, HTMLWindow
**ret
)
306 nsIDOMWindow
*nsWindow
;
309 nsres
= nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
310 if(NS_FAILED(nsres
)) {
311 FIXME("nsIDOMWindowCollection_GetLength failed: 0x%08x\n", nsres
);
316 return DISP_E_MEMBERNOTFOUND
;
318 nsres
= nsIDOMWindowCollection_Item(nsFrames
, index
, &nsWindow
);
319 if(NS_FAILED(nsres
)) {
320 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
324 *ret
= nswindow_to_window(nsWindow
);
326 nsIDOMWindow_Release(nsWindow
);
331 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
333 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
334 nsIDOMWindowCollection
*nsFrames
;
335 HTMLWindow
*window
= NULL
;
339 TRACE("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
341 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nsFrames
);
342 if(NS_FAILED(nsres
)) {
343 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
347 switch(V_VT(pvarIndex
)) {
349 int index
= V_I4(pvarIndex
);
350 TRACE("Getting index %d\n", index
);
353 hres
= get_frame_by_index(nsFrames
, index
, &window
);
357 unsigned int index
= V_UINT(pvarIndex
);
358 TRACE("Getting index %u\n", index
);
359 hres
= get_frame_by_index(nsFrames
, index
, &window
);
363 BSTR str
= V_BSTR(pvarIndex
);
366 TRACE("Getting name %s\n", wine_dbgstr_w(str
));
368 nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
371 for(i
= 0; i
< length
&& !window
; ++i
) {
372 HTMLWindow
*cur_window
;
373 nsIDOMWindow
*nsWindow
;
376 nsres
= nsIDOMWindowCollection_Item(nsFrames
, i
, &nsWindow
);
377 if(NS_FAILED(nsres
)) {
378 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
383 cur_window
= nswindow_to_window(nsWindow
);
385 nsIDOMWindow_Release(nsWindow
);
387 hres
= IHTMLElement_get_id(&cur_window
->frame_element
->element
.IHTMLElement_iface
, &id
);
389 FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres
);
393 if(!strcmpW(id
, str
))
404 nsIDOMWindowCollection_Release(nsFrames
);
408 return DISP_E_MEMBERNOTFOUND
;
410 IHTMLWindow2_AddRef(&window
->IHTMLWindow2_iface
);
411 V_VT(pvarResult
) = VT_DISPATCH
;
412 V_DISPATCH(pvarResult
) = (IDispatch
*)window
;
416 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, LONG
*p
)
418 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
419 nsIDOMWindowCollection
*nscollection
;
423 TRACE("(%p)->(%p)\n", This
, p
);
425 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nscollection
);
426 if(NS_FAILED(nsres
)) {
427 ERR("GetFrames failed: %08x\n", nsres
);
431 nsres
= nsIDOMWindowCollection_GetLength(nscollection
, &length
);
432 nsIDOMWindowCollection_Release(nscollection
);
433 if(NS_FAILED(nsres
)) {
434 ERR("GetLength failed: %08x\n", nsres
);
442 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
444 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
445 FIXME("(%p)->(%p): semi-stub\n", This
, p
);
447 /* FIXME: Should return a separate Window object */
448 *p
= (IHTMLFramesCollection2
*)&This
->IHTMLWindow2_iface
;
449 HTMLWindow2_AddRef(iface
);
453 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
455 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
456 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
460 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
462 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
463 FIXME("(%p)->(%p)\n", This
, p
);
467 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
469 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
471 WARN("(%p)->(%s)\n", This
, debugstr_w(v
));
474 * FIXME: Since IE7, setting status is blocked, but still possible in certain circumstances.
475 * Ignoring the call should be enough for us.
480 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
482 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
484 TRACE("(%p)->(%p)\n", This
, p
);
491 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
492 LONG msec
, VARIANT
*language
, LONG
*timerID
)
494 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
497 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
499 V_VT(&expr_var
) = VT_BSTR
;
500 V_BSTR(&expr_var
) = expression
;
502 return IHTMLWindow3_setTimeout(&This
->IHTMLWindow3_iface
, &expr_var
, msec
, language
, timerID
);
505 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, LONG timerID
)
507 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
509 TRACE("(%p)->(%d)\n", This
, timerID
);
511 return clear_task_timer(&This
->doc
->basedoc
, FALSE
, timerID
);
514 #define MAX_MESSAGE_LEN 2000
516 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
518 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
519 WCHAR title
[100], *msg
= message
;
522 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
524 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, title
,
525 sizeof(title
)/sizeof(WCHAR
))) {
526 WARN("Could not load message box title: %d\n", GetLastError());
530 len
= SysStringLen(message
);
531 if(len
> MAX_MESSAGE_LEN
) {
532 msg
= heap_alloc((MAX_MESSAGE_LEN
+1)*sizeof(WCHAR
));
534 return E_OUTOFMEMORY
;
535 memcpy(msg
, message
, MAX_MESSAGE_LEN
*sizeof(WCHAR
));
536 msg
[MAX_MESSAGE_LEN
] = 0;
539 MessageBoxW(This
->doc_obj
->hwnd
, msg
, title
, MB_ICONWARNING
);
545 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
546 VARIANT_BOOL
*confirmed
)
548 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
551 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
553 if(!confirmed
) return E_INVALIDARG
;
555 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
556 sizeof(wszTitle
)/sizeof(WCHAR
))) {
557 WARN("Could not load message box title: %d\n", GetLastError());
558 *confirmed
= VARIANT_TRUE
;
562 if(MessageBoxW(This
->doc_obj
->hwnd
, message
, wszTitle
,
563 MB_OKCANCEL
|MB_ICONQUESTION
)==IDOK
)
564 *confirmed
= VARIANT_TRUE
;
565 else *confirmed
= VARIANT_FALSE
;
577 static INT_PTR CALLBACK
prompt_dlgproc(HWND hwnd
, UINT msg
,
578 WPARAM wparam
, LPARAM lparam
)
584 prompt_arg
*arg
= (prompt_arg
*)lparam
;
587 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
588 sizeof(wszTitle
)/sizeof(WCHAR
))) {
589 WARN("Could not load message box title: %d\n", GetLastError());
590 EndDialog(hwnd
, wparam
);
594 SetWindowLongPtrW(hwnd
, DWLP_USER
, lparam
);
595 SetWindowTextW(hwnd
, wszTitle
);
596 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_PROMPT
), arg
->message
);
597 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_EDIT
), arg
->dststr
);
603 case MAKEWPARAM(IDCANCEL
, BN_CLICKED
):
604 EndDialog(hwnd
, wparam
);
606 case MAKEWPARAM(IDOK
, BN_CLICKED
):
609 (prompt_arg
*)GetWindowLongPtrW(hwnd
, DWLP_USER
);
610 HWND hwndPrompt
= GetDlgItem(hwnd
, ID_PROMPT_EDIT
);
611 INT len
= GetWindowTextLengthW(hwndPrompt
);
615 EndDialog(hwnd
, wparam
);
619 V_VT(arg
->textdata
) = VT_BSTR
;
620 if(!len
&& !arg
->dststr
)
621 V_BSTR(arg
->textdata
) = NULL
;
624 V_BSTR(arg
->textdata
) = SysAllocStringLen(NULL
, len
);
625 GetWindowTextW(hwndPrompt
, V_BSTR(arg
->textdata
), len
+1);
627 EndDialog(hwnd
, wparam
);
633 EndDialog(hwnd
, IDCANCEL
);
640 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
641 BSTR dststr
, VARIANT
*textdata
)
643 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
646 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
648 if(textdata
) V_VT(textdata
) = VT_NULL
;
650 arg
.message
= message
;
652 arg
.textdata
= textdata
;
654 DialogBoxParamW(hInst
, MAKEINTRESOURCEW(ID_PROMPT_DIALOG
),
655 This
->doc_obj
->hwnd
, prompt_dlgproc
, (LPARAM
)&arg
);
659 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
661 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
663 TRACE("(%p)->(%p)\n", This
, p
);
665 if(!This
->image_factory
)
666 This
->image_factory
= HTMLImageElementFactory_Create(This
);
668 *p
= &This
->image_factory
->IHTMLImageElementFactory_iface
;
669 IHTMLImageElementFactory_AddRef(*p
);
674 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
676 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
677 HTMLLocation
*location
;
680 TRACE("(%p)->(%p)\n", This
, p
);
682 hres
= get_location(This
, &location
);
686 *p
= &location
->IHTMLLocation_iface
;
690 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
692 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
693 FIXME("(%p)->(%p)\n", This
, p
);
697 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
699 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
700 FIXME("(%p)->()\n", This
);
704 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
706 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
707 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
711 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
713 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
715 FIXME("(%p)->(%p) returning empty\n", This
, p
);
721 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
723 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
725 TRACE("(%p)->(%p)\n", This
, p
);
727 *p
= OmNavigator_Create();
731 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
733 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
737 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
739 nsAString_InitDepend(&name_str
, v
);
740 nsres
= nsIDOMWindow_SetName(This
->nswindow
, &name_str
);
741 nsAString_Finish(&name_str
);
743 ERR("SetName failed: %08x\n", nsres
);
748 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
750 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
754 TRACE("(%p)->(%p)\n", This
, p
);
756 nsAString_Init(&name_str
, NULL
);
757 nsres
= nsIDOMWindow_GetName(This
->nswindow
, &name_str
);
758 return return_nsstr(nsres
, &name_str
, p
);
761 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
763 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
765 TRACE("(%p)->(%p)\n", This
, p
);
768 return IHTMLWindow2_get_self(&This
->IHTMLWindow2_iface
, p
);
770 *p
= &This
->parent
->IHTMLWindow2_iface
;
771 IHTMLWindow2_AddRef(*p
);
775 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
776 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
778 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
779 INewWindowManager
*new_window_mgr
;
783 TRACE("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
784 debugstr_w(features
), replace
, pomWindowResult
);
789 if(name
&& *name
== '_') {
790 FIXME("Unsupported name %s\n", debugstr_w(name
));
794 hres
= do_query_service((IUnknown
*)This
->doc_obj
->client
, &SID_SNewWindowManager
, &IID_INewWindowManager
,
795 (void**)&new_window_mgr
);
797 FIXME("No INewWindowManager\n");
801 hres
= INewWindowManager_EvaluateNewWindow(new_window_mgr
, url
, name
, This
->url
,
802 features
, !!replace
, This
->doc_obj
->has_popup
? 0 : NWMF_FIRST
, 0);
803 INewWindowManager_Release(new_window_mgr
);
804 This
->doc_obj
->has_popup
= TRUE
;
806 *pomWindowResult
= NULL
;
810 hres
= create_relative_uri(This
, url
, &uri
);
814 hres
= navigate_new_window(This
, uri
, name
, pomWindowResult
);
819 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
821 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
823 TRACE("(%p)->(%p)\n", This
, p
);
825 /* FIXME: We should return kind of proxy window here. */
826 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
827 *p
= &This
->IHTMLWindow2_iface
;
831 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
833 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
836 TRACE("(%p)->(%p)\n", This
, p
);
838 get_top_window(This
, &top
);
839 *p
= &top
->IHTMLWindow2_iface
;
840 IHTMLWindow2_AddRef(*p
);
845 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
847 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
849 TRACE("(%p)->(%p)\n", This
, p
);
851 /* FIXME: We should return kind of proxy window here. */
852 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
853 *p
= &This
->IHTMLWindow2_iface
;
857 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
859 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
860 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
864 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
866 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
867 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
871 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
873 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
874 FIXME("(%p)->(%p)\n", This
, p
);
878 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
880 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
881 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
885 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
887 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
888 FIXME("(%p)->(%p)\n", This
, p
);
892 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
894 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
896 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
898 return set_window_event(This
, EVENTID_LOAD
, &v
);
901 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
903 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
905 TRACE("(%p)->(%p)\n", This
, p
);
907 return get_window_event(This
, EVENTID_LOAD
, p
);
910 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
912 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
914 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
916 return set_window_event(This
, EVENTID_BEFOREUNLOAD
, &v
);
919 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
921 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
923 TRACE("(%p)->(%p)\n", This
, p
);
925 return get_window_event(This
, EVENTID_BEFOREUNLOAD
, p
);
928 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
930 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
931 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
935 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
937 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
938 FIXME("(%p)->(%p)\n", This
, p
);
942 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
944 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
945 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
949 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
951 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
952 FIXME("(%p)->(%p)\n", This
, p
);
956 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
958 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
960 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
962 return set_window_event(This
, EVENTID_ERROR
, &v
);
965 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
967 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
969 TRACE("(%p)->(%p)\n", This
, p
);
971 return get_window_event(This
, EVENTID_ERROR
, p
);
974 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
976 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
978 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
980 return set_window_event(This
, EVENTID_RESIZE
, &v
);
983 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
985 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
987 TRACE("(%p)->(%p)\n", This
, p
);
989 return get_window_event(This
, EVENTID_RESIZE
, p
);
992 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
994 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
995 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
999 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
1001 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1002 FIXME("(%p)->(%p)\n", This
, p
);
1006 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
1008 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1010 TRACE("(%p)->(%p)\n", This
, p
);
1013 /* FIXME: We should return a wrapper object here */
1014 *p
= &This
->doc
->basedoc
.IHTMLDocument2_iface
;
1015 IHTMLDocument2_AddRef(*p
);
1023 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
1025 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1027 TRACE("(%p)->(%p)\n", This
, p
);
1030 IHTMLEventObj_AddRef(This
->event
);
1035 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
1037 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1038 FIXME("(%p)->(%p)\n", This
, p
);
1042 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
1043 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
1045 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1046 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
1050 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
1053 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1054 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(helpURL
), debugstr_variant(&helpArg
), debugstr_w(features
));
1058 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
1060 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1062 TRACE("(%p)->(%p)\n", This
, p
);
1067 hres
= HTMLScreen_Create(&This
->screen
);
1073 IHTMLScreen_AddRef(This
->screen
);
1077 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
1079 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1081 TRACE("(%p)->(%p)\n", This
, p
);
1083 if(!This
->option_factory
)
1084 This
->option_factory
= HTMLOptionElementFactory_Create(This
);
1086 *p
= &This
->option_factory
->IHTMLOptionElementFactory_iface
;
1087 IHTMLOptionElementFactory_AddRef(*p
);
1092 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
1094 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1096 TRACE("(%p)->()\n", This
);
1099 SetFocus(This
->doc_obj
->hwnd
);
1103 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
1105 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1106 FIXME("(%p)->(%p)\n", This
, p
);
1110 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
1112 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1113 FIXME("(%p)->()\n", This
);
1117 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1119 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1120 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1124 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
1126 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1127 FIXME("(%p)->(%p)\n", This
, p
);
1131 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
1132 LONG msec
, VARIANT
*language
, LONG
*timerID
)
1134 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1137 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
1139 V_VT(&expr
) = VT_BSTR
;
1140 V_BSTR(&expr
) = expression
;
1141 return IHTMLWindow3_setInterval(&This
->IHTMLWindow3_iface
, &expr
, msec
, language
, timerID
);
1144 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, LONG timerID
)
1146 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1148 TRACE("(%p)->(%d)\n", This
, timerID
);
1150 return clear_task_timer(&This
->doc
->basedoc
, TRUE
, timerID
);
1153 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
1155 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1156 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1160 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
1162 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1163 FIXME("(%p)->(%p)\n", This
, p
);
1167 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
1170 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1172 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
1174 return exec_script(This
, scode
, language
, pvarRet
);
1177 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
1179 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1181 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1183 TRACE("(%p)->(%p)\n", This
, String
);
1186 return E_INVALIDARG
;
1188 *String
= SysAllocString(objectW
);
1189 return *String
? S_OK
: E_OUTOFMEMORY
;
1192 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1194 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1197 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1199 nsres
= nsIDOMWindow_ScrollBy(This
->nswindow
, x
, y
);
1200 if(NS_FAILED(nsres
))
1201 ERR("ScrollBy failed: %08x\n", nsres
);
1206 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1208 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1211 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1213 nsres
= nsIDOMWindow_ScrollTo(This
->nswindow
, x
, y
);
1214 if(NS_FAILED(nsres
))
1215 ERR("ScrollTo failed: %08x\n", nsres
);
1220 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1222 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1223 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1227 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1229 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1230 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1234 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1236 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1237 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1241 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1243 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1244 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1248 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
1250 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1252 TRACE("(%p)->(%p)\n", This
, p
);
1256 if(!This
->doc_obj
->hostui
)
1259 return IDocHostUIHandler_GetExternal(This
->doc_obj
->hostui
, p
);
1262 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
1263 HTMLWindow2_QueryInterface
,
1265 HTMLWindow2_Release
,
1266 HTMLWindow2_GetTypeInfoCount
,
1267 HTMLWindow2_GetTypeInfo
,
1268 HTMLWindow2_GetIDsOfNames
,
1271 HTMLWindow2_get_length
,
1272 HTMLWindow2_get_frames
,
1273 HTMLWindow2_put_defaultStatus
,
1274 HTMLWindow2_get_defaultStatus
,
1275 HTMLWindow2_put_status
,
1276 HTMLWindow2_get_status
,
1277 HTMLWindow2_setTimeout
,
1278 HTMLWindow2_clearTimeout
,
1280 HTMLWindow2_confirm
,
1282 HTMLWindow2_get_Image
,
1283 HTMLWindow2_get_location
,
1284 HTMLWindow2_get_history
,
1286 HTMLWindow2_put_opener
,
1287 HTMLWindow2_get_opener
,
1288 HTMLWindow2_get_navigator
,
1289 HTMLWindow2_put_name
,
1290 HTMLWindow2_get_name
,
1291 HTMLWindow2_get_parent
,
1293 HTMLWindow2_get_self
,
1294 HTMLWindow2_get_top
,
1295 HTMLWindow2_get_window
,
1296 HTMLWindow2_navigate
,
1297 HTMLWindow2_put_onfocus
,
1298 HTMLWindow2_get_onfocus
,
1299 HTMLWindow2_put_onblur
,
1300 HTMLWindow2_get_onblur
,
1301 HTMLWindow2_put_onload
,
1302 HTMLWindow2_get_onload
,
1303 HTMLWindow2_put_onbeforeunload
,
1304 HTMLWindow2_get_onbeforeunload
,
1305 HTMLWindow2_put_onunload
,
1306 HTMLWindow2_get_onunload
,
1307 HTMLWindow2_put_onhelp
,
1308 HTMLWindow2_get_onhelp
,
1309 HTMLWindow2_put_onerror
,
1310 HTMLWindow2_get_onerror
,
1311 HTMLWindow2_put_onresize
,
1312 HTMLWindow2_get_onresize
,
1313 HTMLWindow2_put_onscroll
,
1314 HTMLWindow2_get_onscroll
,
1315 HTMLWindow2_get_document
,
1316 HTMLWindow2_get_event
,
1317 HTMLWindow2_get__newEnum
,
1318 HTMLWindow2_showModalDialog
,
1319 HTMLWindow2_showHelp
,
1320 HTMLWindow2_get_screen
,
1321 HTMLWindow2_get_Option
,
1323 HTMLWindow2_get_closed
,
1326 HTMLWindow2_get_clientInformation
,
1327 HTMLWindow2_setInterval
,
1328 HTMLWindow2_clearInterval
,
1329 HTMLWindow2_put_offscreenBuffering
,
1330 HTMLWindow2_get_offscreenBuffering
,
1331 HTMLWindow2_execScript
,
1332 HTMLWindow2_toString
,
1333 HTMLWindow2_scrollBy
,
1334 HTMLWindow2_scrollTo
,
1337 HTMLWindow2_resizeTo
,
1338 HTMLWindow2_resizeBy
,
1339 HTMLWindow2_get_external
1342 static inline HTMLWindow
*impl_from_IHTMLWindow3(IHTMLWindow3
*iface
)
1344 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow3_iface
);
1347 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
1349 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1351 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1354 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
1356 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1358 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1361 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
1363 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1365 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1368 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
1370 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1372 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1375 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
1376 LCID lcid
, ITypeInfo
**ppTInfo
)
1378 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1380 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1383 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
1384 LPOLESTR
*rgszNames
, UINT cNames
,
1385 LCID lcid
, DISPID
*rgDispId
)
1387 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1389 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1393 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
1394 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1395 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1397 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1399 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1400 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1403 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, LONG
*p
)
1405 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1406 FIXME("(%p)->(%p)\n", This
, p
);
1410 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, LONG
*p
)
1412 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1413 FIXME("(%p)->(%p)\n", This
, p
);
1417 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
1419 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1421 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
1424 FIXME("No document\n");
1428 return attach_event(&This
->doc
->body_event_target
, NULL
, &This
->doc
->basedoc
, event
, pDisp
, pfResult
);
1431 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
1433 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1435 TRACE("(%p)->()\n", This
);
1438 FIXME("No document\n");
1442 return detach_event(This
->doc
->body_event_target
, &This
->doc
->basedoc
, event
, pDisp
);
1445 static HRESULT
window_set_timer(HTMLWindow
*This
, VARIANT
*expr
, LONG msec
, VARIANT
*language
,
1446 BOOL interval
, LONG
*timer_id
)
1448 IDispatch
*disp
= NULL
;
1450 switch(V_VT(expr
)) {
1452 disp
= V_DISPATCH(expr
);
1453 IDispatch_AddRef(disp
);
1457 disp
= script_parse_event(This
, V_BSTR(expr
));
1461 FIXME("unimplemented expr %s\n", debugstr_variant(expr
));
1468 *timer_id
= set_task_timer(&This
->doc
->basedoc
, msec
, interval
, disp
);
1469 IDispatch_Release(disp
);
1474 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1475 VARIANT
*language
, LONG
*timerID
)
1477 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1479 TRACE("(%p)->(%s %d %s %p)\n", This
, debugstr_variant(expression
), msec
, debugstr_variant(language
), timerID
);
1481 return window_set_timer(This
, expression
, msec
, language
, FALSE
, timerID
);
1484 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1485 VARIANT
*language
, LONG
*timerID
)
1487 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1489 TRACE("(%p)->(%p %d %p %p)\n", This
, expression
, msec
, language
, timerID
);
1491 return window_set_timer(This
, expression
, msec
, language
, TRUE
, timerID
);
1494 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
1496 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1497 FIXME("(%p)\n", This
);
1501 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
1503 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1504 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1508 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1510 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1511 FIXME("(%p)->(%p)\n", This
, p
);
1515 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
1517 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1518 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1522 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1524 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1525 FIXME("(%p)->(%p)\n", This
, p
);
1529 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
1531 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1532 FIXME("(%p)->(%p)\n", This
, p
);
1536 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
1537 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
1539 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1540 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
1544 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
1545 HTMLWindow3_QueryInterface
,
1547 HTMLWindow3_Release
,
1548 HTMLWindow3_GetTypeInfoCount
,
1549 HTMLWindow3_GetTypeInfo
,
1550 HTMLWindow3_GetIDsOfNames
,
1552 HTMLWindow3_get_screenLeft
,
1553 HTMLWindow3_get_screenTop
,
1554 HTMLWindow3_attachEvent
,
1555 HTMLWindow3_detachEvent
,
1556 HTMLWindow3_setTimeout
,
1557 HTMLWindow3_setInterval
,
1559 HTMLWindow3_put_onbeforeprint
,
1560 HTMLWindow3_get_onbeforeprint
,
1561 HTMLWindow3_put_onafterprint
,
1562 HTMLWindow3_get_onafterprint
,
1563 HTMLWindow3_get_clipboardData
,
1564 HTMLWindow3_showModelessDialog
1567 static inline HTMLWindow
*impl_from_IHTMLWindow4(IHTMLWindow4
*iface
)
1569 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow4_iface
);
1572 static HRESULT WINAPI
HTMLWindow4_QueryInterface(IHTMLWindow4
*iface
, REFIID riid
, void **ppv
)
1574 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1576 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1579 static ULONG WINAPI
HTMLWindow4_AddRef(IHTMLWindow4
*iface
)
1581 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1583 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1586 static ULONG WINAPI
HTMLWindow4_Release(IHTMLWindow4
*iface
)
1588 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1590 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1593 static HRESULT WINAPI
HTMLWindow4_GetTypeInfoCount(IHTMLWindow4
*iface
, UINT
*pctinfo
)
1595 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1597 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1600 static HRESULT WINAPI
HTMLWindow4_GetTypeInfo(IHTMLWindow4
*iface
, UINT iTInfo
,
1601 LCID lcid
, ITypeInfo
**ppTInfo
)
1603 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1605 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1608 static HRESULT WINAPI
HTMLWindow4_GetIDsOfNames(IHTMLWindow4
*iface
, REFIID riid
,
1609 LPOLESTR
*rgszNames
, UINT cNames
,
1610 LCID lcid
, DISPID
*rgDispId
)
1612 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1614 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1618 static HRESULT WINAPI
HTMLWindow4_Invoke(IHTMLWindow4
*iface
, DISPID dispIdMember
,
1619 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1620 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1622 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1624 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1625 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1628 static HRESULT WINAPI
HTMLWindow4_createPopup(IHTMLWindow4
*iface
, VARIANT
*varArgIn
,
1629 IDispatch
**ppPopup
)
1631 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1632 FIXME("(%p)->(%p %p)\n", This
, varArgIn
, ppPopup
);
1636 static HRESULT WINAPI
HTMLWindow4_get_frameElement(IHTMLWindow4
*iface
, IHTMLFrameBase
**p
)
1638 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1639 TRACE("(%p)->(%p)\n", This
, p
);
1641 if(This
->frame_element
) {
1642 *p
= &This
->frame_element
->IHTMLFrameBase_iface
;
1643 IHTMLFrameBase_AddRef(*p
);
1650 static const IHTMLWindow4Vtbl HTMLWindow4Vtbl
= {
1651 HTMLWindow4_QueryInterface
,
1653 HTMLWindow4_Release
,
1654 HTMLWindow4_GetTypeInfoCount
,
1655 HTMLWindow4_GetTypeInfo
,
1656 HTMLWindow4_GetIDsOfNames
,
1658 HTMLWindow4_createPopup
,
1659 HTMLWindow4_get_frameElement
1662 static inline HTMLWindow
*impl_from_IHTMLWindow5(IHTMLWindow5
*iface
)
1664 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow5_iface
);
1667 static HRESULT WINAPI
HTMLWindow5_QueryInterface(IHTMLWindow5
*iface
, REFIID riid
, void **ppv
)
1669 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1671 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1674 static ULONG WINAPI
HTMLWindow5_AddRef(IHTMLWindow5
*iface
)
1676 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1678 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1681 static ULONG WINAPI
HTMLWindow5_Release(IHTMLWindow5
*iface
)
1683 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1685 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1688 static HRESULT WINAPI
HTMLWindow5_GetTypeInfoCount(IHTMLWindow5
*iface
, UINT
*pctinfo
)
1690 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1692 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1695 static HRESULT WINAPI
HTMLWindow5_GetTypeInfo(IHTMLWindow5
*iface
, UINT iTInfo
,
1696 LCID lcid
, ITypeInfo
**ppTInfo
)
1698 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1700 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1703 static HRESULT WINAPI
HTMLWindow5_GetIDsOfNames(IHTMLWindow5
*iface
, REFIID riid
,
1704 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1706 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1708 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1712 static HRESULT WINAPI
HTMLWindow5_Invoke(IHTMLWindow5
*iface
, DISPID dispIdMember
,
1713 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1714 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1716 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1718 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1719 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1722 static HRESULT WINAPI
HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT v
)
1724 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1725 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1729 static HRESULT WINAPI
HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT
*p
)
1731 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1732 FIXME("(%p)->(%p)\n", This
, p
);
1736 static const IHTMLWindow5Vtbl HTMLWindow5Vtbl
= {
1737 HTMLWindow5_QueryInterface
,
1739 HTMLWindow5_Release
,
1740 HTMLWindow5_GetTypeInfoCount
,
1741 HTMLWindow5_GetTypeInfo
,
1742 HTMLWindow5_GetIDsOfNames
,
1744 HTMLWindow5_put_XMLHttpRequest
,
1745 HTMLWindow5_get_XMLHttpRequest
1748 static inline HTMLWindow
*impl_from_IHTMLWindow6(IHTMLWindow6
*iface
)
1750 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow6_iface
);
1753 static HRESULT WINAPI
HTMLWindow6_QueryInterface(IHTMLWindow6
*iface
, REFIID riid
, void **ppv
)
1755 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1757 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1760 static ULONG WINAPI
HTMLWindow6_AddRef(IHTMLWindow6
*iface
)
1762 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1764 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1767 static ULONG WINAPI
HTMLWindow6_Release(IHTMLWindow6
*iface
)
1769 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1771 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1774 static HRESULT WINAPI
HTMLWindow6_GetTypeInfoCount(IHTMLWindow6
*iface
, UINT
*pctinfo
)
1776 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1778 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1781 static HRESULT WINAPI
HTMLWindow6_GetTypeInfo(IHTMLWindow6
*iface
, UINT iTInfo
,
1782 LCID lcid
, ITypeInfo
**ppTInfo
)
1784 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1786 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1789 static HRESULT WINAPI
HTMLWindow6_GetIDsOfNames(IHTMLWindow6
*iface
, REFIID riid
,
1790 LPOLESTR
*rgszNames
, UINT cNames
,
1791 LCID lcid
, DISPID
*rgDispId
)
1793 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1795 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1799 static HRESULT WINAPI
HTMLWindow6_Invoke(IHTMLWindow6
*iface
, DISPID dispIdMember
,
1800 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1801 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1803 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1805 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1806 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1809 static HRESULT WINAPI
HTMLWindow6_put_XDomainRequest(IHTMLWindow6
*iface
, VARIANT v
)
1811 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1812 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1816 static HRESULT WINAPI
HTMLWindow6_get_XDomainRequest(IHTMLWindow6
*iface
, VARIANT
*p
)
1818 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1819 FIXME("(%p)->(%p)\n", This
, p
);
1823 static HRESULT WINAPI
HTMLWindow6_get_sessionStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1825 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1826 FIXME("(%p)->(%p)\n", This
, p
);
1830 static HRESULT WINAPI
HTMLWindow6_get_localStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1832 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1833 FIXME("(%p)->(%p)\n", This
, p
);
1837 static HRESULT WINAPI
HTMLWindow6_put_onhashchange(IHTMLWindow6
*iface
, VARIANT v
)
1839 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1840 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1844 static HRESULT WINAPI
HTMLWindow6_get_onhashchange(IHTMLWindow6
*iface
, VARIANT
*p
)
1846 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1847 FIXME("(%p)->(%p)\n", This
, p
);
1851 static HRESULT WINAPI
HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6
*iface
, LONG
*p
)
1853 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1854 FIXME("(%p)->(%p)\n", This
, p
);
1858 static HRESULT WINAPI
HTMLWindow6_postMessage(IHTMLWindow6
*iface
, BSTR msg
, VARIANT targetOrigin
)
1860 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1861 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(msg
), debugstr_variant(&targetOrigin
));
1865 static HRESULT WINAPI
HTMLWindow6_toStaticHTML(IHTMLWindow6
*iface
, BSTR bstrHTML
, BSTR
*pbstrStaticHTML
)
1867 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1868 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrHTML
), pbstrStaticHTML
);
1872 static HRESULT WINAPI
HTMLWindow6_put_onmessage(IHTMLWindow6
*iface
, VARIANT v
)
1874 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1875 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1879 static HRESULT WINAPI
HTMLWindow6_get_onmessage(IHTMLWindow6
*iface
, VARIANT
*p
)
1881 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1882 FIXME("(%p)->(%p)\n", This
, p
);
1886 static HRESULT WINAPI
HTMLWindow6_msWriteProfilerMark(IHTMLWindow6
*iface
, BSTR bstrProfilerMark
)
1888 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1889 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrProfilerMark
));
1893 static const IHTMLWindow6Vtbl HTMLWindow6Vtbl
= {
1894 HTMLWindow6_QueryInterface
,
1896 HTMLWindow6_Release
,
1897 HTMLWindow6_GetTypeInfoCount
,
1898 HTMLWindow6_GetTypeInfo
,
1899 HTMLWindow6_GetIDsOfNames
,
1901 HTMLWindow6_put_XDomainRequest
,
1902 HTMLWindow6_get_XDomainRequest
,
1903 HTMLWindow6_get_sessionStorage
,
1904 HTMLWindow6_get_localStorage
,
1905 HTMLWindow6_put_onhashchange
,
1906 HTMLWindow6_get_onhashchange
,
1907 HTMLWindow6_get_maxConnectionsPerServer
,
1908 HTMLWindow6_postMessage
,
1909 HTMLWindow6_toStaticHTML
,
1910 HTMLWindow6_put_onmessage
,
1911 HTMLWindow6_get_onmessage
,
1912 HTMLWindow6_msWriteProfilerMark
1915 static inline HTMLWindow
*impl_from_IHTMLPrivateWindow(IHTMLPrivateWindow
*iface
)
1917 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLPrivateWindow_iface
);
1920 static HRESULT WINAPI
HTMLPrivateWindow_QueryInterface(IHTMLPrivateWindow
*iface
, REFIID riid
, void **ppv
)
1922 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1924 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1927 static ULONG WINAPI
HTMLPrivateWindow_AddRef(IHTMLPrivateWindow
*iface
)
1929 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1931 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1934 static ULONG WINAPI
HTMLPrivateWindow_Release(IHTMLPrivateWindow
*iface
)
1936 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1938 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1941 static HRESULT WINAPI
HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow
*iface
, BSTR url
, BSTR arg2
, BSTR arg3
,
1942 BSTR arg4
, VARIANT
*post_data_var
, VARIANT
*headers_var
, ULONG flags
)
1944 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1945 OLECHAR
*translated_url
= NULL
;
1946 DWORD post_data_size
= 0;
1947 BYTE
*post_data
= NULL
;
1948 WCHAR
*headers
= NULL
;
1952 TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This
, debugstr_w(url
), debugstr_w(arg2
), debugstr_w(arg3
), debugstr_w(arg4
),
1953 debugstr_variant(post_data_var
), debugstr_variant(headers_var
), flags
);
1955 if(This
->doc_obj
->hostui
) {
1956 hres
= IDocHostUIHandler_TranslateUrl(This
->doc_obj
->hostui
, 0, url
, &translated_url
);
1958 translated_url
= NULL
;
1961 hres
= CreateUri(translated_url
? translated_url
: url
, 0, 0, &uri
);
1962 CoTaskMemFree(translated_url
);
1967 if(V_VT(post_data_var
) == (VT_ARRAY
|VT_UI1
)) {
1968 SafeArrayAccessData(V_ARRAY(post_data_var
), (void**)&post_data
);
1969 post_data_size
= V_ARRAY(post_data_var
)->rgsabound
[0].cElements
;
1973 if(headers_var
&& V_VT(headers_var
) != VT_EMPTY
&& V_VT(headers_var
) != VT_ERROR
) {
1974 if(V_VT(headers_var
) != VT_BSTR
)
1975 return E_INVALIDARG
;
1977 headers
= V_BSTR(headers_var
);
1980 hres
= super_navigate(This
, uri
, headers
, post_data
, post_data_size
);
1983 SafeArrayUnaccessData(V_ARRAY(post_data_var
));
1988 static HRESULT WINAPI
HTMLPrivateWindow_GetPendingUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
1990 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1991 FIXME("(%p)->(%p)\n", This
, url
);
1995 static HRESULT WINAPI
HTMLPrivateWindow_SetPICSTarget(IHTMLPrivateWindow
*iface
, IOleCommandTarget
*cmdtrg
)
1997 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1998 FIXME("(%p)->(%p)\n", This
, cmdtrg
);
2002 static HRESULT WINAPI
HTMLPrivateWindow_PICSComplete(IHTMLPrivateWindow
*iface
, int arg
)
2004 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2005 FIXME("(%p)->(%x)\n", This
, arg
);
2009 static HRESULT WINAPI
HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow
*iface
, LPCWSTR name
, IHTMLWindow2
**ret
)
2011 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2012 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), ret
);
2016 static HRESULT WINAPI
HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2018 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2019 TRACE("(%p)->(%p)\n", This
, url
);
2022 return E_INVALIDARG
;
2024 *url
= SysAllocString(This
->url
);
2028 static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl
= {
2029 HTMLPrivateWindow_QueryInterface
,
2030 HTMLPrivateWindow_AddRef
,
2031 HTMLPrivateWindow_Release
,
2032 HTMLPrivateWindow_SuperNavigate
,
2033 HTMLPrivateWindow_GetPendingUrl
,
2034 HTMLPrivateWindow_SetPICSTarget
,
2035 HTMLPrivateWindow_PICSComplete
,
2036 HTMLPrivateWindow_FindWindowByName
,
2037 HTMLPrivateWindow_GetAddressBarUrl
2040 static inline HTMLWindow
*impl_from_ITravelLogClient(ITravelLogClient
*iface
)
2042 return CONTAINING_RECORD(iface
, HTMLWindow
, ITravelLogClient_iface
);
2045 static HRESULT WINAPI
TravelLogClient_QueryInterface(ITravelLogClient
*iface
, REFIID riid
, void **ppv
)
2047 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2049 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2052 static ULONG WINAPI
TravelLogClient_AddRef(ITravelLogClient
*iface
)
2054 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2056 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2059 static ULONG WINAPI
TravelLogClient_Release(ITravelLogClient
*iface
)
2061 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2063 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2066 static HRESULT WINAPI
TravelLogClient_FindWindowByIndex(ITravelLogClient
*iface
, DWORD dwID
, IUnknown
**ppunk
)
2068 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2070 FIXME("(%p)->(%d %p) semi-stub\n", This
, dwID
, ppunk
);
2076 static HRESULT WINAPI
TravelLogClient_GetWindowData(ITravelLogClient
*iface
, IStream
*pStream
, LPWINDOWDATA pWinData
)
2078 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2079 FIXME("(%p)->(%p %p)\n", This
, pStream
, pWinData
);
2083 static HRESULT WINAPI
TravelLogClient_LoadHistoryPosition(ITravelLogClient
*iface
, LPWSTR pszUrlLocation
, DWORD dwPosition
)
2085 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2086 FIXME("(%p)->(%s %d)\n", This
, debugstr_w(pszUrlLocation
), dwPosition
);
2090 static const ITravelLogClientVtbl TravelLogClientVtbl
= {
2091 TravelLogClient_QueryInterface
,
2092 TravelLogClient_AddRef
,
2093 TravelLogClient_Release
,
2094 TravelLogClient_FindWindowByIndex
,
2095 TravelLogClient_GetWindowData
,
2096 TravelLogClient_LoadHistoryPosition
2099 static inline HTMLWindow
*impl_from_IDispatchEx(IDispatchEx
*iface
)
2101 return CONTAINING_RECORD(iface
, HTMLWindow
, IDispatchEx_iface
);
2104 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
2106 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2108 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2111 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
2113 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2115 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2118 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
2120 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2122 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2125 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
2127 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2129 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2131 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
2134 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
2135 LCID lcid
, ITypeInfo
**ppTInfo
)
2137 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2139 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2141 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2144 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
2145 LPOLESTR
*rgszNames
, UINT cNames
,
2146 LCID lcid
, DISPID
*rgDispId
)
2148 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2152 WARN("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
2155 for(i
=0; i
< cNames
; i
++) {
2156 /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
2157 hres
= IDispatchEx_GetDispID(&This
->IDispatchEx_iface
, rgszNames
[i
], 0, rgDispId
+i
);
2165 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
2166 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2167 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2169 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2171 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2172 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2174 /* FIXME: Use script dispatch */
2176 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2177 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2180 static global_prop_t
*alloc_global_prop(HTMLWindow
*This
, global_prop_type_t type
, BSTR name
)
2182 if(This
->global_prop_cnt
== This
->global_prop_size
) {
2183 global_prop_t
*new_props
;
2186 if(This
->global_props
) {
2187 new_size
= This
->global_prop_size
*2;
2188 new_props
= heap_realloc(This
->global_props
, new_size
*sizeof(global_prop_t
));
2191 new_props
= heap_alloc(new_size
*sizeof(global_prop_t
));
2195 This
->global_props
= new_props
;
2196 This
->global_prop_size
= new_size
;
2199 This
->global_props
[This
->global_prop_cnt
].name
= heap_strdupW(name
);
2200 if(!This
->global_props
[This
->global_prop_cnt
].name
)
2203 This
->global_props
[This
->global_prop_cnt
].type
= type
;
2204 return This
->global_props
+ This
->global_prop_cnt
++;
2207 static inline DWORD
prop_to_dispid(HTMLWindow
*This
, global_prop_t
*prop
)
2209 return MSHTML_DISPID_CUSTOM_MIN
+ (prop
-This
->global_props
);
2212 HRESULT
search_window_props(HTMLWindow
*This
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2215 ScriptHost
*script_host
;
2218 for(i
=0; i
< This
->global_prop_cnt
; i
++) {
2219 /* FIXME: case sensitivity */
2220 if(!strcmpW(This
->global_props
[i
].name
, bstrName
)) {
2221 *pid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
2226 if(find_global_prop(This
, bstrName
, grfdex
, &script_host
, &id
)) {
2227 global_prop_t
*prop
;
2229 prop
= alloc_global_prop(This
, GLOBAL_SCRIPTVAR
, bstrName
);
2231 return E_OUTOFMEMORY
;
2233 prop
->script_host
= script_host
;
2236 *pid
= prop_to_dispid(This
, prop
);
2240 return DISP_E_UNKNOWNNAME
;
2243 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2245 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2248 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
2250 hres
= search_window_props(This
, bstrName
, grfdex
, pid
);
2251 if(hres
!= DISP_E_UNKNOWNNAME
)
2254 hres
= IDispatchEx_GetDispID(&This
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
, pid
);
2255 if(hres
!= DISP_E_UNKNOWNNAME
)
2259 global_prop_t
*prop
;
2262 hres
= IHTMLDocument3_getElementById(&This
->doc
->basedoc
.IHTMLDocument3_iface
,
2264 if(SUCCEEDED(hres
) && elem
) {
2265 IHTMLElement_Release(elem
);
2267 prop
= alloc_global_prop(This
, GLOBAL_ELEMENTVAR
, bstrName
);
2269 return E_OUTOFMEMORY
;
2271 *pid
= prop_to_dispid(This
, prop
);
2276 return DISP_E_UNKNOWNNAME
;
2279 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
2280 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
2282 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2284 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2286 if(id
== DISPID_IHTMLWINDOW2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
)) {
2287 HTMLLocation
*location
;
2290 TRACE("forwarding to location.href\n");
2292 hres
= get_location(This
, &location
);
2296 hres
= IDispatchEx_InvokeEx(&location
->dispex
.IDispatchEx_iface
, DISPID_VALUE
, lcid
,
2297 wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2298 IHTMLLocation_Release(&location
->IHTMLLocation_iface
);
2302 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
,
2306 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
2308 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2310 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
2312 return IDispatchEx_DeleteMemberByName(&This
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
2315 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
2317 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2319 TRACE("(%p)->(%x)\n", This
, id
);
2321 return IDispatchEx_DeleteMemberByDispID(&This
->dispex
.IDispatchEx_iface
, id
);
2324 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
2326 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2328 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
2330 return IDispatchEx_GetMemberProperties(&This
->dispex
.IDispatchEx_iface
, id
, grfdexFetch
,
2334 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
2336 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2338 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
2340 return IDispatchEx_GetMemberName(&This
->dispex
.IDispatchEx_iface
, id
, pbstrName
);
2343 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
2345 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2347 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
2349 return IDispatchEx_GetNextDispID(&This
->dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
2352 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
2354 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2356 TRACE("(%p)->(%p)\n", This
, ppunk
);
2362 static const IDispatchExVtbl WindowDispExVtbl
= {
2363 WindowDispEx_QueryInterface
,
2364 WindowDispEx_AddRef
,
2365 WindowDispEx_Release
,
2366 WindowDispEx_GetTypeInfoCount
,
2367 WindowDispEx_GetTypeInfo
,
2368 WindowDispEx_GetIDsOfNames
,
2369 WindowDispEx_Invoke
,
2370 WindowDispEx_GetDispID
,
2371 WindowDispEx_InvokeEx
,
2372 WindowDispEx_DeleteMemberByName
,
2373 WindowDispEx_DeleteMemberByDispID
,
2374 WindowDispEx_GetMemberProperties
,
2375 WindowDispEx_GetMemberName
,
2376 WindowDispEx_GetNextDispID
,
2377 WindowDispEx_GetNameSpaceParent
2380 static inline HTMLWindow
*impl_from_IServiceProvider(IServiceProvider
*iface
)
2382 return CONTAINING_RECORD(iface
, HTMLWindow
, IServiceProvider_iface
);
2385 static HRESULT WINAPI
HTMLWindowSP_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
2387 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2388 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2391 static ULONG WINAPI
HTMLWindowSP_AddRef(IServiceProvider
*iface
)
2393 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2394 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2397 static ULONG WINAPI
HTMLWindowSP_Release(IServiceProvider
*iface
)
2399 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2400 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2403 static HRESULT WINAPI
HTMLWindowSP_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
2405 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2407 if(IsEqualGUID(guidService
, &IID_IHTMLWindow2
)) {
2408 TRACE("IID_IHTMLWindow2\n");
2409 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2412 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
2415 return E_NOINTERFACE
;
2417 return IServiceProvider_QueryService(&This
->doc_obj
->basedoc
.IServiceProvider_iface
,
2418 guidService
, riid
, ppv
);
2421 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2422 HTMLWindowSP_QueryInterface
,
2423 HTMLWindowSP_AddRef
,
2424 HTMLWindowSP_Release
,
2425 HTMLWindowSP_QueryService
2428 static inline HTMLWindow
*impl_from_DispatchEx(DispatchEx
*iface
)
2430 return CONTAINING_RECORD(iface
, HTMLWindow
, dispex
);
2433 static HRESULT
HTMLWindow_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2434 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2436 HTMLWindow
*This
= impl_from_DispatchEx(dispex
);
2437 global_prop_t
*prop
;
2441 idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
2442 if(idx
>= This
->global_prop_cnt
)
2443 return DISP_E_MEMBERNOTFOUND
;
2445 prop
= This
->global_props
+idx
;
2447 switch(prop
->type
) {
2448 case GLOBAL_SCRIPTVAR
: {
2452 disp
= get_script_disp(prop
->script_host
);
2454 return E_UNEXPECTED
;
2456 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&iface
);
2457 if(SUCCEEDED(hres
)) {
2458 TRACE("%s >>>\n", debugstr_w(prop
->name
));
2459 hres
= IDispatchEx_InvokeEx(iface
, prop
->id
, lcid
, flags
, params
, res
, ei
, caller
);
2461 TRACE("%s <<<\n", debugstr_w(prop
->name
));
2463 WARN("%s <<< %08x\n", debugstr_w(prop
->name
), hres
);
2464 IDispatchEx_Release(iface
);
2466 FIXME("No IDispatchEx\n");
2468 IDispatch_Release(disp
);
2471 case GLOBAL_ELEMENTVAR
:
2473 case DISPATCH_PROPERTYGET
: {
2476 hres
= IHTMLDocument3_getElementById(&This
->doc
->basedoc
.IHTMLDocument3_iface
,
2482 return DISP_E_MEMBERNOTFOUND
;
2484 V_VT(res
) = VT_DISPATCH
;
2485 V_DISPATCH(res
) = (IDispatch
*)elem
;
2488 case DISPATCH_PROPERTYPUT
: {
2491 hres
= dispex_get_dynid(&This
->dispex
, prop
->name
, &dispex_id
);
2495 prop
->type
= GLOBAL_DISPEXVAR
;
2496 prop
->id
= dispex_id
;
2497 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, dispex_id
, 0, flags
, params
, res
, ei
, caller
);
2500 FIXME("Not suppoted flags: %x\n", flags
);
2503 case GLOBAL_DISPEXVAR
:
2504 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, prop
->id
, 0, flags
, params
, res
, ei
, caller
);
2506 ERR("invalid type %d\n", prop
->type
);
2507 hres
= DISP_E_MEMBERNOTFOUND
;
2514 static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl
= {
2521 static const tid_t HTMLWindow_iface_tids
[] = {
2529 static dispex_static_data_t HTMLWindow_dispex
= {
2530 &HTMLWindow_dispex_vtbl
,
2531 DispHTMLWindow2_tid
,
2533 HTMLWindow_iface_tids
2536 HRESULT
HTMLWindow_Create(HTMLDocumentObj
*doc_obj
, nsIDOMWindow
*nswindow
, HTMLWindow
*parent
, HTMLWindow
**ret
)
2541 window
= heap_alloc_zero(sizeof(HTMLWindow
));
2543 return E_OUTOFMEMORY
;
2545 window
->window_ref
= heap_alloc(sizeof(windowref_t
));
2546 if(!window
->window_ref
) {
2548 return E_OUTOFMEMORY
;
2551 window
->IHTMLWindow2_iface
.lpVtbl
= &HTMLWindow2Vtbl
;
2552 window
->IHTMLWindow3_iface
.lpVtbl
= &HTMLWindow3Vtbl
;
2553 window
->IHTMLWindow4_iface
.lpVtbl
= &HTMLWindow4Vtbl
;
2554 window
->IHTMLWindow5_iface
.lpVtbl
= &HTMLWindow5Vtbl
;
2555 window
->IHTMLWindow6_iface
.lpVtbl
= &HTMLWindow6Vtbl
;
2556 window
->IHTMLPrivateWindow_iface
.lpVtbl
= &HTMLPrivateWindowVtbl
;
2557 window
->IDispatchEx_iface
.lpVtbl
= &WindowDispExVtbl
;
2558 window
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
2559 window
->ITravelLogClient_iface
.lpVtbl
= &TravelLogClientVtbl
;
2561 window
->doc_obj
= doc_obj
;
2563 window
->window_ref
->window
= window
;
2564 window
->window_ref
->ref
= 1;
2566 init_dispex(&window
->dispex
, (IUnknown
*)&window
->IHTMLWindow2_iface
, &HTMLWindow_dispex
);
2569 nsIDOMWindow_AddRef(nswindow
);
2570 window
->nswindow
= nswindow
;
2573 window
->scriptmode
= parent
? parent
->scriptmode
: SCRIPTMODE_GECKO
;
2574 window
->readystate
= READYSTATE_UNINITIALIZED
;
2575 list_init(&window
->script_hosts
);
2577 hres
= CoInternetCreateSecurityManager(NULL
, &window
->secmgr
, 0);
2579 IHTMLWindow2_Release(&window
->IHTMLWindow2_iface
);
2583 window
->task_magic
= get_task_target_magic();
2584 update_window_doc(window
);
2586 list_init(&window
->children
);
2587 list_add_head(&window_list
, &window
->entry
);
2590 IHTMLWindow2_AddRef(&window
->IHTMLWindow2_iface
);
2592 window
->parent
= parent
;
2593 list_add_tail(&parent
->children
, &window
->sibling_entry
);
2600 void update_window_doc(HTMLWindow
*window
)
2602 nsIDOMHTMLDocument
*nshtmldoc
;
2603 nsIDOMDocument
*nsdoc
;
2606 nsres
= nsIDOMWindow_GetDocument(window
->nswindow
, &nsdoc
);
2607 if(NS_FAILED(nsres
) || !nsdoc
) {
2608 ERR("GetDocument failed: %08x\n", nsres
);
2612 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
2613 nsIDOMDocument_Release(nsdoc
);
2614 if(NS_FAILED(nsres
)) {
2615 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
2619 if(!window
->doc
|| window
->doc
->nsdoc
!= nshtmldoc
) {
2620 HTMLDocumentNode
*doc
;
2623 hres
= create_doc_from_nsdoc(nshtmldoc
, window
->doc_obj
, window
, &doc
);
2624 if(SUCCEEDED(hres
)) {
2625 window_set_docnode(window
, doc
);
2626 htmldoc_release(&doc
->basedoc
);
2628 ERR("create_doc_from_nsdoc failed: %08x\n", hres
);
2632 nsIDOMHTMLDocument_Release(nshtmldoc
);
2635 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*nswindow
)
2639 LIST_FOR_EACH_ENTRY(iter
, &window_list
, HTMLWindow
, entry
) {
2640 if(iter
->nswindow
== nswindow
)