2 * Copyright 2006-2012 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
32 #define NO_SHLWAPI_REG
35 #include "wine/debug.h"
37 #include "mshtml_private.h"
38 #include "htmlevent.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
44 static struct list window_list
= LIST_INIT(window_list
);
46 static inline BOOL
is_outer_window(HTMLWindow
*window
)
48 return &window
->outer_window
->base
== window
;
51 static void release_children(HTMLOuterWindow
*This
)
53 HTMLOuterWindow
*child
;
55 while(!list_empty(&This
->children
)) {
56 child
= LIST_ENTRY(list_tail(&This
->children
), HTMLOuterWindow
, sibling_entry
);
58 list_remove(&child
->sibling_entry
);
60 IHTMLWindow2_Release(&child
->base
.IHTMLWindow2_iface
);
64 static HRESULT
get_location(HTMLOuterWindow
*This
, HTMLLocation
**ret
)
67 IHTMLLocation_AddRef(&This
->location
->IHTMLLocation_iface
);
71 hres
= HTMLLocation_Create(This
, &This
->location
);
76 *ret
= This
->location
;
80 void get_top_window(HTMLOuterWindow
*window
, HTMLOuterWindow
**ret
)
82 HTMLOuterWindow
*iter
;
84 for(iter
= window
; iter
->parent
; iter
= iter
->parent
);
88 static inline HRESULT
set_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
90 if(!window
->inner_window
->doc
) {
91 FIXME("No document\n");
95 return set_event_handler(&window
->inner_window
->doc
->body_event_target
, NULL
, window
->inner_window
->doc
, eid
, var
);
98 static inline HRESULT
get_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
100 if(!window
->inner_window
->doc
) {
101 FIXME("No document\n");
105 return get_event_handler(&window
->inner_window
->doc
->body_event_target
, eid
, var
);
108 static void detach_inner_window(HTMLOuterWindow
*outer_window
)
110 HTMLInnerWindow
*window
= outer_window
->base
.inner_window
;
115 if(outer_window
->doc_obj
&& outer_window
== outer_window
->doc_obj
->basedoc
.window
)
116 window
->doc
->basedoc
.cp_container
.forward_container
= NULL
;
118 detach_events(window
->doc
);
119 abort_window_bindings(window
);
120 release_script_hosts(window
);
121 window
->doc
->basedoc
.window
= NULL
;
122 window
->base
.outer_window
= NULL
;
124 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
127 static inline HTMLWindow
*impl_from_IHTMLWindow2(IHTMLWindow2
*iface
)
129 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow2_iface
);
132 static HRESULT WINAPI
HTMLWindow2_QueryInterface(IHTMLWindow2
*iface
, REFIID riid
, void **ppv
)
134 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
138 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
139 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
140 *ppv
= &This
->IHTMLWindow2_iface
;
141 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
142 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
143 *ppv
= &This
->IHTMLWindow2_iface
;
144 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
145 TRACE("(%p)->(IID_IDispatchEx %p)\n", This
, ppv
);
146 *ppv
= &This
->IDispatchEx_iface
;
147 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2
, riid
)) {
148 TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This
, ppv
);
149 *ppv
= &This
->IHTMLWindow2_iface
;
150 }else if(IsEqualGUID(&IID_IHTMLWindow2
, riid
)) {
151 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This
, ppv
);
152 *ppv
= &This
->IHTMLWindow2_iface
;
153 }else if(IsEqualGUID(&IID_IHTMLWindow3
, riid
)) {
154 TRACE("(%p)->(IID_IHTMLWindow3 %p)\n", This
, ppv
);
155 *ppv
= &This
->IHTMLWindow3_iface
;
156 }else if(IsEqualGUID(&IID_IHTMLWindow4
, riid
)) {
157 TRACE("(%p)->(IID_IHTMLWindow4 %p)\n", This
, ppv
);
158 *ppv
= &This
->IHTMLWindow4_iface
;
159 }else if(IsEqualGUID(&IID_IHTMLWindow5
, riid
)) {
160 TRACE("(%p)->(IID_IHTMLWindow5 %p)\n", This
, ppv
);
161 *ppv
= &This
->IHTMLWindow5_iface
;
162 }else if(IsEqualGUID(&IID_IHTMLWindow6
, riid
)) {
163 TRACE("(%p)->(IID_IHTMLWindow6 %p)\n", This
, ppv
);
164 *ppv
= &This
->IHTMLWindow6_iface
;
165 }else if(IsEqualGUID(&IID_IHTMLPrivateWindow
, riid
)) {
166 TRACE("(%p)->(IID_IHTMLPrivateWindow %p)\n", This
, ppv
);
167 *ppv
= &This
->IHTMLPrivateWindow_iface
;
168 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
169 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
170 *ppv
= &This
->IServiceProvider_iface
;
171 }else if(IsEqualGUID(&IID_ITravelLogClient
, riid
)) {
172 TRACE("(%p)->(IID_ITravelLogClient %p)\n", This
, ppv
);
173 *ppv
= &This
->ITravelLogClient_iface
;
174 }else if(dispex_query_interface(&This
->inner_window
->dispex
, riid
, ppv
)) {
176 return E_NOINTERFACE
;
180 IUnknown_AddRef((IUnknown
*)*ppv
);
184 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
185 return E_NOINTERFACE
;
188 static ULONG WINAPI
HTMLWindow2_AddRef(IHTMLWindow2
*iface
)
190 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
191 LONG ref
= InterlockedIncrement(&This
->ref
);
193 TRACE("(%p) ref=%d\n", This
, ref
);
198 static void release_outer_window(HTMLOuterWindow
*This
)
200 if(This
->pending_window
) {
201 abort_window_bindings(This
->pending_window
);
202 This
->pending_window
->base
.outer_window
= NULL
;
203 IHTMLWindow2_Release(&This
->pending_window
->base
.IHTMLWindow2_iface
);
206 remove_target_tasks(This
->task_magic
);
207 set_current_mon(This
, NULL
);
208 detach_inner_window(This
);
209 release_children(This
);
212 IInternetSecurityManager_Release(This
->secmgr
);
214 if(This
->frame_element
)
215 This
->frame_element
->content_window
= NULL
;
218 This
->location
->window
= NULL
;
219 IHTMLLocation_Release(&This
->location
->IHTMLLocation_iface
);
222 This
->window_ref
->window
= NULL
;
223 windowref_release(This
->window_ref
);
226 nsIDOMWindow_Release(This
->nswindow
);
228 list_remove(&This
->entry
);
232 static void release_inner_window(HTMLInnerWindow
*This
)
238 remove_target_tasks(This
->task_magic
);
239 abort_window_bindings(This
);
240 release_script_hosts(This
);
243 htmldoc_release(&This
->doc
->basedoc
);
245 release_dispex(&This
->dispex
);
247 for(i
=0; i
< This
->global_prop_cnt
; i
++)
248 heap_free(This
->global_props
[i
].name
);
249 heap_free(This
->global_props
);
251 if(This
->image_factory
) {
252 This
->image_factory
->window
= NULL
;
253 IHTMLImageElementFactory_Release(&This
->image_factory
->IHTMLImageElementFactory_iface
);
256 if(This
->option_factory
) {
257 This
->option_factory
->window
= NULL
;
258 IHTMLOptionElementFactory_Release(&This
->option_factory
->IHTMLOptionElementFactory_iface
);
262 IHTMLScreen_Release(This
->screen
);
264 IOmHistory_Release(This
->history
);
269 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
271 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
272 LONG ref
= InterlockedDecrement(&This
->ref
);
274 TRACE("(%p) ref=%d\n", This
, ref
);
277 if(is_outer_window(This
))
278 release_outer_window(This
->outer_window
);
280 release_inner_window(This
->inner_window
);
286 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
288 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
290 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
293 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
294 LCID lcid
, ITypeInfo
**ppTInfo
)
296 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
298 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
301 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
302 LPOLESTR
*rgszNames
, UINT cNames
,
303 LCID lcid
, DISPID
*rgDispId
)
305 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
307 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
311 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
312 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
313 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
315 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
317 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
318 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
321 static HRESULT
get_frame_by_index(nsIDOMWindowCollection
*nsFrames
, PRUint32 index
, HTMLOuterWindow
**ret
)
324 nsIDOMWindow
*nsWindow
;
327 nsres
= nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
328 if(NS_FAILED(nsres
)) {
329 FIXME("nsIDOMWindowCollection_GetLength failed: 0x%08x\n", nsres
);
334 return DISP_E_MEMBERNOTFOUND
;
336 nsres
= nsIDOMWindowCollection_Item(nsFrames
, index
, &nsWindow
);
337 if(NS_FAILED(nsres
)) {
338 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
342 *ret
= nswindow_to_window(nsWindow
);
344 nsIDOMWindow_Release(nsWindow
);
349 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
351 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
352 nsIDOMWindowCollection
*nsFrames
;
353 HTMLOuterWindow
*window
= NULL
;
357 TRACE("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
359 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nsFrames
);
360 if(NS_FAILED(nsres
)) {
361 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
365 switch(V_VT(pvarIndex
)) {
367 int index
= V_I4(pvarIndex
);
368 TRACE("Getting index %d\n", index
);
371 hres
= get_frame_by_index(nsFrames
, index
, &window
);
375 unsigned int index
= V_UINT(pvarIndex
);
376 TRACE("Getting index %u\n", index
);
377 hres
= get_frame_by_index(nsFrames
, index
, &window
);
381 BSTR str
= V_BSTR(pvarIndex
);
384 TRACE("Getting name %s\n", wine_dbgstr_w(str
));
386 nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
389 for(i
= 0; i
< length
&& !window
; ++i
) {
390 HTMLOuterWindow
*cur_window
;
391 nsIDOMWindow
*nsWindow
;
394 nsres
= nsIDOMWindowCollection_Item(nsFrames
, i
, &nsWindow
);
395 if(NS_FAILED(nsres
)) {
396 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
401 cur_window
= nswindow_to_window(nsWindow
);
403 nsIDOMWindow_Release(nsWindow
);
405 hres
= IHTMLElement_get_id(&cur_window
->frame_element
->element
.IHTMLElement_iface
, &id
);
407 FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres
);
411 if(!strcmpW(id
, str
))
422 nsIDOMWindowCollection_Release(nsFrames
);
426 return DISP_E_MEMBERNOTFOUND
;
428 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
429 V_VT(pvarResult
) = VT_DISPATCH
;
430 V_DISPATCH(pvarResult
) = (IDispatch
*)window
;
434 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, LONG
*p
)
436 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
437 nsIDOMWindowCollection
*nscollection
;
441 TRACE("(%p)->(%p)\n", This
, p
);
443 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nscollection
);
444 if(NS_FAILED(nsres
)) {
445 ERR("GetFrames failed: %08x\n", nsres
);
449 nsres
= nsIDOMWindowCollection_GetLength(nscollection
, &length
);
450 nsIDOMWindowCollection_Release(nscollection
);
451 if(NS_FAILED(nsres
)) {
452 ERR("GetLength failed: %08x\n", nsres
);
460 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
462 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
463 FIXME("(%p)->(%p): semi-stub\n", This
, p
);
465 /* FIXME: Should return a separate Window object */
466 *p
= (IHTMLFramesCollection2
*)&This
->IHTMLWindow2_iface
;
467 HTMLWindow2_AddRef(iface
);
471 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
473 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
474 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
478 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
480 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
481 FIXME("(%p)->(%p)\n", This
, p
);
485 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
487 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
489 WARN("(%p)->(%s)\n", This
, debugstr_w(v
));
492 * FIXME: Since IE7, setting status is blocked, but still possible in certain circumstances.
493 * Ignoring the call should be enough for us.
498 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
500 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
502 TRACE("(%p)->(%p)\n", This
, p
);
509 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
510 LONG msec
, VARIANT
*language
, LONG
*timerID
)
512 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
515 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
517 V_VT(&expr_var
) = VT_BSTR
;
518 V_BSTR(&expr_var
) = expression
;
520 return IHTMLWindow3_setTimeout(&This
->IHTMLWindow3_iface
, &expr_var
, msec
, language
, timerID
);
523 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, LONG timerID
)
525 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
527 TRACE("(%p)->(%d)\n", This
, timerID
);
529 return clear_task_timer(&This
->inner_window
->doc
->basedoc
, FALSE
, timerID
);
532 #define MAX_MESSAGE_LEN 2000
534 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
536 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
537 WCHAR title
[100], *msg
= message
;
540 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
542 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, title
,
543 sizeof(title
)/sizeof(WCHAR
))) {
544 WARN("Could not load message box title: %d\n", GetLastError());
548 len
= SysStringLen(message
);
549 if(len
> MAX_MESSAGE_LEN
) {
550 msg
= heap_alloc((MAX_MESSAGE_LEN
+1)*sizeof(WCHAR
));
552 return E_OUTOFMEMORY
;
553 memcpy(msg
, message
, MAX_MESSAGE_LEN
*sizeof(WCHAR
));
554 msg
[MAX_MESSAGE_LEN
] = 0;
557 MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, msg
, title
, MB_ICONWARNING
);
563 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
564 VARIANT_BOOL
*confirmed
)
566 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
569 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
571 if(!confirmed
) return E_INVALIDARG
;
573 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
574 sizeof(wszTitle
)/sizeof(WCHAR
))) {
575 WARN("Could not load message box title: %d\n", GetLastError());
576 *confirmed
= VARIANT_TRUE
;
580 if(MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, message
, wszTitle
,
581 MB_OKCANCEL
|MB_ICONQUESTION
)==IDOK
)
582 *confirmed
= VARIANT_TRUE
;
583 else *confirmed
= VARIANT_FALSE
;
595 static INT_PTR CALLBACK
prompt_dlgproc(HWND hwnd
, UINT msg
,
596 WPARAM wparam
, LPARAM lparam
)
602 prompt_arg
*arg
= (prompt_arg
*)lparam
;
605 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
606 sizeof(wszTitle
)/sizeof(WCHAR
))) {
607 WARN("Could not load message box title: %d\n", GetLastError());
608 EndDialog(hwnd
, wparam
);
612 SetWindowLongPtrW(hwnd
, DWLP_USER
, lparam
);
613 SetWindowTextW(hwnd
, wszTitle
);
614 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_PROMPT
), arg
->message
);
615 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_EDIT
), arg
->dststr
);
621 case MAKEWPARAM(IDCANCEL
, BN_CLICKED
):
622 EndDialog(hwnd
, wparam
);
624 case MAKEWPARAM(IDOK
, BN_CLICKED
):
627 (prompt_arg
*)GetWindowLongPtrW(hwnd
, DWLP_USER
);
628 HWND hwndPrompt
= GetDlgItem(hwnd
, ID_PROMPT_EDIT
);
629 INT len
= GetWindowTextLengthW(hwndPrompt
);
633 EndDialog(hwnd
, wparam
);
637 V_VT(arg
->textdata
) = VT_BSTR
;
638 if(!len
&& !arg
->dststr
)
639 V_BSTR(arg
->textdata
) = NULL
;
642 V_BSTR(arg
->textdata
) = SysAllocStringLen(NULL
, len
);
643 GetWindowTextW(hwndPrompt
, V_BSTR(arg
->textdata
), len
+1);
645 EndDialog(hwnd
, wparam
);
651 EndDialog(hwnd
, IDCANCEL
);
658 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
659 BSTR dststr
, VARIANT
*textdata
)
661 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
664 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
666 if(textdata
) V_VT(textdata
) = VT_NULL
;
668 arg
.message
= message
;
670 arg
.textdata
= textdata
;
672 DialogBoxParamW(hInst
, MAKEINTRESOURCEW(ID_PROMPT_DIALOG
),
673 This
->outer_window
->doc_obj
->hwnd
, prompt_dlgproc
, (LPARAM
)&arg
);
677 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
679 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
680 HTMLInnerWindow
*window
= This
->inner_window
;
682 TRACE("(%p)->(%p)\n", This
, p
);
684 if(!window
->image_factory
) {
687 hres
= HTMLImageElementFactory_Create(window
, &window
->image_factory
);
692 *p
= &window
->image_factory
->IHTMLImageElementFactory_iface
;
693 IHTMLImageElementFactory_AddRef(*p
);
698 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
700 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
701 HTMLLocation
*location
;
704 TRACE("(%p)->(%p)\n", This
, p
);
706 hres
= get_location(This
->outer_window
, &location
);
710 *p
= &location
->IHTMLLocation_iface
;
714 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
716 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
717 HTMLInnerWindow
*window
= This
->inner_window
;
719 TRACE("(%p)->(%p)\n", This
, p
);
721 if(!window
->history
) {
724 hres
= create_history(&window
->history
);
729 IOmHistory_AddRef(window
->history
);
730 *p
= window
->history
;
734 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
736 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
737 FIXME("(%p)->()\n", This
);
741 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
743 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
744 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
748 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
750 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
752 FIXME("(%p)->(%p) returning empty\n", This
, p
);
758 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
760 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
762 TRACE("(%p)->(%p)\n", This
, p
);
764 *p
= OmNavigator_Create();
768 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
770 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
774 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
776 nsAString_InitDepend(&name_str
, v
);
777 nsres
= nsIDOMWindow_SetName(This
->outer_window
->nswindow
, &name_str
);
778 nsAString_Finish(&name_str
);
780 ERR("SetName failed: %08x\n", nsres
);
785 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
787 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
791 TRACE("(%p)->(%p)\n", This
, p
);
793 nsAString_Init(&name_str
, NULL
);
794 nsres
= nsIDOMWindow_GetName(This
->outer_window
->nswindow
, &name_str
);
795 return return_nsstr(nsres
, &name_str
, p
);
798 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
800 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
801 HTMLOuterWindow
*window
= This
->outer_window
;
803 TRACE("(%p)->(%p)\n", This
, p
);
806 return IHTMLWindow2_get_self(&This
->IHTMLWindow2_iface
, p
);
808 *p
= &window
->parent
->base
.IHTMLWindow2_iface
;
809 IHTMLWindow2_AddRef(*p
);
813 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
814 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
816 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
817 HTMLOuterWindow
*window
= This
->outer_window
;
818 INewWindowManager
*new_window_mgr
;
822 TRACE("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
823 debugstr_w(features
), replace
, pomWindowResult
);
828 if(name
&& *name
== '_') {
829 FIXME("Unsupported name %s\n", debugstr_w(name
));
833 hres
= do_query_service((IUnknown
*)window
->doc_obj
->client
, &SID_SNewWindowManager
, &IID_INewWindowManager
,
834 (void**)&new_window_mgr
);
836 FIXME("No INewWindowManager\n");
840 hres
= INewWindowManager_EvaluateNewWindow(new_window_mgr
, url
, name
, window
->url
,
841 features
, !!replace
, window
->doc_obj
->has_popup
? 0 : NWMF_FIRST
, 0);
842 INewWindowManager_Release(new_window_mgr
);
843 window
->doc_obj
->has_popup
= TRUE
;
845 *pomWindowResult
= NULL
;
849 hres
= create_relative_uri(window
, url
, &uri
);
853 hres
= navigate_new_window(window
, uri
, name
, pomWindowResult
);
858 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
860 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
862 TRACE("(%p)->(%p)\n", This
, p
);
864 /* FIXME: We should return kind of proxy window here. */
865 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
866 *p
= &This
->IHTMLWindow2_iface
;
870 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
872 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
873 HTMLOuterWindow
*top
;
875 TRACE("(%p)->(%p)\n", This
, p
);
877 get_top_window(This
->outer_window
, &top
);
878 *p
= &top
->base
.IHTMLWindow2_iface
;
879 IHTMLWindow2_AddRef(*p
);
884 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
886 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
888 TRACE("(%p)->(%p)\n", This
, p
);
890 /* FIXME: We should return kind of proxy window here. */
891 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
892 *p
= &This
->IHTMLWindow2_iface
;
896 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
898 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
899 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
903 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
905 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
906 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
910 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
912 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
913 FIXME("(%p)->(%p)\n", This
, p
);
917 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
919 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
920 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
924 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
926 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
927 FIXME("(%p)->(%p)\n", This
, p
);
931 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
933 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
935 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
937 return set_window_event(This
, EVENTID_LOAD
, &v
);
940 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
942 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
944 TRACE("(%p)->(%p)\n", This
, p
);
946 return get_window_event(This
, EVENTID_LOAD
, p
);
949 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
951 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
953 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
955 return set_window_event(This
, EVENTID_BEFOREUNLOAD
, &v
);
958 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
960 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
962 TRACE("(%p)->(%p)\n", This
, p
);
964 return get_window_event(This
, EVENTID_BEFOREUNLOAD
, p
);
967 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
969 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
970 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
974 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
976 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
977 FIXME("(%p)->(%p)\n", This
, p
);
981 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
983 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
984 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
988 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
990 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
991 FIXME("(%p)->(%p)\n", This
, p
);
995 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
997 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
999 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1001 return set_window_event(This
, EVENTID_ERROR
, &v
);
1004 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
1006 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1008 TRACE("(%p)->(%p)\n", This
, p
);
1010 return get_window_event(This
, EVENTID_ERROR
, p
);
1013 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
1015 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1017 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1019 return set_window_event(This
, EVENTID_RESIZE
, &v
);
1022 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
1024 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1026 TRACE("(%p)->(%p)\n", This
, p
);
1028 return get_window_event(This
, EVENTID_RESIZE
, p
);
1031 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
1033 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1034 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1038 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
1040 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1041 FIXME("(%p)->(%p)\n", This
, p
);
1045 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
1047 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1049 TRACE("(%p)->(%p)\n", This
, p
);
1051 if(This
->inner_window
->doc
) {
1052 /* FIXME: We should return a wrapper object here */
1053 *p
= &This
->inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1054 IHTMLDocument2_AddRef(*p
);
1062 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
1064 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1065 HTMLInnerWindow
*window
= This
->inner_window
;
1067 TRACE("(%p)->(%p)\n", This
, p
);
1070 IHTMLEventObj_AddRef(window
->event
);
1075 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
1077 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1078 FIXME("(%p)->(%p)\n", This
, p
);
1082 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
1083 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
1085 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1086 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
1090 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
1093 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1094 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(helpURL
), debugstr_variant(&helpArg
), debugstr_w(features
));
1098 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
1100 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1101 HTMLInnerWindow
*window
= This
->inner_window
;
1103 TRACE("(%p)->(%p)\n", This
, p
);
1105 if(!window
->screen
) {
1108 hres
= HTMLScreen_Create(&window
->screen
);
1113 *p
= window
->screen
;
1114 IHTMLScreen_AddRef(window
->screen
);
1118 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
1120 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1121 HTMLInnerWindow
*window
= This
->inner_window
;
1123 TRACE("(%p)->(%p)\n", This
, p
);
1125 if(!window
->option_factory
) {
1128 hres
= HTMLOptionElementFactory_Create(window
, &window
->option_factory
);
1133 *p
= &window
->option_factory
->IHTMLOptionElementFactory_iface
;
1134 IHTMLOptionElementFactory_AddRef(*p
);
1139 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
1141 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1143 TRACE("(%p)->()\n", This
);
1145 if(This
->outer_window
->doc_obj
)
1146 SetFocus(This
->outer_window
->doc_obj
->hwnd
);
1150 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
1152 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1153 FIXME("(%p)->(%p)\n", This
, p
);
1157 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
1159 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1160 FIXME("(%p)->()\n", This
);
1164 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1166 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1167 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1171 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
1173 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1174 FIXME("(%p)->(%p)\n", This
, p
);
1178 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
1179 LONG msec
, VARIANT
*language
, LONG
*timerID
)
1181 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1184 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
1186 V_VT(&expr
) = VT_BSTR
;
1187 V_BSTR(&expr
) = expression
;
1188 return IHTMLWindow3_setInterval(&This
->IHTMLWindow3_iface
, &expr
, msec
, language
, timerID
);
1191 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, LONG timerID
)
1193 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1195 TRACE("(%p)->(%d)\n", This
, timerID
);
1197 return clear_task_timer(&This
->inner_window
->doc
->basedoc
, TRUE
, timerID
);
1200 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
1202 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1203 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1207 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
1209 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1210 FIXME("(%p)->(%p)\n", This
, p
);
1214 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
1217 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1219 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
1221 return exec_script(This
->inner_window
, scode
, language
, pvarRet
);
1224 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
1226 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1228 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1230 TRACE("(%p)->(%p)\n", This
, String
);
1233 return E_INVALIDARG
;
1235 *String
= SysAllocString(objectW
);
1236 return *String
? S_OK
: E_OUTOFMEMORY
;
1239 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1241 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1244 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1246 nsres
= nsIDOMWindow_ScrollBy(This
->outer_window
->nswindow
, x
, y
);
1247 if(NS_FAILED(nsres
))
1248 ERR("ScrollBy failed: %08x\n", nsres
);
1253 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1255 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1258 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1260 nsres
= nsIDOMWindow_ScrollTo(This
->outer_window
->nswindow
, x
, y
);
1261 if(NS_FAILED(nsres
))
1262 ERR("ScrollTo failed: %08x\n", nsres
);
1267 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1269 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1270 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1274 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1276 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1277 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1281 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1283 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1284 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1288 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1290 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1291 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1295 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
1297 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1299 TRACE("(%p)->(%p)\n", This
, p
);
1303 if(!This
->outer_window
->doc_obj
->hostui
)
1306 return IDocHostUIHandler_GetExternal(This
->outer_window
->doc_obj
->hostui
, p
);
1309 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
1310 HTMLWindow2_QueryInterface
,
1312 HTMLWindow2_Release
,
1313 HTMLWindow2_GetTypeInfoCount
,
1314 HTMLWindow2_GetTypeInfo
,
1315 HTMLWindow2_GetIDsOfNames
,
1318 HTMLWindow2_get_length
,
1319 HTMLWindow2_get_frames
,
1320 HTMLWindow2_put_defaultStatus
,
1321 HTMLWindow2_get_defaultStatus
,
1322 HTMLWindow2_put_status
,
1323 HTMLWindow2_get_status
,
1324 HTMLWindow2_setTimeout
,
1325 HTMLWindow2_clearTimeout
,
1327 HTMLWindow2_confirm
,
1329 HTMLWindow2_get_Image
,
1330 HTMLWindow2_get_location
,
1331 HTMLWindow2_get_history
,
1333 HTMLWindow2_put_opener
,
1334 HTMLWindow2_get_opener
,
1335 HTMLWindow2_get_navigator
,
1336 HTMLWindow2_put_name
,
1337 HTMLWindow2_get_name
,
1338 HTMLWindow2_get_parent
,
1340 HTMLWindow2_get_self
,
1341 HTMLWindow2_get_top
,
1342 HTMLWindow2_get_window
,
1343 HTMLWindow2_navigate
,
1344 HTMLWindow2_put_onfocus
,
1345 HTMLWindow2_get_onfocus
,
1346 HTMLWindow2_put_onblur
,
1347 HTMLWindow2_get_onblur
,
1348 HTMLWindow2_put_onload
,
1349 HTMLWindow2_get_onload
,
1350 HTMLWindow2_put_onbeforeunload
,
1351 HTMLWindow2_get_onbeforeunload
,
1352 HTMLWindow2_put_onunload
,
1353 HTMLWindow2_get_onunload
,
1354 HTMLWindow2_put_onhelp
,
1355 HTMLWindow2_get_onhelp
,
1356 HTMLWindow2_put_onerror
,
1357 HTMLWindow2_get_onerror
,
1358 HTMLWindow2_put_onresize
,
1359 HTMLWindow2_get_onresize
,
1360 HTMLWindow2_put_onscroll
,
1361 HTMLWindow2_get_onscroll
,
1362 HTMLWindow2_get_document
,
1363 HTMLWindow2_get_event
,
1364 HTMLWindow2_get__newEnum
,
1365 HTMLWindow2_showModalDialog
,
1366 HTMLWindow2_showHelp
,
1367 HTMLWindow2_get_screen
,
1368 HTMLWindow2_get_Option
,
1370 HTMLWindow2_get_closed
,
1373 HTMLWindow2_get_clientInformation
,
1374 HTMLWindow2_setInterval
,
1375 HTMLWindow2_clearInterval
,
1376 HTMLWindow2_put_offscreenBuffering
,
1377 HTMLWindow2_get_offscreenBuffering
,
1378 HTMLWindow2_execScript
,
1379 HTMLWindow2_toString
,
1380 HTMLWindow2_scrollBy
,
1381 HTMLWindow2_scrollTo
,
1384 HTMLWindow2_resizeTo
,
1385 HTMLWindow2_resizeBy
,
1386 HTMLWindow2_get_external
1389 static inline HTMLWindow
*impl_from_IHTMLWindow3(IHTMLWindow3
*iface
)
1391 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow3_iface
);
1394 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
1396 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1398 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1401 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
1403 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1405 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1408 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
1410 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1412 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1415 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
1417 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1419 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1422 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
1423 LCID lcid
, ITypeInfo
**ppTInfo
)
1425 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1427 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1430 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
1431 LPOLESTR
*rgszNames
, UINT cNames
,
1432 LCID lcid
, DISPID
*rgDispId
)
1434 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1436 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1440 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
1441 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1442 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1444 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1446 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1447 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1450 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, LONG
*p
)
1452 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1453 FIXME("(%p)->(%p)\n", This
, p
);
1457 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, LONG
*p
)
1459 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1460 FIXME("(%p)->(%p)\n", This
, p
);
1464 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
1466 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1467 HTMLInnerWindow
*window
= This
->inner_window
;
1469 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
1472 FIXME("No document\n");
1476 return attach_event(&window
->doc
->body_event_target
, NULL
, &window
->doc
->basedoc
, event
, pDisp
, pfResult
);
1479 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
1481 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1482 HTMLInnerWindow
*window
= This
->inner_window
;
1484 TRACE("(%p)->()\n", This
);
1487 FIXME("No document\n");
1491 return detach_event(window
->doc
->body_event_target
, &window
->doc
->basedoc
, event
, pDisp
);
1494 static HRESULT
window_set_timer(HTMLInnerWindow
*This
, VARIANT
*expr
, LONG msec
, VARIANT
*language
,
1495 BOOL interval
, LONG
*timer_id
)
1497 IDispatch
*disp
= NULL
;
1499 switch(V_VT(expr
)) {
1501 disp
= V_DISPATCH(expr
);
1502 IDispatch_AddRef(disp
);
1506 disp
= script_parse_event(This
->base
.inner_window
, V_BSTR(expr
));
1510 FIXME("unimplemented expr %s\n", debugstr_variant(expr
));
1517 *timer_id
= set_task_timer(&This
->doc
->basedoc
, msec
, interval
, disp
);
1518 IDispatch_Release(disp
);
1523 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1524 VARIANT
*language
, LONG
*timerID
)
1526 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1528 TRACE("(%p)->(%s %d %s %p)\n", This
, debugstr_variant(expression
), msec
, debugstr_variant(language
), timerID
);
1530 return window_set_timer(This
->inner_window
, expression
, msec
, language
, FALSE
, timerID
);
1533 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1534 VARIANT
*language
, LONG
*timerID
)
1536 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1538 TRACE("(%p)->(%p %d %p %p)\n", This
, expression
, msec
, language
, timerID
);
1540 return window_set_timer(This
->inner_window
, expression
, msec
, language
, TRUE
, timerID
);
1543 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
1545 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1546 FIXME("(%p)\n", This
);
1550 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
1552 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1553 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1557 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1559 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1560 FIXME("(%p)->(%p)\n", This
, p
);
1564 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
1566 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1567 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1571 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1573 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1574 FIXME("(%p)->(%p)\n", This
, p
);
1578 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
1580 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1581 FIXME("(%p)->(%p)\n", This
, p
);
1585 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
1586 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
1588 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1589 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
1593 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
1594 HTMLWindow3_QueryInterface
,
1596 HTMLWindow3_Release
,
1597 HTMLWindow3_GetTypeInfoCount
,
1598 HTMLWindow3_GetTypeInfo
,
1599 HTMLWindow3_GetIDsOfNames
,
1601 HTMLWindow3_get_screenLeft
,
1602 HTMLWindow3_get_screenTop
,
1603 HTMLWindow3_attachEvent
,
1604 HTMLWindow3_detachEvent
,
1605 HTMLWindow3_setTimeout
,
1606 HTMLWindow3_setInterval
,
1608 HTMLWindow3_put_onbeforeprint
,
1609 HTMLWindow3_get_onbeforeprint
,
1610 HTMLWindow3_put_onafterprint
,
1611 HTMLWindow3_get_onafterprint
,
1612 HTMLWindow3_get_clipboardData
,
1613 HTMLWindow3_showModelessDialog
1616 static inline HTMLWindow
*impl_from_IHTMLWindow4(IHTMLWindow4
*iface
)
1618 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow4_iface
);
1621 static HRESULT WINAPI
HTMLWindow4_QueryInterface(IHTMLWindow4
*iface
, REFIID riid
, void **ppv
)
1623 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1625 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1628 static ULONG WINAPI
HTMLWindow4_AddRef(IHTMLWindow4
*iface
)
1630 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1632 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1635 static ULONG WINAPI
HTMLWindow4_Release(IHTMLWindow4
*iface
)
1637 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1639 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1642 static HRESULT WINAPI
HTMLWindow4_GetTypeInfoCount(IHTMLWindow4
*iface
, UINT
*pctinfo
)
1644 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1646 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1649 static HRESULT WINAPI
HTMLWindow4_GetTypeInfo(IHTMLWindow4
*iface
, UINT iTInfo
,
1650 LCID lcid
, ITypeInfo
**ppTInfo
)
1652 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1654 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1657 static HRESULT WINAPI
HTMLWindow4_GetIDsOfNames(IHTMLWindow4
*iface
, REFIID riid
,
1658 LPOLESTR
*rgszNames
, UINT cNames
,
1659 LCID lcid
, DISPID
*rgDispId
)
1661 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1663 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1667 static HRESULT WINAPI
HTMLWindow4_Invoke(IHTMLWindow4
*iface
, DISPID dispIdMember
,
1668 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1669 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1671 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1673 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1674 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1677 static HRESULT WINAPI
HTMLWindow4_createPopup(IHTMLWindow4
*iface
, VARIANT
*varArgIn
,
1678 IDispatch
**ppPopup
)
1680 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1681 FIXME("(%p)->(%p %p)\n", This
, varArgIn
, ppPopup
);
1685 static HRESULT WINAPI
HTMLWindow4_get_frameElement(IHTMLWindow4
*iface
, IHTMLFrameBase
**p
)
1687 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1688 TRACE("(%p)->(%p)\n", This
, p
);
1690 if(This
->outer_window
->frame_element
) {
1691 *p
= &This
->outer_window
->frame_element
->IHTMLFrameBase_iface
;
1692 IHTMLFrameBase_AddRef(*p
);
1699 static const IHTMLWindow4Vtbl HTMLWindow4Vtbl
= {
1700 HTMLWindow4_QueryInterface
,
1702 HTMLWindow4_Release
,
1703 HTMLWindow4_GetTypeInfoCount
,
1704 HTMLWindow4_GetTypeInfo
,
1705 HTMLWindow4_GetIDsOfNames
,
1707 HTMLWindow4_createPopup
,
1708 HTMLWindow4_get_frameElement
1711 static inline HTMLWindow
*impl_from_IHTMLWindow5(IHTMLWindow5
*iface
)
1713 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow5_iface
);
1716 static HRESULT WINAPI
HTMLWindow5_QueryInterface(IHTMLWindow5
*iface
, REFIID riid
, void **ppv
)
1718 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1720 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1723 static ULONG WINAPI
HTMLWindow5_AddRef(IHTMLWindow5
*iface
)
1725 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1727 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1730 static ULONG WINAPI
HTMLWindow5_Release(IHTMLWindow5
*iface
)
1732 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1734 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1737 static HRESULT WINAPI
HTMLWindow5_GetTypeInfoCount(IHTMLWindow5
*iface
, UINT
*pctinfo
)
1739 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1741 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1744 static HRESULT WINAPI
HTMLWindow5_GetTypeInfo(IHTMLWindow5
*iface
, UINT iTInfo
,
1745 LCID lcid
, ITypeInfo
**ppTInfo
)
1747 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1749 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1752 static HRESULT WINAPI
HTMLWindow5_GetIDsOfNames(IHTMLWindow5
*iface
, REFIID riid
,
1753 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1755 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1757 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1761 static HRESULT WINAPI
HTMLWindow5_Invoke(IHTMLWindow5
*iface
, DISPID dispIdMember
,
1762 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1763 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1765 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1767 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1768 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1771 static HRESULT WINAPI
HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT v
)
1773 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1774 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1778 static HRESULT WINAPI
HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT
*p
)
1780 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1781 FIXME("(%p)->(%p)\n", This
, p
);
1785 static const IHTMLWindow5Vtbl HTMLWindow5Vtbl
= {
1786 HTMLWindow5_QueryInterface
,
1788 HTMLWindow5_Release
,
1789 HTMLWindow5_GetTypeInfoCount
,
1790 HTMLWindow5_GetTypeInfo
,
1791 HTMLWindow5_GetIDsOfNames
,
1793 HTMLWindow5_put_XMLHttpRequest
,
1794 HTMLWindow5_get_XMLHttpRequest
1797 static inline HTMLWindow
*impl_from_IHTMLWindow6(IHTMLWindow6
*iface
)
1799 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow6_iface
);
1802 static HRESULT WINAPI
HTMLWindow6_QueryInterface(IHTMLWindow6
*iface
, REFIID riid
, void **ppv
)
1804 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1806 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1809 static ULONG WINAPI
HTMLWindow6_AddRef(IHTMLWindow6
*iface
)
1811 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1813 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1816 static ULONG WINAPI
HTMLWindow6_Release(IHTMLWindow6
*iface
)
1818 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1820 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1823 static HRESULT WINAPI
HTMLWindow6_GetTypeInfoCount(IHTMLWindow6
*iface
, UINT
*pctinfo
)
1825 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1827 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1830 static HRESULT WINAPI
HTMLWindow6_GetTypeInfo(IHTMLWindow6
*iface
, UINT iTInfo
,
1831 LCID lcid
, ITypeInfo
**ppTInfo
)
1833 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1835 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1838 static HRESULT WINAPI
HTMLWindow6_GetIDsOfNames(IHTMLWindow6
*iface
, REFIID riid
,
1839 LPOLESTR
*rgszNames
, UINT cNames
,
1840 LCID lcid
, DISPID
*rgDispId
)
1842 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1844 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1848 static HRESULT WINAPI
HTMLWindow6_Invoke(IHTMLWindow6
*iface
, DISPID dispIdMember
,
1849 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1850 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1852 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1854 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1855 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1858 static HRESULT WINAPI
HTMLWindow6_put_XDomainRequest(IHTMLWindow6
*iface
, VARIANT v
)
1860 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1861 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1865 static HRESULT WINAPI
HTMLWindow6_get_XDomainRequest(IHTMLWindow6
*iface
, VARIANT
*p
)
1867 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1868 FIXME("(%p)->(%p)\n", This
, p
);
1872 static HRESULT WINAPI
HTMLWindow6_get_sessionStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1874 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1875 FIXME("(%p)->(%p)\n", This
, p
);
1879 static HRESULT WINAPI
HTMLWindow6_get_localStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1881 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1882 FIXME("(%p)->(%p)\n", This
, p
);
1886 static HRESULT WINAPI
HTMLWindow6_put_onhashchange(IHTMLWindow6
*iface
, VARIANT v
)
1888 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1889 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1893 static HRESULT WINAPI
HTMLWindow6_get_onhashchange(IHTMLWindow6
*iface
, VARIANT
*p
)
1895 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1896 FIXME("(%p)->(%p)\n", This
, p
);
1900 static HRESULT WINAPI
HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6
*iface
, LONG
*p
)
1902 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1903 FIXME("(%p)->(%p)\n", This
, p
);
1907 static HRESULT WINAPI
HTMLWindow6_postMessage(IHTMLWindow6
*iface
, BSTR msg
, VARIANT targetOrigin
)
1909 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1910 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(msg
), debugstr_variant(&targetOrigin
));
1914 static HRESULT WINAPI
HTMLWindow6_toStaticHTML(IHTMLWindow6
*iface
, BSTR bstrHTML
, BSTR
*pbstrStaticHTML
)
1916 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1917 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrHTML
), pbstrStaticHTML
);
1921 static HRESULT WINAPI
HTMLWindow6_put_onmessage(IHTMLWindow6
*iface
, VARIANT v
)
1923 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1924 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1928 static HRESULT WINAPI
HTMLWindow6_get_onmessage(IHTMLWindow6
*iface
, VARIANT
*p
)
1930 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1931 FIXME("(%p)->(%p)\n", This
, p
);
1935 static HRESULT WINAPI
HTMLWindow6_msWriteProfilerMark(IHTMLWindow6
*iface
, BSTR bstrProfilerMark
)
1937 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1938 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrProfilerMark
));
1942 static const IHTMLWindow6Vtbl HTMLWindow6Vtbl
= {
1943 HTMLWindow6_QueryInterface
,
1945 HTMLWindow6_Release
,
1946 HTMLWindow6_GetTypeInfoCount
,
1947 HTMLWindow6_GetTypeInfo
,
1948 HTMLWindow6_GetIDsOfNames
,
1950 HTMLWindow6_put_XDomainRequest
,
1951 HTMLWindow6_get_XDomainRequest
,
1952 HTMLWindow6_get_sessionStorage
,
1953 HTMLWindow6_get_localStorage
,
1954 HTMLWindow6_put_onhashchange
,
1955 HTMLWindow6_get_onhashchange
,
1956 HTMLWindow6_get_maxConnectionsPerServer
,
1957 HTMLWindow6_postMessage
,
1958 HTMLWindow6_toStaticHTML
,
1959 HTMLWindow6_put_onmessage
,
1960 HTMLWindow6_get_onmessage
,
1961 HTMLWindow6_msWriteProfilerMark
1964 static inline HTMLWindow
*impl_from_IHTMLPrivateWindow(IHTMLPrivateWindow
*iface
)
1966 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLPrivateWindow_iface
);
1969 static HRESULT WINAPI
HTMLPrivateWindow_QueryInterface(IHTMLPrivateWindow
*iface
, REFIID riid
, void **ppv
)
1971 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1973 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1976 static ULONG WINAPI
HTMLPrivateWindow_AddRef(IHTMLPrivateWindow
*iface
)
1978 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1980 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1983 static ULONG WINAPI
HTMLPrivateWindow_Release(IHTMLPrivateWindow
*iface
)
1985 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1987 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1990 static HRESULT WINAPI
HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow
*iface
, BSTR url
, BSTR arg2
, BSTR arg3
,
1991 BSTR arg4
, VARIANT
*post_data_var
, VARIANT
*headers_var
, ULONG flags
)
1993 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1994 HTMLOuterWindow
*window
= This
->outer_window
;
1995 OLECHAR
*translated_url
= NULL
;
1996 DWORD post_data_size
= 0;
1997 BYTE
*post_data
= NULL
;
1998 WCHAR
*headers
= NULL
;
2002 TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This
, debugstr_w(url
), debugstr_w(arg2
), debugstr_w(arg3
), debugstr_w(arg4
),
2003 debugstr_variant(post_data_var
), debugstr_variant(headers_var
), flags
);
2005 if(window
->doc_obj
->hostui
) {
2006 hres
= IDocHostUIHandler_TranslateUrl(window
->doc_obj
->hostui
, 0, url
, &translated_url
);
2008 translated_url
= NULL
;
2011 hres
= CreateUri(translated_url
? translated_url
: url
, 0, 0, &uri
);
2012 CoTaskMemFree(translated_url
);
2017 if(V_VT(post_data_var
) == (VT_ARRAY
|VT_UI1
)) {
2018 SafeArrayAccessData(V_ARRAY(post_data_var
), (void**)&post_data
);
2019 post_data_size
= V_ARRAY(post_data_var
)->rgsabound
[0].cElements
;
2023 if(headers_var
&& V_VT(headers_var
) != VT_EMPTY
&& V_VT(headers_var
) != VT_ERROR
) {
2024 if(V_VT(headers_var
) != VT_BSTR
)
2025 return E_INVALIDARG
;
2027 headers
= V_BSTR(headers_var
);
2030 hres
= super_navigate(window
, uri
, headers
, post_data
, post_data_size
);
2033 SafeArrayUnaccessData(V_ARRAY(post_data_var
));
2038 static HRESULT WINAPI
HTMLPrivateWindow_GetPendingUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2040 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2041 FIXME("(%p)->(%p)\n", This
, url
);
2045 static HRESULT WINAPI
HTMLPrivateWindow_SetPICSTarget(IHTMLPrivateWindow
*iface
, IOleCommandTarget
*cmdtrg
)
2047 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2048 FIXME("(%p)->(%p)\n", This
, cmdtrg
);
2052 static HRESULT WINAPI
HTMLPrivateWindow_PICSComplete(IHTMLPrivateWindow
*iface
, int arg
)
2054 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2055 FIXME("(%p)->(%x)\n", This
, arg
);
2059 static HRESULT WINAPI
HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow
*iface
, LPCWSTR name
, IHTMLWindow2
**ret
)
2061 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2062 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), ret
);
2066 static HRESULT WINAPI
HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2068 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2069 TRACE("(%p)->(%p)\n", This
, url
);
2072 return E_INVALIDARG
;
2074 *url
= SysAllocString(This
->outer_window
->url
);
2078 static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl
= {
2079 HTMLPrivateWindow_QueryInterface
,
2080 HTMLPrivateWindow_AddRef
,
2081 HTMLPrivateWindow_Release
,
2082 HTMLPrivateWindow_SuperNavigate
,
2083 HTMLPrivateWindow_GetPendingUrl
,
2084 HTMLPrivateWindow_SetPICSTarget
,
2085 HTMLPrivateWindow_PICSComplete
,
2086 HTMLPrivateWindow_FindWindowByName
,
2087 HTMLPrivateWindow_GetAddressBarUrl
2090 static inline HTMLWindow
*impl_from_ITravelLogClient(ITravelLogClient
*iface
)
2092 return CONTAINING_RECORD(iface
, HTMLWindow
, ITravelLogClient_iface
);
2095 static HRESULT WINAPI
TravelLogClient_QueryInterface(ITravelLogClient
*iface
, REFIID riid
, void **ppv
)
2097 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2099 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2102 static ULONG WINAPI
TravelLogClient_AddRef(ITravelLogClient
*iface
)
2104 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2106 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2109 static ULONG WINAPI
TravelLogClient_Release(ITravelLogClient
*iface
)
2111 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2113 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2116 static HRESULT WINAPI
TravelLogClient_FindWindowByIndex(ITravelLogClient
*iface
, DWORD dwID
, IUnknown
**ppunk
)
2118 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2120 FIXME("(%p)->(%d %p) semi-stub\n", This
, dwID
, ppunk
);
2126 static HRESULT WINAPI
TravelLogClient_GetWindowData(ITravelLogClient
*iface
, IStream
*pStream
, LPWINDOWDATA pWinData
)
2128 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2129 FIXME("(%p)->(%p %p)\n", This
, pStream
, pWinData
);
2133 static HRESULT WINAPI
TravelLogClient_LoadHistoryPosition(ITravelLogClient
*iface
, LPWSTR pszUrlLocation
, DWORD dwPosition
)
2135 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2136 FIXME("(%p)->(%s %d)\n", This
, debugstr_w(pszUrlLocation
), dwPosition
);
2140 static const ITravelLogClientVtbl TravelLogClientVtbl
= {
2141 TravelLogClient_QueryInterface
,
2142 TravelLogClient_AddRef
,
2143 TravelLogClient_Release
,
2144 TravelLogClient_FindWindowByIndex
,
2145 TravelLogClient_GetWindowData
,
2146 TravelLogClient_LoadHistoryPosition
2149 static inline HTMLWindow
*impl_from_IDispatchEx(IDispatchEx
*iface
)
2151 return CONTAINING_RECORD(iface
, HTMLWindow
, IDispatchEx_iface
);
2154 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
2156 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2158 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2161 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
2163 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2165 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2168 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
2170 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2172 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2175 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
2177 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2179 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2181 return IDispatchEx_GetTypeInfoCount(&This
->inner_window
->dispex
.IDispatchEx_iface
, pctinfo
);
2184 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
2185 LCID lcid
, ITypeInfo
**ppTInfo
)
2187 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2189 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2191 return IDispatchEx_GetTypeInfo(&This
->inner_window
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2194 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
2195 LPOLESTR
*rgszNames
, UINT cNames
,
2196 LCID lcid
, DISPID
*rgDispId
)
2198 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2202 WARN("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
2205 for(i
=0; i
< cNames
; i
++) {
2206 /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
2207 hres
= IDispatchEx_GetDispID(&This
->IDispatchEx_iface
, rgszNames
[i
], 0, rgDispId
+i
);
2215 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
2216 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2217 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2219 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2221 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2222 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2224 /* FIXME: Use script dispatch */
2226 return IDispatchEx_Invoke(&This
->inner_window
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2227 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2230 static global_prop_t
*alloc_global_prop(HTMLInnerWindow
*This
, global_prop_type_t type
, BSTR name
)
2232 if(This
->global_prop_cnt
== This
->global_prop_size
) {
2233 global_prop_t
*new_props
;
2236 if(This
->global_props
) {
2237 new_size
= This
->global_prop_size
*2;
2238 new_props
= heap_realloc(This
->global_props
, new_size
*sizeof(global_prop_t
));
2241 new_props
= heap_alloc(new_size
*sizeof(global_prop_t
));
2245 This
->global_props
= new_props
;
2246 This
->global_prop_size
= new_size
;
2249 This
->global_props
[This
->global_prop_cnt
].name
= heap_strdupW(name
);
2250 if(!This
->global_props
[This
->global_prop_cnt
].name
)
2253 This
->global_props
[This
->global_prop_cnt
].type
= type
;
2254 return This
->global_props
+ This
->global_prop_cnt
++;
2257 static inline DWORD
prop_to_dispid(HTMLInnerWindow
*This
, global_prop_t
*prop
)
2259 return MSHTML_DISPID_CUSTOM_MIN
+ (prop
-This
->global_props
);
2262 HRESULT
search_window_props(HTMLInnerWindow
*This
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2265 ScriptHost
*script_host
;
2268 for(i
=0; i
< This
->global_prop_cnt
; i
++) {
2269 /* FIXME: case sensitivity */
2270 if(!strcmpW(This
->global_props
[i
].name
, bstrName
)) {
2271 *pid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
2276 if(find_global_prop(This
->base
.inner_window
, bstrName
, grfdex
, &script_host
, &id
)) {
2277 global_prop_t
*prop
;
2279 prop
= alloc_global_prop(This
, GLOBAL_SCRIPTVAR
, bstrName
);
2281 return E_OUTOFMEMORY
;
2283 prop
->script_host
= script_host
;
2286 *pid
= prop_to_dispid(This
, prop
);
2290 return DISP_E_UNKNOWNNAME
;
2293 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2295 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2296 HTMLInnerWindow
*window
= This
->inner_window
;
2299 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
2301 hres
= search_window_props(window
, bstrName
, grfdex
, pid
);
2302 if(hres
!= DISP_E_UNKNOWNNAME
)
2305 hres
= IDispatchEx_GetDispID(&window
->base
.inner_window
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
, pid
);
2306 if(hres
!= DISP_E_UNKNOWNNAME
)
2309 if(window
->base
.inner_window
->doc
) {
2310 global_prop_t
*prop
;
2313 hres
= IHTMLDocument3_getElementById(&window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2315 if(SUCCEEDED(hres
) && elem
) {
2316 IHTMLElement_Release(elem
);
2318 prop
= alloc_global_prop(window
, GLOBAL_ELEMENTVAR
, bstrName
);
2320 return E_OUTOFMEMORY
;
2322 *pid
= prop_to_dispid(window
, prop
);
2327 return DISP_E_UNKNOWNNAME
;
2330 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
2331 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
2333 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2334 HTMLOuterWindow
*window
= This
->outer_window
;
2336 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2338 if(id
== DISPID_IHTMLWINDOW2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
)) {
2339 HTMLLocation
*location
;
2342 TRACE("forwarding to location.href\n");
2344 hres
= get_location(window
, &location
);
2348 hres
= IDispatchEx_InvokeEx(&location
->dispex
.IDispatchEx_iface
, DISPID_VALUE
, lcid
,
2349 wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2350 IHTMLLocation_Release(&location
->IHTMLLocation_iface
);
2354 return IDispatchEx_InvokeEx(&window
->base
.inner_window
->dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
,
2358 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
2360 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2362 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
2364 return IDispatchEx_DeleteMemberByName(&This
->inner_window
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
2367 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
2369 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2371 TRACE("(%p)->(%x)\n", This
, id
);
2373 return IDispatchEx_DeleteMemberByDispID(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
);
2376 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
2378 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2380 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
2382 return IDispatchEx_GetMemberProperties(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
, grfdexFetch
,
2386 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
2388 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2390 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
2392 return IDispatchEx_GetMemberName(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
, pbstrName
);
2395 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
2397 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2399 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
2401 return IDispatchEx_GetNextDispID(&This
->inner_window
->dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
2404 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
2406 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2408 TRACE("(%p)->(%p)\n", This
, ppunk
);
2414 static const IDispatchExVtbl WindowDispExVtbl
= {
2415 WindowDispEx_QueryInterface
,
2416 WindowDispEx_AddRef
,
2417 WindowDispEx_Release
,
2418 WindowDispEx_GetTypeInfoCount
,
2419 WindowDispEx_GetTypeInfo
,
2420 WindowDispEx_GetIDsOfNames
,
2421 WindowDispEx_Invoke
,
2422 WindowDispEx_GetDispID
,
2423 WindowDispEx_InvokeEx
,
2424 WindowDispEx_DeleteMemberByName
,
2425 WindowDispEx_DeleteMemberByDispID
,
2426 WindowDispEx_GetMemberProperties
,
2427 WindowDispEx_GetMemberName
,
2428 WindowDispEx_GetNextDispID
,
2429 WindowDispEx_GetNameSpaceParent
2432 static inline HTMLWindow
*impl_from_IServiceProvider(IServiceProvider
*iface
)
2434 return CONTAINING_RECORD(iface
, HTMLWindow
, IServiceProvider_iface
);
2437 static HRESULT WINAPI
HTMLWindowSP_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
2439 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2440 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2443 static ULONG WINAPI
HTMLWindowSP_AddRef(IServiceProvider
*iface
)
2445 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2446 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2449 static ULONG WINAPI
HTMLWindowSP_Release(IServiceProvider
*iface
)
2451 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2452 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2455 static HRESULT WINAPI
HTMLWindowSP_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
2457 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2459 if(IsEqualGUID(guidService
, &IID_IHTMLWindow2
)) {
2460 TRACE("IID_IHTMLWindow2\n");
2461 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2464 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
2466 if(!This
->outer_window
->doc_obj
)
2467 return E_NOINTERFACE
;
2469 return IServiceProvider_QueryService(&This
->outer_window
->doc_obj
->basedoc
.IServiceProvider_iface
,
2470 guidService
, riid
, ppv
);
2473 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2474 HTMLWindowSP_QueryInterface
,
2475 HTMLWindowSP_AddRef
,
2476 HTMLWindowSP_Release
,
2477 HTMLWindowSP_QueryService
2480 static inline HTMLInnerWindow
*impl_from_DispatchEx(DispatchEx
*iface
)
2482 return CONTAINING_RECORD(iface
, HTMLInnerWindow
, dispex
);
2485 static HRESULT
HTMLWindow_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2486 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2488 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
2489 global_prop_t
*prop
;
2493 idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
2494 if(idx
>= This
->global_prop_cnt
)
2495 return DISP_E_MEMBERNOTFOUND
;
2497 prop
= This
->global_props
+idx
;
2499 switch(prop
->type
) {
2500 case GLOBAL_SCRIPTVAR
: {
2504 disp
= get_script_disp(prop
->script_host
);
2506 return E_UNEXPECTED
;
2508 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&iface
);
2509 if(SUCCEEDED(hres
)) {
2510 TRACE("%s >>>\n", debugstr_w(prop
->name
));
2511 hres
= IDispatchEx_InvokeEx(iface
, prop
->id
, lcid
, flags
, params
, res
, ei
, caller
);
2513 TRACE("%s <<<\n", debugstr_w(prop
->name
));
2515 WARN("%s <<< %08x\n", debugstr_w(prop
->name
), hres
);
2516 IDispatchEx_Release(iface
);
2518 FIXME("No IDispatchEx\n");
2520 IDispatch_Release(disp
);
2523 case GLOBAL_ELEMENTVAR
:
2525 case DISPATCH_PROPERTYGET
: {
2528 hres
= IHTMLDocument3_getElementById(&This
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2534 return DISP_E_MEMBERNOTFOUND
;
2536 V_VT(res
) = VT_DISPATCH
;
2537 V_DISPATCH(res
) = (IDispatch
*)elem
;
2540 case DISPATCH_PROPERTYPUT
: {
2543 hres
= dispex_get_dynid(&This
->dispex
, prop
->name
, &dispex_id
);
2547 prop
->type
= GLOBAL_DISPEXVAR
;
2548 prop
->id
= dispex_id
;
2549 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, dispex_id
, 0, flags
, params
, res
, ei
, caller
);
2552 FIXME("Not supported flags: %x\n", flags
);
2555 case GLOBAL_DISPEXVAR
:
2556 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, prop
->id
, 0, flags
, params
, res
, ei
, caller
);
2558 ERR("invalid type %d\n", prop
->type
);
2559 hres
= DISP_E_MEMBERNOTFOUND
;
2566 static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl
= {
2573 static const tid_t HTMLWindow_iface_tids
[] = {
2581 static dispex_static_data_t HTMLWindow_dispex
= {
2582 &HTMLWindow_dispex_vtbl
,
2583 DispHTMLWindow2_tid
,
2585 HTMLWindow_iface_tids
2588 static void *alloc_window(size_t size
)
2592 window
= heap_alloc_zero(size
);
2596 window
->IHTMLWindow2_iface
.lpVtbl
= &HTMLWindow2Vtbl
;
2597 window
->IHTMLWindow3_iface
.lpVtbl
= &HTMLWindow3Vtbl
;
2598 window
->IHTMLWindow4_iface
.lpVtbl
= &HTMLWindow4Vtbl
;
2599 window
->IHTMLWindow5_iface
.lpVtbl
= &HTMLWindow5Vtbl
;
2600 window
->IHTMLWindow6_iface
.lpVtbl
= &HTMLWindow6Vtbl
;
2601 window
->IHTMLPrivateWindow_iface
.lpVtbl
= &HTMLPrivateWindowVtbl
;
2602 window
->IDispatchEx_iface
.lpVtbl
= &WindowDispExVtbl
;
2603 window
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
2604 window
->ITravelLogClient_iface
.lpVtbl
= &TravelLogClientVtbl
;
2610 static HRESULT
create_inner_window(HTMLOuterWindow
*outer_window
, HTMLInnerWindow
**ret
)
2612 HTMLInnerWindow
*window
;
2614 window
= alloc_window(sizeof(HTMLInnerWindow
));
2616 return E_OUTOFMEMORY
;
2618 list_init(&window
->script_hosts
);
2619 list_init(&window
->bindings
);
2621 window
->base
.outer_window
= outer_window
;
2622 window
->base
.inner_window
= window
;
2624 init_dispex(&window
->dispex
, (IUnknown
*)&window
->base
.IHTMLWindow2_iface
, &HTMLWindow_dispex
);
2626 window
->task_magic
= get_task_target_magic();
2632 HRESULT
HTMLOuterWindow_Create(HTMLDocumentObj
*doc_obj
, nsIDOMWindow
*nswindow
,
2633 HTMLOuterWindow
*parent
, HTMLOuterWindow
**ret
)
2635 HTMLOuterWindow
*window
;
2638 window
= alloc_window(sizeof(HTMLOuterWindow
));
2640 return E_OUTOFMEMORY
;
2642 window
->base
.outer_window
= window
;
2643 window
->base
.inner_window
= NULL
;
2645 window
->window_ref
= heap_alloc(sizeof(windowref_t
));
2646 if(!window
->window_ref
) {
2648 return E_OUTOFMEMORY
;
2651 window
->doc_obj
= doc_obj
;
2653 window
->window_ref
->window
= window
;
2654 window
->window_ref
->ref
= 1;
2657 nsIDOMWindow_AddRef(nswindow
);
2658 window
->nswindow
= nswindow
;
2661 window
->scriptmode
= parent
? parent
->scriptmode
: SCRIPTMODE_GECKO
;
2662 window
->readystate
= READYSTATE_UNINITIALIZED
;
2664 hres
= create_pending_window(window
, NULL
);
2666 hres
= update_window_doc(window
->pending_window
);
2668 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
2672 hres
= CoInternetCreateSecurityManager(NULL
, &window
->secmgr
, 0);
2674 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
2678 window
->task_magic
= get_task_target_magic();
2680 list_init(&window
->children
);
2681 list_add_head(&window_list
, &window
->entry
);
2684 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
2686 window
->parent
= parent
;
2687 list_add_tail(&parent
->children
, &window
->sibling_entry
);
2690 TRACE("%p inner_window %p\n", window
, window
->base
.inner_window
);
2696 HRESULT
create_pending_window(HTMLOuterWindow
*outer_window
, nsChannelBSC
*channelbsc
)
2698 HTMLInnerWindow
*pending_window
;
2701 hres
= create_inner_window(outer_window
, &pending_window
);
2706 IBindStatusCallback_AddRef(&channelbsc
->bsc
.IBindStatusCallback_iface
);
2707 pending_window
->bscallback
= channelbsc
;
2710 if(outer_window
->pending_window
) {
2711 abort_window_bindings(outer_window
->pending_window
);
2712 outer_window
->pending_window
->base
.outer_window
= NULL
;
2713 IHTMLWindow2_Release(&outer_window
->pending_window
->base
.IHTMLWindow2_iface
);
2716 outer_window
->pending_window
= pending_window
;
2720 HRESULT
update_window_doc(HTMLInnerWindow
*window
)
2722 HTMLOuterWindow
*outer_window
= window
->base
.outer_window
;
2723 nsIDOMHTMLDocument
*nshtmldoc
;
2724 nsIDOMDocument
*nsdoc
;
2728 assert(!window
->doc
);
2731 ERR("NULL outer window\n");
2732 return E_UNEXPECTED
;
2735 nsres
= nsIDOMWindow_GetDocument(outer_window
->nswindow
, &nsdoc
);
2736 if(NS_FAILED(nsres
) || !nsdoc
) {
2737 ERR("GetDocument failed: %08x\n", nsres
);
2741 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
2742 nsIDOMDocument_Release(nsdoc
);
2743 if(NS_FAILED(nsres
)) {
2744 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
2748 hres
= create_doc_from_nsdoc(nshtmldoc
, outer_window
->doc_obj
, outer_window
, &window
->doc
);
2749 nsIDOMHTMLDocument_Release(nshtmldoc
);
2753 if(outer_window
->doc_obj
->usermode
== EDITMODE
) {
2757 static const PRUnichar onW
[] = {'o','n',0};
2759 nsAString_Init(&mode_str
, onW
);
2760 nsres
= nsIDOMHTMLDocument_SetDesignMode(window
->doc
->nsdoc
, &mode_str
);
2761 nsAString_Finish(&mode_str
);
2762 if(NS_FAILED(nsres
))
2763 ERR("SetDesignMode failed: %08x\n", nsres
);
2766 if(window
!= outer_window
->pending_window
) {
2767 ERR("not current pending window\n");
2771 detach_inner_window(outer_window
);
2772 outer_window
->base
.inner_window
= window
;
2773 outer_window
->pending_window
= NULL
;
2775 if(outer_window
->doc_obj
->basedoc
.window
== outer_window
|| !outer_window
->doc_obj
->basedoc
.window
) {
2776 if(outer_window
->doc_obj
->basedoc
.doc_node
)
2777 htmldoc_release(&outer_window
->doc_obj
->basedoc
.doc_node
->basedoc
);
2778 outer_window
->doc_obj
->basedoc
.doc_node
= window
->doc
;
2779 htmldoc_addref(&window
->doc
->basedoc
);
2785 HTMLOuterWindow
*nswindow_to_window(const nsIDOMWindow
*nswindow
)
2787 HTMLOuterWindow
*iter
;
2789 LIST_FOR_EACH_ENTRY(iter
, &window_list
, HTMLOuterWindow
, entry
) {
2790 if(iter
->nswindow
== nswindow
)