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 This
->doc
->window
= NULL
;
244 htmldoc_release(&This
->doc
->basedoc
);
247 release_dispex(&This
->dispex
);
249 for(i
=0; i
< This
->global_prop_cnt
; i
++)
250 heap_free(This
->global_props
[i
].name
);
251 heap_free(This
->global_props
);
253 if(This
->image_factory
) {
254 This
->image_factory
->window
= NULL
;
255 IHTMLImageElementFactory_Release(&This
->image_factory
->IHTMLImageElementFactory_iface
);
258 if(This
->option_factory
) {
259 This
->option_factory
->window
= NULL
;
260 IHTMLOptionElementFactory_Release(&This
->option_factory
->IHTMLOptionElementFactory_iface
);
264 IHTMLScreen_Release(This
->screen
);
266 IOmHistory_Release(This
->history
);
271 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
273 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
274 LONG ref
= InterlockedDecrement(&This
->ref
);
276 TRACE("(%p) ref=%d\n", This
, ref
);
279 if(is_outer_window(This
))
280 release_outer_window(This
->outer_window
);
282 release_inner_window(This
->inner_window
);
288 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
290 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
292 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
295 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
296 LCID lcid
, ITypeInfo
**ppTInfo
)
298 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
300 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
303 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
304 LPOLESTR
*rgszNames
, UINT cNames
,
305 LCID lcid
, DISPID
*rgDispId
)
307 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
309 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
313 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
314 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
315 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
317 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
319 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
320 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
323 static HRESULT
get_frame_by_index(nsIDOMWindowCollection
*nsFrames
, PRUint32 index
, HTMLOuterWindow
**ret
)
326 nsIDOMWindow
*nsWindow
;
329 nsres
= nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
330 if(NS_FAILED(nsres
)) {
331 FIXME("nsIDOMWindowCollection_GetLength failed: 0x%08x\n", nsres
);
336 return DISP_E_MEMBERNOTFOUND
;
338 nsres
= nsIDOMWindowCollection_Item(nsFrames
, index
, &nsWindow
);
339 if(NS_FAILED(nsres
)) {
340 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
344 *ret
= nswindow_to_window(nsWindow
);
346 nsIDOMWindow_Release(nsWindow
);
351 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
353 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
354 nsIDOMWindowCollection
*nsFrames
;
355 HTMLOuterWindow
*window
= NULL
;
359 TRACE("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
361 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nsFrames
);
362 if(NS_FAILED(nsres
)) {
363 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
367 switch(V_VT(pvarIndex
)) {
369 int index
= V_I4(pvarIndex
);
370 TRACE("Getting index %d\n", index
);
373 hres
= get_frame_by_index(nsFrames
, index
, &window
);
377 unsigned int index
= V_UINT(pvarIndex
);
378 TRACE("Getting index %u\n", index
);
379 hres
= get_frame_by_index(nsFrames
, index
, &window
);
383 BSTR str
= V_BSTR(pvarIndex
);
386 TRACE("Getting name %s\n", wine_dbgstr_w(str
));
388 nsIDOMWindowCollection_GetLength(nsFrames
, &length
);
391 for(i
= 0; i
< length
&& !window
; ++i
) {
392 HTMLOuterWindow
*cur_window
;
393 nsIDOMWindow
*nsWindow
;
396 nsres
= nsIDOMWindowCollection_Item(nsFrames
, i
, &nsWindow
);
397 if(NS_FAILED(nsres
)) {
398 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
403 cur_window
= nswindow_to_window(nsWindow
);
405 nsIDOMWindow_Release(nsWindow
);
407 hres
= IHTMLElement_get_id(&cur_window
->frame_element
->element
.IHTMLElement_iface
, &id
);
409 FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres
);
413 if(!strcmpW(id
, str
))
424 nsIDOMWindowCollection_Release(nsFrames
);
428 return DISP_E_MEMBERNOTFOUND
;
430 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
431 V_VT(pvarResult
) = VT_DISPATCH
;
432 V_DISPATCH(pvarResult
) = (IDispatch
*)window
;
436 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, LONG
*p
)
438 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
439 nsIDOMWindowCollection
*nscollection
;
443 TRACE("(%p)->(%p)\n", This
, p
);
445 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nscollection
);
446 if(NS_FAILED(nsres
)) {
447 ERR("GetFrames failed: %08x\n", nsres
);
451 nsres
= nsIDOMWindowCollection_GetLength(nscollection
, &length
);
452 nsIDOMWindowCollection_Release(nscollection
);
453 if(NS_FAILED(nsres
)) {
454 ERR("GetLength failed: %08x\n", nsres
);
462 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
464 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
465 FIXME("(%p)->(%p): semi-stub\n", This
, p
);
467 /* FIXME: Should return a separate Window object */
468 *p
= (IHTMLFramesCollection2
*)&This
->IHTMLWindow2_iface
;
469 HTMLWindow2_AddRef(iface
);
473 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
475 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
476 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
480 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
482 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
483 FIXME("(%p)->(%p)\n", This
, p
);
487 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
489 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
491 WARN("(%p)->(%s)\n", This
, debugstr_w(v
));
494 * FIXME: Since IE7, setting status is blocked, but still possible in certain circumstances.
495 * Ignoring the call should be enough for us.
500 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
502 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
504 TRACE("(%p)->(%p)\n", This
, p
);
511 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
512 LONG msec
, VARIANT
*language
, LONG
*timerID
)
514 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
517 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
519 V_VT(&expr_var
) = VT_BSTR
;
520 V_BSTR(&expr_var
) = expression
;
522 return IHTMLWindow3_setTimeout(&This
->IHTMLWindow3_iface
, &expr_var
, msec
, language
, timerID
);
525 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, LONG timerID
)
527 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
529 TRACE("(%p)->(%d)\n", This
, timerID
);
531 return clear_task_timer(&This
->inner_window
->doc
->basedoc
, FALSE
, timerID
);
534 #define MAX_MESSAGE_LEN 2000
536 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
538 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
539 WCHAR title
[100], *msg
= message
;
542 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
544 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, title
,
545 sizeof(title
)/sizeof(WCHAR
))) {
546 WARN("Could not load message box title: %d\n", GetLastError());
550 len
= SysStringLen(message
);
551 if(len
> MAX_MESSAGE_LEN
) {
552 msg
= heap_alloc((MAX_MESSAGE_LEN
+1)*sizeof(WCHAR
));
554 return E_OUTOFMEMORY
;
555 memcpy(msg
, message
, MAX_MESSAGE_LEN
*sizeof(WCHAR
));
556 msg
[MAX_MESSAGE_LEN
] = 0;
559 MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, msg
, title
, MB_ICONWARNING
);
565 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
566 VARIANT_BOOL
*confirmed
)
568 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
571 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
573 if(!confirmed
) return E_INVALIDARG
;
575 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
576 sizeof(wszTitle
)/sizeof(WCHAR
))) {
577 WARN("Could not load message box title: %d\n", GetLastError());
578 *confirmed
= VARIANT_TRUE
;
582 if(MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, message
, wszTitle
,
583 MB_OKCANCEL
|MB_ICONQUESTION
)==IDOK
)
584 *confirmed
= VARIANT_TRUE
;
585 else *confirmed
= VARIANT_FALSE
;
597 static INT_PTR CALLBACK
prompt_dlgproc(HWND hwnd
, UINT msg
,
598 WPARAM wparam
, LPARAM lparam
)
604 prompt_arg
*arg
= (prompt_arg
*)lparam
;
607 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
608 sizeof(wszTitle
)/sizeof(WCHAR
))) {
609 WARN("Could not load message box title: %d\n", GetLastError());
610 EndDialog(hwnd
, wparam
);
614 SetWindowLongPtrW(hwnd
, DWLP_USER
, lparam
);
615 SetWindowTextW(hwnd
, wszTitle
);
616 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_PROMPT
), arg
->message
);
617 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_EDIT
), arg
->dststr
);
623 case MAKEWPARAM(IDCANCEL
, BN_CLICKED
):
624 EndDialog(hwnd
, wparam
);
626 case MAKEWPARAM(IDOK
, BN_CLICKED
):
629 (prompt_arg
*)GetWindowLongPtrW(hwnd
, DWLP_USER
);
630 HWND hwndPrompt
= GetDlgItem(hwnd
, ID_PROMPT_EDIT
);
631 INT len
= GetWindowTextLengthW(hwndPrompt
);
635 EndDialog(hwnd
, wparam
);
639 V_VT(arg
->textdata
) = VT_BSTR
;
640 if(!len
&& !arg
->dststr
)
641 V_BSTR(arg
->textdata
) = NULL
;
644 V_BSTR(arg
->textdata
) = SysAllocStringLen(NULL
, len
);
645 GetWindowTextW(hwndPrompt
, V_BSTR(arg
->textdata
), len
+1);
647 EndDialog(hwnd
, wparam
);
653 EndDialog(hwnd
, IDCANCEL
);
660 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
661 BSTR dststr
, VARIANT
*textdata
)
663 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
666 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
668 if(textdata
) V_VT(textdata
) = VT_NULL
;
670 arg
.message
= message
;
672 arg
.textdata
= textdata
;
674 DialogBoxParamW(hInst
, MAKEINTRESOURCEW(ID_PROMPT_DIALOG
),
675 This
->outer_window
->doc_obj
->hwnd
, prompt_dlgproc
, (LPARAM
)&arg
);
679 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
681 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
682 HTMLInnerWindow
*window
= This
->inner_window
;
684 TRACE("(%p)->(%p)\n", This
, p
);
686 if(!window
->image_factory
) {
689 hres
= HTMLImageElementFactory_Create(window
, &window
->image_factory
);
694 *p
= &window
->image_factory
->IHTMLImageElementFactory_iface
;
695 IHTMLImageElementFactory_AddRef(*p
);
700 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
702 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
703 HTMLLocation
*location
;
706 TRACE("(%p)->(%p)\n", This
, p
);
708 hres
= get_location(This
->outer_window
, &location
);
712 *p
= &location
->IHTMLLocation_iface
;
716 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
718 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
719 HTMLInnerWindow
*window
= This
->inner_window
;
721 TRACE("(%p)->(%p)\n", This
, p
);
723 if(!window
->history
) {
726 hres
= create_history(&window
->history
);
731 IOmHistory_AddRef(window
->history
);
732 *p
= window
->history
;
736 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
738 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
739 FIXME("(%p)->()\n", This
);
743 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
745 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
746 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
750 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
752 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
754 FIXME("(%p)->(%p) returning empty\n", This
, p
);
760 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
762 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
764 TRACE("(%p)->(%p)\n", This
, p
);
766 *p
= OmNavigator_Create();
770 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
772 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
776 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
778 nsAString_InitDepend(&name_str
, v
);
779 nsres
= nsIDOMWindow_SetName(This
->outer_window
->nswindow
, &name_str
);
780 nsAString_Finish(&name_str
);
782 ERR("SetName failed: %08x\n", nsres
);
787 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
789 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
793 TRACE("(%p)->(%p)\n", This
, p
);
795 nsAString_Init(&name_str
, NULL
);
796 nsres
= nsIDOMWindow_GetName(This
->outer_window
->nswindow
, &name_str
);
797 return return_nsstr(nsres
, &name_str
, p
);
800 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
802 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
803 HTMLOuterWindow
*window
= This
->outer_window
;
805 TRACE("(%p)->(%p)\n", This
, p
);
808 return IHTMLWindow2_get_self(&This
->IHTMLWindow2_iface
, p
);
810 *p
= &window
->parent
->base
.IHTMLWindow2_iface
;
811 IHTMLWindow2_AddRef(*p
);
815 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
816 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
818 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
819 HTMLOuterWindow
*window
= This
->outer_window
;
820 INewWindowManager
*new_window_mgr
;
824 TRACE("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
825 debugstr_w(features
), replace
, pomWindowResult
);
830 if(name
&& *name
== '_') {
831 FIXME("Unsupported name %s\n", debugstr_w(name
));
835 hres
= do_query_service((IUnknown
*)window
->doc_obj
->client
, &SID_SNewWindowManager
, &IID_INewWindowManager
,
836 (void**)&new_window_mgr
);
838 FIXME("No INewWindowManager\n");
842 hres
= INewWindowManager_EvaluateNewWindow(new_window_mgr
, url
, name
, window
->url
,
843 features
, !!replace
, window
->doc_obj
->has_popup
? 0 : NWMF_FIRST
, 0);
844 INewWindowManager_Release(new_window_mgr
);
845 window
->doc_obj
->has_popup
= TRUE
;
847 *pomWindowResult
= NULL
;
851 hres
= create_relative_uri(window
, url
, &uri
);
855 hres
= navigate_new_window(window
, uri
, name
, pomWindowResult
);
860 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
862 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
864 TRACE("(%p)->(%p)\n", This
, p
);
866 /* FIXME: We should return kind of proxy window here. */
867 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
868 *p
= &This
->IHTMLWindow2_iface
;
872 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
874 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
875 HTMLOuterWindow
*top
;
877 TRACE("(%p)->(%p)\n", This
, p
);
879 get_top_window(This
->outer_window
, &top
);
880 *p
= &top
->base
.IHTMLWindow2_iface
;
881 IHTMLWindow2_AddRef(*p
);
886 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
888 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
890 TRACE("(%p)->(%p)\n", This
, p
);
892 /* FIXME: We should return kind of proxy window here. */
893 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
894 *p
= &This
->IHTMLWindow2_iface
;
898 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
900 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
901 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
905 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
907 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
908 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
912 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
914 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
915 FIXME("(%p)->(%p)\n", This
, p
);
919 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
921 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
922 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
926 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
928 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
929 FIXME("(%p)->(%p)\n", This
, p
);
933 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
935 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
937 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
939 return set_window_event(This
, EVENTID_LOAD
, &v
);
942 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
944 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
946 TRACE("(%p)->(%p)\n", This
, p
);
948 return get_window_event(This
, EVENTID_LOAD
, p
);
951 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
953 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
955 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
957 return set_window_event(This
, EVENTID_BEFOREUNLOAD
, &v
);
960 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
962 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
964 TRACE("(%p)->(%p)\n", This
, p
);
966 return get_window_event(This
, EVENTID_BEFOREUNLOAD
, p
);
969 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
971 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
972 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
976 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
978 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
979 FIXME("(%p)->(%p)\n", This
, p
);
983 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
985 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
986 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
990 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
992 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
993 FIXME("(%p)->(%p)\n", This
, p
);
997 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
999 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1001 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1003 return set_window_event(This
, EVENTID_ERROR
, &v
);
1006 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
1008 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1010 TRACE("(%p)->(%p)\n", This
, p
);
1012 return get_window_event(This
, EVENTID_ERROR
, p
);
1015 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
1017 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1019 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1021 return set_window_event(This
, EVENTID_RESIZE
, &v
);
1024 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
1026 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1028 TRACE("(%p)->(%p)\n", This
, p
);
1030 return get_window_event(This
, EVENTID_RESIZE
, p
);
1033 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
1035 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1036 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1040 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
1042 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1043 FIXME("(%p)->(%p)\n", This
, p
);
1047 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
1049 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1051 TRACE("(%p)->(%p)\n", This
, p
);
1053 if(This
->inner_window
->doc
) {
1054 /* FIXME: We should return a wrapper object here */
1055 *p
= &This
->inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1056 IHTMLDocument2_AddRef(*p
);
1064 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
1066 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1067 HTMLInnerWindow
*window
= This
->inner_window
;
1069 TRACE("(%p)->(%p)\n", This
, p
);
1072 IHTMLEventObj_AddRef(window
->event
);
1077 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
1079 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1080 FIXME("(%p)->(%p)\n", This
, p
);
1084 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
1085 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
1087 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1088 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
1092 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
1095 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1096 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(helpURL
), debugstr_variant(&helpArg
), debugstr_w(features
));
1100 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
1102 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1103 HTMLInnerWindow
*window
= This
->inner_window
;
1105 TRACE("(%p)->(%p)\n", This
, p
);
1107 if(!window
->screen
) {
1110 hres
= HTMLScreen_Create(&window
->screen
);
1115 *p
= window
->screen
;
1116 IHTMLScreen_AddRef(window
->screen
);
1120 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
1122 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1123 HTMLInnerWindow
*window
= This
->inner_window
;
1125 TRACE("(%p)->(%p)\n", This
, p
);
1127 if(!window
->option_factory
) {
1130 hres
= HTMLOptionElementFactory_Create(window
, &window
->option_factory
);
1135 *p
= &window
->option_factory
->IHTMLOptionElementFactory_iface
;
1136 IHTMLOptionElementFactory_AddRef(*p
);
1141 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
1143 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1145 TRACE("(%p)->()\n", This
);
1147 if(This
->outer_window
->doc_obj
)
1148 SetFocus(This
->outer_window
->doc_obj
->hwnd
);
1152 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
1154 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1155 FIXME("(%p)->(%p)\n", This
, p
);
1159 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
1161 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1162 FIXME("(%p)->()\n", This
);
1166 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1168 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1169 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1173 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
1175 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1176 FIXME("(%p)->(%p)\n", This
, p
);
1180 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
1181 LONG msec
, VARIANT
*language
, LONG
*timerID
)
1183 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1186 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
1188 V_VT(&expr
) = VT_BSTR
;
1189 V_BSTR(&expr
) = expression
;
1190 return IHTMLWindow3_setInterval(&This
->IHTMLWindow3_iface
, &expr
, msec
, language
, timerID
);
1193 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, LONG timerID
)
1195 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1197 TRACE("(%p)->(%d)\n", This
, timerID
);
1199 return clear_task_timer(&This
->inner_window
->doc
->basedoc
, TRUE
, timerID
);
1202 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
1204 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1205 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1209 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
1211 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1212 FIXME("(%p)->(%p)\n", This
, p
);
1216 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
1219 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1221 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
1223 return exec_script(This
->inner_window
, scode
, language
, pvarRet
);
1226 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
1228 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1230 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1232 TRACE("(%p)->(%p)\n", This
, String
);
1235 return E_INVALIDARG
;
1237 *String
= SysAllocString(objectW
);
1238 return *String
? S_OK
: E_OUTOFMEMORY
;
1241 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1243 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1246 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1248 nsres
= nsIDOMWindow_ScrollBy(This
->outer_window
->nswindow
, x
, y
);
1249 if(NS_FAILED(nsres
))
1250 ERR("ScrollBy failed: %08x\n", nsres
);
1255 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1257 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1260 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1262 nsres
= nsIDOMWindow_ScrollTo(This
->outer_window
->nswindow
, x
, y
);
1263 if(NS_FAILED(nsres
))
1264 ERR("ScrollTo failed: %08x\n", nsres
);
1269 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1271 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1272 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1276 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1278 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1279 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1283 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1285 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1286 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1290 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1292 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1293 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1297 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
1299 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1301 TRACE("(%p)->(%p)\n", This
, p
);
1305 if(!This
->outer_window
->doc_obj
->hostui
)
1308 return IDocHostUIHandler_GetExternal(This
->outer_window
->doc_obj
->hostui
, p
);
1311 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
1312 HTMLWindow2_QueryInterface
,
1314 HTMLWindow2_Release
,
1315 HTMLWindow2_GetTypeInfoCount
,
1316 HTMLWindow2_GetTypeInfo
,
1317 HTMLWindow2_GetIDsOfNames
,
1320 HTMLWindow2_get_length
,
1321 HTMLWindow2_get_frames
,
1322 HTMLWindow2_put_defaultStatus
,
1323 HTMLWindow2_get_defaultStatus
,
1324 HTMLWindow2_put_status
,
1325 HTMLWindow2_get_status
,
1326 HTMLWindow2_setTimeout
,
1327 HTMLWindow2_clearTimeout
,
1329 HTMLWindow2_confirm
,
1331 HTMLWindow2_get_Image
,
1332 HTMLWindow2_get_location
,
1333 HTMLWindow2_get_history
,
1335 HTMLWindow2_put_opener
,
1336 HTMLWindow2_get_opener
,
1337 HTMLWindow2_get_navigator
,
1338 HTMLWindow2_put_name
,
1339 HTMLWindow2_get_name
,
1340 HTMLWindow2_get_parent
,
1342 HTMLWindow2_get_self
,
1343 HTMLWindow2_get_top
,
1344 HTMLWindow2_get_window
,
1345 HTMLWindow2_navigate
,
1346 HTMLWindow2_put_onfocus
,
1347 HTMLWindow2_get_onfocus
,
1348 HTMLWindow2_put_onblur
,
1349 HTMLWindow2_get_onblur
,
1350 HTMLWindow2_put_onload
,
1351 HTMLWindow2_get_onload
,
1352 HTMLWindow2_put_onbeforeunload
,
1353 HTMLWindow2_get_onbeforeunload
,
1354 HTMLWindow2_put_onunload
,
1355 HTMLWindow2_get_onunload
,
1356 HTMLWindow2_put_onhelp
,
1357 HTMLWindow2_get_onhelp
,
1358 HTMLWindow2_put_onerror
,
1359 HTMLWindow2_get_onerror
,
1360 HTMLWindow2_put_onresize
,
1361 HTMLWindow2_get_onresize
,
1362 HTMLWindow2_put_onscroll
,
1363 HTMLWindow2_get_onscroll
,
1364 HTMLWindow2_get_document
,
1365 HTMLWindow2_get_event
,
1366 HTMLWindow2_get__newEnum
,
1367 HTMLWindow2_showModalDialog
,
1368 HTMLWindow2_showHelp
,
1369 HTMLWindow2_get_screen
,
1370 HTMLWindow2_get_Option
,
1372 HTMLWindow2_get_closed
,
1375 HTMLWindow2_get_clientInformation
,
1376 HTMLWindow2_setInterval
,
1377 HTMLWindow2_clearInterval
,
1378 HTMLWindow2_put_offscreenBuffering
,
1379 HTMLWindow2_get_offscreenBuffering
,
1380 HTMLWindow2_execScript
,
1381 HTMLWindow2_toString
,
1382 HTMLWindow2_scrollBy
,
1383 HTMLWindow2_scrollTo
,
1386 HTMLWindow2_resizeTo
,
1387 HTMLWindow2_resizeBy
,
1388 HTMLWindow2_get_external
1391 static inline HTMLWindow
*impl_from_IHTMLWindow3(IHTMLWindow3
*iface
)
1393 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow3_iface
);
1396 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
1398 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1400 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1403 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
1405 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1407 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1410 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
1412 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1414 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1417 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
1419 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1421 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1424 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
1425 LCID lcid
, ITypeInfo
**ppTInfo
)
1427 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1429 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1432 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
1433 LPOLESTR
*rgszNames
, UINT cNames
,
1434 LCID lcid
, DISPID
*rgDispId
)
1436 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1438 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1442 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
1443 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1444 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1446 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1448 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1449 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1452 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, LONG
*p
)
1454 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1455 FIXME("(%p)->(%p)\n", This
, p
);
1459 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, LONG
*p
)
1461 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1462 FIXME("(%p)->(%p)\n", This
, p
);
1466 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
1468 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1469 HTMLInnerWindow
*window
= This
->inner_window
;
1471 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
1474 FIXME("No document\n");
1478 return attach_event(&window
->doc
->body_event_target
, NULL
, &window
->doc
->basedoc
, event
, pDisp
, pfResult
);
1481 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
1483 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1484 HTMLInnerWindow
*window
= This
->inner_window
;
1486 TRACE("(%p)->()\n", This
);
1489 FIXME("No document\n");
1493 return detach_event(window
->doc
->body_event_target
, &window
->doc
->basedoc
, event
, pDisp
);
1496 static HRESULT
window_set_timer(HTMLInnerWindow
*This
, VARIANT
*expr
, LONG msec
, VARIANT
*language
,
1497 BOOL interval
, LONG
*timer_id
)
1499 IDispatch
*disp
= NULL
;
1501 switch(V_VT(expr
)) {
1503 disp
= V_DISPATCH(expr
);
1504 IDispatch_AddRef(disp
);
1508 disp
= script_parse_event(This
->base
.inner_window
, V_BSTR(expr
));
1512 FIXME("unimplemented expr %s\n", debugstr_variant(expr
));
1519 *timer_id
= set_task_timer(&This
->doc
->basedoc
, msec
, interval
, disp
);
1520 IDispatch_Release(disp
);
1525 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1526 VARIANT
*language
, LONG
*timerID
)
1528 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1530 TRACE("(%p)->(%s %d %s %p)\n", This
, debugstr_variant(expression
), msec
, debugstr_variant(language
), timerID
);
1532 return window_set_timer(This
->inner_window
, expression
, msec
, language
, FALSE
, timerID
);
1535 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1536 VARIANT
*language
, LONG
*timerID
)
1538 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1540 TRACE("(%p)->(%p %d %p %p)\n", This
, expression
, msec
, language
, timerID
);
1542 return window_set_timer(This
->inner_window
, expression
, msec
, language
, TRUE
, timerID
);
1545 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
1547 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1548 FIXME("(%p)\n", This
);
1552 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
1554 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1555 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1559 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1561 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1562 FIXME("(%p)->(%p)\n", This
, p
);
1566 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
1568 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1569 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1573 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1575 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1576 FIXME("(%p)->(%p)\n", This
, p
);
1580 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
1582 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1583 FIXME("(%p)->(%p)\n", This
, p
);
1587 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
1588 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
1590 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1591 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
1595 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
1596 HTMLWindow3_QueryInterface
,
1598 HTMLWindow3_Release
,
1599 HTMLWindow3_GetTypeInfoCount
,
1600 HTMLWindow3_GetTypeInfo
,
1601 HTMLWindow3_GetIDsOfNames
,
1603 HTMLWindow3_get_screenLeft
,
1604 HTMLWindow3_get_screenTop
,
1605 HTMLWindow3_attachEvent
,
1606 HTMLWindow3_detachEvent
,
1607 HTMLWindow3_setTimeout
,
1608 HTMLWindow3_setInterval
,
1610 HTMLWindow3_put_onbeforeprint
,
1611 HTMLWindow3_get_onbeforeprint
,
1612 HTMLWindow3_put_onafterprint
,
1613 HTMLWindow3_get_onafterprint
,
1614 HTMLWindow3_get_clipboardData
,
1615 HTMLWindow3_showModelessDialog
1618 static inline HTMLWindow
*impl_from_IHTMLWindow4(IHTMLWindow4
*iface
)
1620 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow4_iface
);
1623 static HRESULT WINAPI
HTMLWindow4_QueryInterface(IHTMLWindow4
*iface
, REFIID riid
, void **ppv
)
1625 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1627 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1630 static ULONG WINAPI
HTMLWindow4_AddRef(IHTMLWindow4
*iface
)
1632 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1634 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1637 static ULONG WINAPI
HTMLWindow4_Release(IHTMLWindow4
*iface
)
1639 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1641 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1644 static HRESULT WINAPI
HTMLWindow4_GetTypeInfoCount(IHTMLWindow4
*iface
, UINT
*pctinfo
)
1646 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1648 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1651 static HRESULT WINAPI
HTMLWindow4_GetTypeInfo(IHTMLWindow4
*iface
, UINT iTInfo
,
1652 LCID lcid
, ITypeInfo
**ppTInfo
)
1654 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1656 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1659 static HRESULT WINAPI
HTMLWindow4_GetIDsOfNames(IHTMLWindow4
*iface
, REFIID riid
,
1660 LPOLESTR
*rgszNames
, UINT cNames
,
1661 LCID lcid
, DISPID
*rgDispId
)
1663 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1665 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1669 static HRESULT WINAPI
HTMLWindow4_Invoke(IHTMLWindow4
*iface
, DISPID dispIdMember
,
1670 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1671 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1673 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1675 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1676 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1679 static HRESULT WINAPI
HTMLWindow4_createPopup(IHTMLWindow4
*iface
, VARIANT
*varArgIn
,
1680 IDispatch
**ppPopup
)
1682 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1683 FIXME("(%p)->(%p %p)\n", This
, varArgIn
, ppPopup
);
1687 static HRESULT WINAPI
HTMLWindow4_get_frameElement(IHTMLWindow4
*iface
, IHTMLFrameBase
**p
)
1689 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1690 TRACE("(%p)->(%p)\n", This
, p
);
1692 if(This
->outer_window
->frame_element
) {
1693 *p
= &This
->outer_window
->frame_element
->IHTMLFrameBase_iface
;
1694 IHTMLFrameBase_AddRef(*p
);
1701 static const IHTMLWindow4Vtbl HTMLWindow4Vtbl
= {
1702 HTMLWindow4_QueryInterface
,
1704 HTMLWindow4_Release
,
1705 HTMLWindow4_GetTypeInfoCount
,
1706 HTMLWindow4_GetTypeInfo
,
1707 HTMLWindow4_GetIDsOfNames
,
1709 HTMLWindow4_createPopup
,
1710 HTMLWindow4_get_frameElement
1713 static inline HTMLWindow
*impl_from_IHTMLWindow5(IHTMLWindow5
*iface
)
1715 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow5_iface
);
1718 static HRESULT WINAPI
HTMLWindow5_QueryInterface(IHTMLWindow5
*iface
, REFIID riid
, void **ppv
)
1720 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1722 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1725 static ULONG WINAPI
HTMLWindow5_AddRef(IHTMLWindow5
*iface
)
1727 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1729 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1732 static ULONG WINAPI
HTMLWindow5_Release(IHTMLWindow5
*iface
)
1734 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1736 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1739 static HRESULT WINAPI
HTMLWindow5_GetTypeInfoCount(IHTMLWindow5
*iface
, UINT
*pctinfo
)
1741 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1743 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1746 static HRESULT WINAPI
HTMLWindow5_GetTypeInfo(IHTMLWindow5
*iface
, UINT iTInfo
,
1747 LCID lcid
, ITypeInfo
**ppTInfo
)
1749 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1751 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1754 static HRESULT WINAPI
HTMLWindow5_GetIDsOfNames(IHTMLWindow5
*iface
, REFIID riid
,
1755 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1757 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1759 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1763 static HRESULT WINAPI
HTMLWindow5_Invoke(IHTMLWindow5
*iface
, DISPID dispIdMember
,
1764 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1765 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1767 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1769 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1770 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1773 static HRESULT WINAPI
HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT v
)
1775 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1776 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1780 static HRESULT WINAPI
HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT
*p
)
1782 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1783 FIXME("(%p)->(%p)\n", This
, p
);
1787 static const IHTMLWindow5Vtbl HTMLWindow5Vtbl
= {
1788 HTMLWindow5_QueryInterface
,
1790 HTMLWindow5_Release
,
1791 HTMLWindow5_GetTypeInfoCount
,
1792 HTMLWindow5_GetTypeInfo
,
1793 HTMLWindow5_GetIDsOfNames
,
1795 HTMLWindow5_put_XMLHttpRequest
,
1796 HTMLWindow5_get_XMLHttpRequest
1799 static inline HTMLWindow
*impl_from_IHTMLWindow6(IHTMLWindow6
*iface
)
1801 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow6_iface
);
1804 static HRESULT WINAPI
HTMLWindow6_QueryInterface(IHTMLWindow6
*iface
, REFIID riid
, void **ppv
)
1806 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1808 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1811 static ULONG WINAPI
HTMLWindow6_AddRef(IHTMLWindow6
*iface
)
1813 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1815 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1818 static ULONG WINAPI
HTMLWindow6_Release(IHTMLWindow6
*iface
)
1820 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1822 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1825 static HRESULT WINAPI
HTMLWindow6_GetTypeInfoCount(IHTMLWindow6
*iface
, UINT
*pctinfo
)
1827 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1829 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1832 static HRESULT WINAPI
HTMLWindow6_GetTypeInfo(IHTMLWindow6
*iface
, UINT iTInfo
,
1833 LCID lcid
, ITypeInfo
**ppTInfo
)
1835 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1837 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1840 static HRESULT WINAPI
HTMLWindow6_GetIDsOfNames(IHTMLWindow6
*iface
, REFIID riid
,
1841 LPOLESTR
*rgszNames
, UINT cNames
,
1842 LCID lcid
, DISPID
*rgDispId
)
1844 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1846 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1850 static HRESULT WINAPI
HTMLWindow6_Invoke(IHTMLWindow6
*iface
, DISPID dispIdMember
,
1851 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1852 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1854 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1856 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1857 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1860 static HRESULT WINAPI
HTMLWindow6_put_XDomainRequest(IHTMLWindow6
*iface
, VARIANT v
)
1862 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1863 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1867 static HRESULT WINAPI
HTMLWindow6_get_XDomainRequest(IHTMLWindow6
*iface
, VARIANT
*p
)
1869 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1870 FIXME("(%p)->(%p)\n", This
, p
);
1874 static HRESULT WINAPI
HTMLWindow6_get_sessionStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1876 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1877 FIXME("(%p)->(%p)\n", This
, p
);
1881 static HRESULT WINAPI
HTMLWindow6_get_localStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
1883 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1884 FIXME("(%p)->(%p)\n", This
, p
);
1888 static HRESULT WINAPI
HTMLWindow6_put_onhashchange(IHTMLWindow6
*iface
, VARIANT v
)
1890 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1891 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1895 static HRESULT WINAPI
HTMLWindow6_get_onhashchange(IHTMLWindow6
*iface
, VARIANT
*p
)
1897 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1898 FIXME("(%p)->(%p)\n", This
, p
);
1902 static HRESULT WINAPI
HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6
*iface
, LONG
*p
)
1904 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1905 FIXME("(%p)->(%p)\n", This
, p
);
1909 static HRESULT WINAPI
HTMLWindow6_postMessage(IHTMLWindow6
*iface
, BSTR msg
, VARIANT targetOrigin
)
1911 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1912 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(msg
), debugstr_variant(&targetOrigin
));
1916 static HRESULT WINAPI
HTMLWindow6_toStaticHTML(IHTMLWindow6
*iface
, BSTR bstrHTML
, BSTR
*pbstrStaticHTML
)
1918 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1919 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrHTML
), pbstrStaticHTML
);
1923 static HRESULT WINAPI
HTMLWindow6_put_onmessage(IHTMLWindow6
*iface
, VARIANT v
)
1925 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1926 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1930 static HRESULT WINAPI
HTMLWindow6_get_onmessage(IHTMLWindow6
*iface
, VARIANT
*p
)
1932 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1933 FIXME("(%p)->(%p)\n", This
, p
);
1937 static HRESULT WINAPI
HTMLWindow6_msWriteProfilerMark(IHTMLWindow6
*iface
, BSTR bstrProfilerMark
)
1939 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
1940 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrProfilerMark
));
1944 static const IHTMLWindow6Vtbl HTMLWindow6Vtbl
= {
1945 HTMLWindow6_QueryInterface
,
1947 HTMLWindow6_Release
,
1948 HTMLWindow6_GetTypeInfoCount
,
1949 HTMLWindow6_GetTypeInfo
,
1950 HTMLWindow6_GetIDsOfNames
,
1952 HTMLWindow6_put_XDomainRequest
,
1953 HTMLWindow6_get_XDomainRequest
,
1954 HTMLWindow6_get_sessionStorage
,
1955 HTMLWindow6_get_localStorage
,
1956 HTMLWindow6_put_onhashchange
,
1957 HTMLWindow6_get_onhashchange
,
1958 HTMLWindow6_get_maxConnectionsPerServer
,
1959 HTMLWindow6_postMessage
,
1960 HTMLWindow6_toStaticHTML
,
1961 HTMLWindow6_put_onmessage
,
1962 HTMLWindow6_get_onmessage
,
1963 HTMLWindow6_msWriteProfilerMark
1966 static inline HTMLWindow
*impl_from_IHTMLPrivateWindow(IHTMLPrivateWindow
*iface
)
1968 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLPrivateWindow_iface
);
1971 static HRESULT WINAPI
HTMLPrivateWindow_QueryInterface(IHTMLPrivateWindow
*iface
, REFIID riid
, void **ppv
)
1973 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1975 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1978 static ULONG WINAPI
HTMLPrivateWindow_AddRef(IHTMLPrivateWindow
*iface
)
1980 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1982 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1985 static ULONG WINAPI
HTMLPrivateWindow_Release(IHTMLPrivateWindow
*iface
)
1987 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1989 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1992 static HRESULT WINAPI
HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow
*iface
, BSTR url
, BSTR arg2
, BSTR arg3
,
1993 BSTR arg4
, VARIANT
*post_data_var
, VARIANT
*headers_var
, ULONG flags
)
1995 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
1996 HTMLOuterWindow
*window
= This
->outer_window
;
1997 OLECHAR
*translated_url
= NULL
;
1998 DWORD post_data_size
= 0;
1999 BYTE
*post_data
= NULL
;
2000 WCHAR
*headers
= NULL
;
2004 TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This
, debugstr_w(url
), debugstr_w(arg2
), debugstr_w(arg3
), debugstr_w(arg4
),
2005 debugstr_variant(post_data_var
), debugstr_variant(headers_var
), flags
);
2007 if(window
->doc_obj
->hostui
) {
2008 hres
= IDocHostUIHandler_TranslateUrl(window
->doc_obj
->hostui
, 0, url
, &translated_url
);
2010 translated_url
= NULL
;
2013 hres
= CreateUri(translated_url
? translated_url
: url
, 0, 0, &uri
);
2014 CoTaskMemFree(translated_url
);
2019 if(V_VT(post_data_var
) == (VT_ARRAY
|VT_UI1
)) {
2020 SafeArrayAccessData(V_ARRAY(post_data_var
), (void**)&post_data
);
2021 post_data_size
= V_ARRAY(post_data_var
)->rgsabound
[0].cElements
;
2025 if(headers_var
&& V_VT(headers_var
) != VT_EMPTY
&& V_VT(headers_var
) != VT_ERROR
) {
2026 if(V_VT(headers_var
) != VT_BSTR
)
2027 return E_INVALIDARG
;
2029 headers
= V_BSTR(headers_var
);
2032 hres
= super_navigate(window
, uri
, headers
, post_data
, post_data_size
);
2035 SafeArrayUnaccessData(V_ARRAY(post_data_var
));
2040 static HRESULT WINAPI
HTMLPrivateWindow_GetPendingUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2042 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2043 FIXME("(%p)->(%p)\n", This
, url
);
2047 static HRESULT WINAPI
HTMLPrivateWindow_SetPICSTarget(IHTMLPrivateWindow
*iface
, IOleCommandTarget
*cmdtrg
)
2049 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2050 FIXME("(%p)->(%p)\n", This
, cmdtrg
);
2054 static HRESULT WINAPI
HTMLPrivateWindow_PICSComplete(IHTMLPrivateWindow
*iface
, int arg
)
2056 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2057 FIXME("(%p)->(%x)\n", This
, arg
);
2061 static HRESULT WINAPI
HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow
*iface
, LPCWSTR name
, IHTMLWindow2
**ret
)
2063 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2064 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), ret
);
2068 static HRESULT WINAPI
HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2070 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2071 TRACE("(%p)->(%p)\n", This
, url
);
2074 return E_INVALIDARG
;
2076 *url
= SysAllocString(This
->outer_window
->url
);
2080 static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl
= {
2081 HTMLPrivateWindow_QueryInterface
,
2082 HTMLPrivateWindow_AddRef
,
2083 HTMLPrivateWindow_Release
,
2084 HTMLPrivateWindow_SuperNavigate
,
2085 HTMLPrivateWindow_GetPendingUrl
,
2086 HTMLPrivateWindow_SetPICSTarget
,
2087 HTMLPrivateWindow_PICSComplete
,
2088 HTMLPrivateWindow_FindWindowByName
,
2089 HTMLPrivateWindow_GetAddressBarUrl
2092 static inline HTMLWindow
*impl_from_ITravelLogClient(ITravelLogClient
*iface
)
2094 return CONTAINING_RECORD(iface
, HTMLWindow
, ITravelLogClient_iface
);
2097 static HRESULT WINAPI
TravelLogClient_QueryInterface(ITravelLogClient
*iface
, REFIID riid
, void **ppv
)
2099 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2101 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2104 static ULONG WINAPI
TravelLogClient_AddRef(ITravelLogClient
*iface
)
2106 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2108 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2111 static ULONG WINAPI
TravelLogClient_Release(ITravelLogClient
*iface
)
2113 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2115 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2118 static HRESULT WINAPI
TravelLogClient_FindWindowByIndex(ITravelLogClient
*iface
, DWORD dwID
, IUnknown
**ppunk
)
2120 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2122 FIXME("(%p)->(%d %p) semi-stub\n", This
, dwID
, ppunk
);
2128 static HRESULT WINAPI
TravelLogClient_GetWindowData(ITravelLogClient
*iface
, IStream
*pStream
, LPWINDOWDATA pWinData
)
2130 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2131 FIXME("(%p)->(%p %p)\n", This
, pStream
, pWinData
);
2135 static HRESULT WINAPI
TravelLogClient_LoadHistoryPosition(ITravelLogClient
*iface
, LPWSTR pszUrlLocation
, DWORD dwPosition
)
2137 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2138 FIXME("(%p)->(%s %d)\n", This
, debugstr_w(pszUrlLocation
), dwPosition
);
2142 static const ITravelLogClientVtbl TravelLogClientVtbl
= {
2143 TravelLogClient_QueryInterface
,
2144 TravelLogClient_AddRef
,
2145 TravelLogClient_Release
,
2146 TravelLogClient_FindWindowByIndex
,
2147 TravelLogClient_GetWindowData
,
2148 TravelLogClient_LoadHistoryPosition
2151 static inline HTMLWindow
*impl_from_IDispatchEx(IDispatchEx
*iface
)
2153 return CONTAINING_RECORD(iface
, HTMLWindow
, IDispatchEx_iface
);
2156 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
2158 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2160 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2163 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
2165 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2167 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2170 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
2172 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2174 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2177 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
2179 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2181 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2183 return IDispatchEx_GetTypeInfoCount(&This
->inner_window
->dispex
.IDispatchEx_iface
, pctinfo
);
2186 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
2187 LCID lcid
, ITypeInfo
**ppTInfo
)
2189 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2191 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2193 return IDispatchEx_GetTypeInfo(&This
->inner_window
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2196 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
2197 LPOLESTR
*rgszNames
, UINT cNames
,
2198 LCID lcid
, DISPID
*rgDispId
)
2200 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2204 WARN("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
2207 for(i
=0; i
< cNames
; i
++) {
2208 /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
2209 hres
= IDispatchEx_GetDispID(&This
->IDispatchEx_iface
, rgszNames
[i
], 0, rgDispId
+i
);
2217 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
2218 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2219 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2221 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2223 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2224 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2226 /* FIXME: Use script dispatch */
2228 return IDispatchEx_Invoke(&This
->inner_window
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2229 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2232 static global_prop_t
*alloc_global_prop(HTMLInnerWindow
*This
, global_prop_type_t type
, BSTR name
)
2234 if(This
->global_prop_cnt
== This
->global_prop_size
) {
2235 global_prop_t
*new_props
;
2238 if(This
->global_props
) {
2239 new_size
= This
->global_prop_size
*2;
2240 new_props
= heap_realloc(This
->global_props
, new_size
*sizeof(global_prop_t
));
2243 new_props
= heap_alloc(new_size
*sizeof(global_prop_t
));
2247 This
->global_props
= new_props
;
2248 This
->global_prop_size
= new_size
;
2251 This
->global_props
[This
->global_prop_cnt
].name
= heap_strdupW(name
);
2252 if(!This
->global_props
[This
->global_prop_cnt
].name
)
2255 This
->global_props
[This
->global_prop_cnt
].type
= type
;
2256 return This
->global_props
+ This
->global_prop_cnt
++;
2259 static inline DWORD
prop_to_dispid(HTMLInnerWindow
*This
, global_prop_t
*prop
)
2261 return MSHTML_DISPID_CUSTOM_MIN
+ (prop
-This
->global_props
);
2264 HRESULT
search_window_props(HTMLInnerWindow
*This
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2267 ScriptHost
*script_host
;
2270 for(i
=0; i
< This
->global_prop_cnt
; i
++) {
2271 /* FIXME: case sensitivity */
2272 if(!strcmpW(This
->global_props
[i
].name
, bstrName
)) {
2273 *pid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
2278 if(find_global_prop(This
->base
.inner_window
, bstrName
, grfdex
, &script_host
, &id
)) {
2279 global_prop_t
*prop
;
2281 prop
= alloc_global_prop(This
, GLOBAL_SCRIPTVAR
, bstrName
);
2283 return E_OUTOFMEMORY
;
2285 prop
->script_host
= script_host
;
2288 *pid
= prop_to_dispid(This
, prop
);
2292 return DISP_E_UNKNOWNNAME
;
2295 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2297 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2298 HTMLInnerWindow
*window
= This
->inner_window
;
2301 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
2303 hres
= search_window_props(window
, bstrName
, grfdex
, pid
);
2304 if(hres
!= DISP_E_UNKNOWNNAME
)
2307 hres
= IDispatchEx_GetDispID(&window
->base
.inner_window
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
, pid
);
2308 if(hres
!= DISP_E_UNKNOWNNAME
)
2311 if(window
->base
.inner_window
->doc
) {
2312 global_prop_t
*prop
;
2315 hres
= IHTMLDocument3_getElementById(&window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2317 if(SUCCEEDED(hres
) && elem
) {
2318 IHTMLElement_Release(elem
);
2320 prop
= alloc_global_prop(window
, GLOBAL_ELEMENTVAR
, bstrName
);
2322 return E_OUTOFMEMORY
;
2324 *pid
= prop_to_dispid(window
, prop
);
2329 return DISP_E_UNKNOWNNAME
;
2332 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
2333 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
2335 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2336 HTMLOuterWindow
*window
= This
->outer_window
;
2338 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2340 if(id
== DISPID_IHTMLWINDOW2_LOCATION
&& (wFlags
& DISPATCH_PROPERTYPUT
)) {
2341 HTMLLocation
*location
;
2344 TRACE("forwarding to location.href\n");
2346 hres
= get_location(window
, &location
);
2350 hres
= IDispatchEx_InvokeEx(&location
->dispex
.IDispatchEx_iface
, DISPID_VALUE
, lcid
,
2351 wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2352 IHTMLLocation_Release(&location
->IHTMLLocation_iface
);
2356 return IDispatchEx_InvokeEx(&window
->base
.inner_window
->dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
,
2360 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
2362 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2364 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
2366 return IDispatchEx_DeleteMemberByName(&This
->inner_window
->dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
2369 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
2371 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2373 TRACE("(%p)->(%x)\n", This
, id
);
2375 return IDispatchEx_DeleteMemberByDispID(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
);
2378 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
2380 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2382 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
2384 return IDispatchEx_GetMemberProperties(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
, grfdexFetch
,
2388 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
2390 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2392 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
2394 return IDispatchEx_GetMemberName(&This
->inner_window
->dispex
.IDispatchEx_iface
, id
, pbstrName
);
2397 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
2399 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2401 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
2403 return IDispatchEx_GetNextDispID(&This
->inner_window
->dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
2406 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
2408 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2410 TRACE("(%p)->(%p)\n", This
, ppunk
);
2416 static const IDispatchExVtbl WindowDispExVtbl
= {
2417 WindowDispEx_QueryInterface
,
2418 WindowDispEx_AddRef
,
2419 WindowDispEx_Release
,
2420 WindowDispEx_GetTypeInfoCount
,
2421 WindowDispEx_GetTypeInfo
,
2422 WindowDispEx_GetIDsOfNames
,
2423 WindowDispEx_Invoke
,
2424 WindowDispEx_GetDispID
,
2425 WindowDispEx_InvokeEx
,
2426 WindowDispEx_DeleteMemberByName
,
2427 WindowDispEx_DeleteMemberByDispID
,
2428 WindowDispEx_GetMemberProperties
,
2429 WindowDispEx_GetMemberName
,
2430 WindowDispEx_GetNextDispID
,
2431 WindowDispEx_GetNameSpaceParent
2434 static inline HTMLWindow
*impl_from_IServiceProvider(IServiceProvider
*iface
)
2436 return CONTAINING_RECORD(iface
, HTMLWindow
, IServiceProvider_iface
);
2439 static HRESULT WINAPI
HTMLWindowSP_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
2441 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2442 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2445 static ULONG WINAPI
HTMLWindowSP_AddRef(IServiceProvider
*iface
)
2447 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2448 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2451 static ULONG WINAPI
HTMLWindowSP_Release(IServiceProvider
*iface
)
2453 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2454 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2457 static HRESULT WINAPI
HTMLWindowSP_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
2459 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2461 if(IsEqualGUID(guidService
, &IID_IHTMLWindow2
)) {
2462 TRACE("IID_IHTMLWindow2\n");
2463 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2466 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
2468 if(!This
->outer_window
->doc_obj
)
2469 return E_NOINTERFACE
;
2471 return IServiceProvider_QueryService(&This
->outer_window
->doc_obj
->basedoc
.IServiceProvider_iface
,
2472 guidService
, riid
, ppv
);
2475 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2476 HTMLWindowSP_QueryInterface
,
2477 HTMLWindowSP_AddRef
,
2478 HTMLWindowSP_Release
,
2479 HTMLWindowSP_QueryService
2482 static inline HTMLInnerWindow
*impl_from_DispatchEx(DispatchEx
*iface
)
2484 return CONTAINING_RECORD(iface
, HTMLInnerWindow
, dispex
);
2487 static HRESULT
HTMLWindow_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2488 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2490 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
2491 global_prop_t
*prop
;
2495 idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
2496 if(idx
>= This
->global_prop_cnt
)
2497 return DISP_E_MEMBERNOTFOUND
;
2499 prop
= This
->global_props
+idx
;
2501 switch(prop
->type
) {
2502 case GLOBAL_SCRIPTVAR
: {
2506 disp
= get_script_disp(prop
->script_host
);
2508 return E_UNEXPECTED
;
2510 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&iface
);
2511 if(SUCCEEDED(hres
)) {
2512 TRACE("%s >>>\n", debugstr_w(prop
->name
));
2513 hres
= IDispatchEx_InvokeEx(iface
, prop
->id
, lcid
, flags
, params
, res
, ei
, caller
);
2515 TRACE("%s <<<\n", debugstr_w(prop
->name
));
2517 WARN("%s <<< %08x\n", debugstr_w(prop
->name
), hres
);
2518 IDispatchEx_Release(iface
);
2520 FIXME("No IDispatchEx\n");
2522 IDispatch_Release(disp
);
2525 case GLOBAL_ELEMENTVAR
:
2527 case DISPATCH_PROPERTYGET
: {
2530 hres
= IHTMLDocument3_getElementById(&This
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2536 return DISP_E_MEMBERNOTFOUND
;
2538 V_VT(res
) = VT_DISPATCH
;
2539 V_DISPATCH(res
) = (IDispatch
*)elem
;
2542 case DISPATCH_PROPERTYPUT
: {
2545 hres
= dispex_get_dynid(&This
->dispex
, prop
->name
, &dispex_id
);
2549 prop
->type
= GLOBAL_DISPEXVAR
;
2550 prop
->id
= dispex_id
;
2551 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, dispex_id
, 0, flags
, params
, res
, ei
, caller
);
2554 FIXME("Not supported flags: %x\n", flags
);
2557 case GLOBAL_DISPEXVAR
:
2558 return IDispatchEx_InvokeEx(&This
->dispex
.IDispatchEx_iface
, prop
->id
, 0, flags
, params
, res
, ei
, caller
);
2560 ERR("invalid type %d\n", prop
->type
);
2561 hres
= DISP_E_MEMBERNOTFOUND
;
2568 static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl
= {
2575 static const tid_t HTMLWindow_iface_tids
[] = {
2583 static dispex_static_data_t HTMLWindow_dispex
= {
2584 &HTMLWindow_dispex_vtbl
,
2585 DispHTMLWindow2_tid
,
2587 HTMLWindow_iface_tids
2590 static void *alloc_window(size_t size
)
2594 window
= heap_alloc_zero(size
);
2598 window
->IHTMLWindow2_iface
.lpVtbl
= &HTMLWindow2Vtbl
;
2599 window
->IHTMLWindow3_iface
.lpVtbl
= &HTMLWindow3Vtbl
;
2600 window
->IHTMLWindow4_iface
.lpVtbl
= &HTMLWindow4Vtbl
;
2601 window
->IHTMLWindow5_iface
.lpVtbl
= &HTMLWindow5Vtbl
;
2602 window
->IHTMLWindow6_iface
.lpVtbl
= &HTMLWindow6Vtbl
;
2603 window
->IHTMLPrivateWindow_iface
.lpVtbl
= &HTMLPrivateWindowVtbl
;
2604 window
->IDispatchEx_iface
.lpVtbl
= &WindowDispExVtbl
;
2605 window
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
2606 window
->ITravelLogClient_iface
.lpVtbl
= &TravelLogClientVtbl
;
2612 static HRESULT
create_inner_window(HTMLOuterWindow
*outer_window
, HTMLInnerWindow
**ret
)
2614 HTMLInnerWindow
*window
;
2616 window
= alloc_window(sizeof(HTMLInnerWindow
));
2618 return E_OUTOFMEMORY
;
2620 list_init(&window
->script_hosts
);
2621 list_init(&window
->bindings
);
2623 window
->base
.outer_window
= outer_window
;
2624 window
->base
.inner_window
= window
;
2626 init_dispex(&window
->dispex
, (IUnknown
*)&window
->base
.IHTMLWindow2_iface
, &HTMLWindow_dispex
);
2628 window
->task_magic
= get_task_target_magic();
2634 HRESULT
HTMLOuterWindow_Create(HTMLDocumentObj
*doc_obj
, nsIDOMWindow
*nswindow
,
2635 HTMLOuterWindow
*parent
, HTMLOuterWindow
**ret
)
2637 HTMLOuterWindow
*window
;
2640 window
= alloc_window(sizeof(HTMLOuterWindow
));
2642 return E_OUTOFMEMORY
;
2644 window
->base
.outer_window
= window
;
2645 window
->base
.inner_window
= NULL
;
2647 window
->window_ref
= heap_alloc(sizeof(windowref_t
));
2648 if(!window
->window_ref
) {
2650 return E_OUTOFMEMORY
;
2653 window
->doc_obj
= doc_obj
;
2655 window
->window_ref
->window
= window
;
2656 window
->window_ref
->ref
= 1;
2659 nsIDOMWindow_AddRef(nswindow
);
2660 window
->nswindow
= nswindow
;
2663 window
->scriptmode
= parent
? parent
->scriptmode
: SCRIPTMODE_GECKO
;
2664 window
->readystate
= READYSTATE_UNINITIALIZED
;
2666 hres
= create_pending_window(window
, NULL
);
2668 hres
= update_window_doc(window
->pending_window
);
2670 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
2674 hres
= CoInternetCreateSecurityManager(NULL
, &window
->secmgr
, 0);
2676 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
2680 window
->task_magic
= get_task_target_magic();
2682 list_init(&window
->children
);
2683 list_add_head(&window_list
, &window
->entry
);
2686 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
2688 window
->parent
= parent
;
2689 list_add_tail(&parent
->children
, &window
->sibling_entry
);
2692 TRACE("%p inner_window %p\n", window
, window
->base
.inner_window
);
2698 HRESULT
create_pending_window(HTMLOuterWindow
*outer_window
, nsChannelBSC
*channelbsc
)
2700 HTMLInnerWindow
*pending_window
;
2703 hres
= create_inner_window(outer_window
, &pending_window
);
2708 IBindStatusCallback_AddRef(&channelbsc
->bsc
.IBindStatusCallback_iface
);
2709 pending_window
->bscallback
= channelbsc
;
2712 if(outer_window
->pending_window
) {
2713 abort_window_bindings(outer_window
->pending_window
);
2714 outer_window
->pending_window
->base
.outer_window
= NULL
;
2715 IHTMLWindow2_Release(&outer_window
->pending_window
->base
.IHTMLWindow2_iface
);
2718 outer_window
->pending_window
= pending_window
;
2722 HRESULT
update_window_doc(HTMLInnerWindow
*window
)
2724 HTMLOuterWindow
*outer_window
= window
->base
.outer_window
;
2725 nsIDOMHTMLDocument
*nshtmldoc
;
2726 nsIDOMDocument
*nsdoc
;
2730 assert(!window
->doc
);
2733 ERR("NULL outer window\n");
2734 return E_UNEXPECTED
;
2737 nsres
= nsIDOMWindow_GetDocument(outer_window
->nswindow
, &nsdoc
);
2738 if(NS_FAILED(nsres
) || !nsdoc
) {
2739 ERR("GetDocument failed: %08x\n", nsres
);
2743 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
2744 nsIDOMDocument_Release(nsdoc
);
2745 if(NS_FAILED(nsres
)) {
2746 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
2750 hres
= create_doc_from_nsdoc(nshtmldoc
, outer_window
->doc_obj
, window
, &window
->doc
);
2751 nsIDOMHTMLDocument_Release(nshtmldoc
);
2755 if(outer_window
->doc_obj
->usermode
== EDITMODE
) {
2759 static const PRUnichar onW
[] = {'o','n',0};
2761 nsAString_Init(&mode_str
, onW
);
2762 nsres
= nsIDOMHTMLDocument_SetDesignMode(window
->doc
->nsdoc
, &mode_str
);
2763 nsAString_Finish(&mode_str
);
2764 if(NS_FAILED(nsres
))
2765 ERR("SetDesignMode failed: %08x\n", nsres
);
2768 if(window
!= outer_window
->pending_window
) {
2769 ERR("not current pending window\n");
2773 detach_inner_window(outer_window
);
2774 outer_window
->base
.inner_window
= window
;
2775 outer_window
->pending_window
= NULL
;
2777 if(outer_window
->doc_obj
->basedoc
.window
== outer_window
|| !outer_window
->doc_obj
->basedoc
.window
) {
2778 if(outer_window
->doc_obj
->basedoc
.doc_node
)
2779 htmldoc_release(&outer_window
->doc_obj
->basedoc
.doc_node
->basedoc
);
2780 outer_window
->doc_obj
->basedoc
.doc_node
= window
->doc
;
2781 htmldoc_addref(&window
->doc
->basedoc
);
2787 HTMLOuterWindow
*nswindow_to_window(const nsIDOMWindow
*nswindow
)
2789 HTMLOuterWindow
*iter
;
2791 LIST_FOR_EACH_ENTRY(iter
, &window_list
, HTMLOuterWindow
, entry
) {
2792 if(iter
->nswindow
== nswindow
)