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
33 #define NO_SHLWAPI_REG
36 #include "wine/debug.h"
38 #include "mshtml_private.h"
39 #include "htmlevent.h"
40 #include "htmlscript.h"
41 #include "pluginhost.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
47 static int window_map_compare(const void *key
, const struct wine_rb_entry
*entry
)
49 HTMLOuterWindow
*window
= WINE_RB_ENTRY_VALUE(entry
, HTMLOuterWindow
, entry
);
51 if(window
->window_proxy
== key
)
53 return (void*)window
->window_proxy
> key
? -1 : 1;
56 static struct wine_rb_tree window_map
= { window_map_compare
};
58 HTMLOuterWindow
*mozwindow_to_window(const mozIDOMWindowProxy
*mozwindow
)
60 struct wine_rb_entry
*entry
= wine_rb_get(&window_map
, mozwindow
);
61 return entry
? WINE_RB_ENTRY_VALUE(entry
, HTMLOuterWindow
, entry
) : NULL
;
64 static inline BOOL
is_outer_window(HTMLWindow
*window
)
66 return &window
->outer_window
->base
== window
;
69 static void release_children(HTMLOuterWindow
*This
)
71 HTMLOuterWindow
*child
;
73 while(!list_empty(&This
->children
)) {
74 child
= LIST_ENTRY(list_tail(&This
->children
), HTMLOuterWindow
, sibling_entry
);
76 list_remove(&child
->sibling_entry
);
78 IHTMLWindow2_Release(&child
->base
.IHTMLWindow2_iface
);
82 static HRESULT
get_location(HTMLInnerWindow
*This
, HTMLLocation
**ret
)
85 IHTMLLocation_AddRef(&This
->location
->IHTMLLocation_iface
);
89 hres
= HTMLLocation_Create(This
, &This
->location
);
94 *ret
= This
->location
;
98 void get_top_window(HTMLOuterWindow
*window
, HTMLOuterWindow
**ret
)
100 HTMLOuterWindow
*iter
;
102 for(iter
= window
; iter
->parent
; iter
= iter
->parent
);
106 static inline HRESULT
set_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
108 if(!window
->inner_window
->doc
) {
109 FIXME("No document\n");
113 return set_event_handler(&window
->inner_window
->event_target
, eid
, var
);
116 static inline HRESULT
get_window_event(HTMLWindow
*window
, eventid_t eid
, VARIANT
*var
)
118 if(!window
->inner_window
->doc
) {
119 FIXME("No document\n");
123 return get_event_handler(&window
->inner_window
->event_target
, eid
, var
);
126 static void detach_inner_window(HTMLInnerWindow
*window
)
128 HTMLOuterWindow
*outer_window
= window
->base
.outer_window
;
130 if(outer_window
&& outer_window
->doc_obj
&& outer_window
== outer_window
->doc_obj
->basedoc
.window
)
131 window
->doc
->basedoc
.cp_container
.forward_container
= NULL
;
134 detach_events(window
->doc
);
135 while(!list_empty(&window
->doc
->plugin_hosts
))
136 detach_plugin_host(LIST_ENTRY(list_head(&window
->doc
->plugin_hosts
), PluginHost
, entry
));
139 abort_window_bindings(window
);
140 remove_target_tasks(window
->task_magic
);
141 release_script_hosts(window
);
142 window
->base
.outer_window
= NULL
;
144 if(outer_window
&& outer_window
->base
.inner_window
== window
) {
145 outer_window
->base
.inner_window
= NULL
;
146 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
150 static inline HTMLWindow
*impl_from_IHTMLWindow2(IHTMLWindow2
*iface
)
152 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow2_iface
);
155 static HRESULT WINAPI
HTMLWindow2_QueryInterface(IHTMLWindow2
*iface
, REFIID riid
, void **ppv
)
157 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
159 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
161 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
162 *ppv
= &This
->IHTMLWindow2_iface
;
163 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
164 *ppv
= &This
->IHTMLWindow2_iface
;
165 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
166 *ppv
= &This
->IDispatchEx_iface
;
167 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2
, riid
)) {
168 *ppv
= &This
->IHTMLWindow2_iface
;
169 }else if(IsEqualGUID(&IID_IHTMLWindow2
, riid
)) {
170 *ppv
= &This
->IHTMLWindow2_iface
;
171 }else if(IsEqualGUID(&IID_IHTMLWindow3
, riid
)) {
172 *ppv
= &This
->IHTMLWindow3_iface
;
173 }else if(IsEqualGUID(&IID_IHTMLWindow4
, riid
)) {
174 *ppv
= &This
->IHTMLWindow4_iface
;
175 }else if(IsEqualGUID(&IID_IHTMLWindow5
, riid
)) {
176 *ppv
= &This
->IHTMLWindow5_iface
;
177 }else if(IsEqualGUID(&IID_IHTMLWindow6
, riid
)) {
178 *ppv
= &This
->IHTMLWindow6_iface
;
179 }else if(IsEqualGUID(&IID_IHTMLPrivateWindow
, riid
)) {
180 *ppv
= &This
->IHTMLPrivateWindow_iface
;
181 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
182 *ppv
= &This
->IServiceProvider_iface
;
183 }else if(IsEqualGUID(&IID_ITravelLogClient
, riid
)) {
184 *ppv
= &This
->ITravelLogClient_iface
;
185 }else if(IsEqualGUID(&IID_IObjectIdentity
, riid
)) {
186 *ppv
= &This
->IObjectIdentity_iface
;
187 }else if(IsEqualGUID(&IID_IProvideClassInfo
, riid
)) {
188 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
189 }else if(IsEqualGUID(&IID_IProvideClassInfo2
, riid
)) {
190 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
191 }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo
, riid
)) {
192 *ppv
= &This
->IProvideMultipleClassInfo_iface
;
193 }else if(IsEqualGUID(&IID_IMarshal
, riid
)) {
195 FIXME("(%p)->(IID_IMarshal %p)\n", This
, ppv
);
196 return E_NOINTERFACE
;
197 }else if(dispex_query_interface(&This
->inner_window
->event_target
.dispex
, riid
, ppv
)) {
199 return E_NOINTERFACE
;
201 return EventTarget_QI(&This
->inner_window
->event_target
, riid
, ppv
);
204 IUnknown_AddRef((IUnknown
*)*ppv
);
208 static ULONG WINAPI
HTMLWindow2_AddRef(IHTMLWindow2
*iface
)
210 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
211 LONG ref
= InterlockedIncrement(&This
->ref
);
213 TRACE("(%p) ref=%d\n", This
, ref
);
218 static void release_outer_window(HTMLOuterWindow
*This
)
220 if(This
->pending_window
) {
221 abort_window_bindings(This
->pending_window
);
222 This
->pending_window
->base
.outer_window
= NULL
;
223 IHTMLWindow2_Release(&This
->pending_window
->base
.IHTMLWindow2_iface
);
226 remove_target_tasks(This
->task_magic
);
227 set_current_mon(This
, NULL
, 0);
228 set_current_uri(This
, NULL
);
229 if(This
->base
.inner_window
)
230 detach_inner_window(This
->base
.inner_window
);
231 release_children(This
);
234 IInternetSecurityManager_Release(This
->secmgr
);
236 if(This
->frame_element
)
237 This
->frame_element
->content_window
= NULL
;
239 This
->window_ref
->window
= NULL
;
240 windowref_release(This
->window_ref
);
243 nsIDOMWindow_Release(This
->nswindow
);
244 if(This
->window_proxy
)
245 mozIDOMWindowProxy_Release(This
->window_proxy
);
247 wine_rb_remove(&window_map
, &This
->entry
);
251 static void release_inner_window(HTMLInnerWindow
*This
)
257 detach_inner_window(This
);
260 This
->doc
->window
= NULL
;
261 htmldoc_release(&This
->doc
->basedoc
);
264 release_event_target(&This
->event_target
);
265 release_dispex(&This
->event_target
.dispex
);
267 for(i
=0; i
< This
->global_prop_cnt
; i
++)
268 heap_free(This
->global_props
[i
].name
);
269 heap_free(This
->global_props
);
272 This
->location
->window
= NULL
;
273 IHTMLLocation_Release(&This
->location
->IHTMLLocation_iface
);
276 if(This
->image_factory
) {
277 This
->image_factory
->window
= NULL
;
278 IHTMLImageElementFactory_Release(&This
->image_factory
->IHTMLImageElementFactory_iface
);
281 if(This
->option_factory
) {
282 This
->option_factory
->window
= NULL
;
283 IHTMLOptionElementFactory_Release(&This
->option_factory
->IHTMLOptionElementFactory_iface
);
286 if(This
->xhr_factory
) {
287 This
->xhr_factory
->window
= NULL
;
288 IHTMLXMLHttpRequestFactory_Release(&This
->xhr_factory
->IHTMLXMLHttpRequestFactory_iface
);
292 IHTMLScreen_Release(This
->screen
);
295 This
->history
->window
= NULL
;
296 IOmHistory_Release(&This
->history
->IOmHistory_iface
);
299 if(This
->session_storage
)
300 IHTMLStorage_Release(This
->session_storage
);
303 IMoniker_Release(This
->mon
);
308 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
310 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
311 LONG ref
= InterlockedDecrement(&This
->ref
);
313 TRACE("(%p) ref=%d\n", This
, ref
);
316 if(is_outer_window(This
))
317 release_outer_window(This
->outer_window
);
319 release_inner_window(This
->inner_window
);
325 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
327 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
329 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
332 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
333 LCID lcid
, ITypeInfo
**ppTInfo
)
335 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
337 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
340 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
341 LPOLESTR
*rgszNames
, UINT cNames
,
342 LCID lcid
, DISPID
*rgDispId
)
344 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
346 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
350 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
351 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
352 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
354 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
356 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
357 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
360 static HRESULT
get_frame_by_index(HTMLOuterWindow
*This
, UINT32 index
, HTMLOuterWindow
**ret
)
362 nsIDOMWindowCollection
*nsframes
;
363 mozIDOMWindowProxy
*mozwindow
;
367 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nsframes
);
368 if(NS_FAILED(nsres
)) {
369 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
373 nsres
= nsIDOMWindowCollection_GetLength(nsframes
, &length
);
374 assert(nsres
== NS_OK
);
376 if(index
>= length
) {
377 nsIDOMWindowCollection_Release(nsframes
);
378 return DISP_E_MEMBERNOTFOUND
;
381 nsres
= nsIDOMWindowCollection_Item(nsframes
, index
, &mozwindow
);
382 nsIDOMWindowCollection_Release(nsframes
);
383 if(NS_FAILED(nsres
)) {
384 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
388 *ret
= mozwindow_to_window(mozwindow
);
390 mozIDOMWindowProxy_Release(mozwindow
);
394 HRESULT
get_frame_by_name(HTMLOuterWindow
*This
, const WCHAR
*name
, BOOL deep
, HTMLOuterWindow
**ret
)
396 nsIDOMWindowCollection
*nsframes
;
397 HTMLOuterWindow
*window
= NULL
;
398 mozIDOMWindowProxy
*mozwindow
;
404 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nsframes
);
405 if(NS_FAILED(nsres
)) {
406 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
411 WARN("nsIDOMWindow_GetFrames returned NULL nsframes: %p\n", This
->nswindow
);
412 return DISP_E_MEMBERNOTFOUND
;
415 nsAString_InitDepend(&name_str
, name
);
416 nsres
= nsIDOMWindowCollection_NamedItem(nsframes
, &name_str
, &mozwindow
);
417 nsAString_Finish(&name_str
);
418 if(NS_FAILED(nsres
)) {
419 nsIDOMWindowCollection_Release(nsframes
);
424 *ret
= mozwindow_to_window(mozwindow
);
428 nsres
= nsIDOMWindowCollection_GetLength(nsframes
, &length
);
429 assert(nsres
== NS_OK
);
431 for(i
= 0; i
< length
&& !window
; ++i
) {
432 HTMLOuterWindow
*window_iter
;
435 nsres
= nsIDOMWindowCollection_Item(nsframes
, i
, &mozwindow
);
436 if(NS_FAILED(nsres
)) {
437 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
442 window_iter
= mozwindow_to_window(mozwindow
);
444 mozIDOMWindowProxy_Release(mozwindow
);
447 WARN("nsIDOMWindow without HTMLOuterWindow: %p\n", mozwindow
);
451 hres
= IHTMLElement_get_id(&window_iter
->frame_element
->element
.IHTMLElement_iface
, &id
);
453 FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres
);
457 if(id
&& !strcmpiW(id
, name
))
458 window
= window_iter
;
463 get_frame_by_name(window_iter
, name
, TRUE
, &window
);
466 nsIDOMWindowCollection_Release(nsframes
);
474 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
476 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
477 HTMLOuterWindow
*window
= NULL
;
480 TRACE("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
482 switch(V_VT(pvarIndex
)) {
484 int index
= V_I4(pvarIndex
);
485 TRACE("Getting index %d\n", index
);
487 return DISP_E_MEMBERNOTFOUND
;
488 hres
= get_frame_by_index(This
->outer_window
, index
, &window
);
492 unsigned int index
= V_UINT(pvarIndex
);
493 TRACE("Getting index %u\n", index
);
494 hres
= get_frame_by_index(This
->outer_window
, index
, &window
);
498 BSTR str
= V_BSTR(pvarIndex
);
499 TRACE("Getting name %s\n", wine_dbgstr_w(str
));
500 hres
= get_frame_by_name(This
->outer_window
, str
, FALSE
, &window
);
504 WARN("Invalid index %s\n", debugstr_variant(pvarIndex
));
511 return DISP_E_MEMBERNOTFOUND
;
513 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
514 V_VT(pvarResult
) = VT_DISPATCH
;
515 V_DISPATCH(pvarResult
) = (IDispatch
*)window
;
519 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, LONG
*p
)
521 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
522 nsIDOMWindowCollection
*nscollection
;
526 TRACE("(%p)->(%p)\n", This
, p
);
528 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nscollection
);
529 if(NS_FAILED(nsres
)) {
530 ERR("GetFrames failed: %08x\n", nsres
);
534 nsres
= nsIDOMWindowCollection_GetLength(nscollection
, &length
);
535 nsIDOMWindowCollection_Release(nscollection
);
536 if(NS_FAILED(nsres
)) {
537 ERR("GetLength failed: %08x\n", nsres
);
545 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
547 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
548 FIXME("(%p)->(%p): semi-stub\n", This
, p
);
550 /* FIXME: Should return a separate Window object */
551 *p
= (IHTMLFramesCollection2
*)&This
->IHTMLWindow2_iface
;
552 IHTMLWindow2_AddRef(iface
);
556 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
558 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
559 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
563 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
565 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
566 FIXME("(%p)->(%p)\n", This
, p
);
570 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
572 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
574 WARN("(%p)->(%s)\n", This
, debugstr_w(v
));
577 * FIXME: Since IE7, setting status is blocked, but still possible in certain circumstances.
578 * Ignoring the call should be enough for us.
583 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
585 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
587 TRACE("(%p)->(%p)\n", This
, p
);
594 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
595 LONG msec
, VARIANT
*language
, LONG
*timerID
)
597 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
600 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
602 V_VT(&expr_var
) = VT_BSTR
;
603 V_BSTR(&expr_var
) = expression
;
605 return IHTMLWindow3_setTimeout(&This
->IHTMLWindow3_iface
, &expr_var
, msec
, language
, timerID
);
608 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, LONG timerID
)
610 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
612 TRACE("(%p)->(%d)\n", This
, timerID
);
614 return clear_task_timer(This
->inner_window
, timerID
);
617 #define MAX_MESSAGE_LEN 2000
619 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
621 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
622 WCHAR title
[100], *msg
= message
;
625 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
627 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, title
,
628 sizeof(title
)/sizeof(WCHAR
))) {
629 WARN("Could not load message box title: %d\n", GetLastError());
633 len
= SysStringLen(message
);
634 if(len
> MAX_MESSAGE_LEN
) {
635 msg
= heap_alloc((MAX_MESSAGE_LEN
+1)*sizeof(WCHAR
));
637 return E_OUTOFMEMORY
;
638 memcpy(msg
, message
, MAX_MESSAGE_LEN
*sizeof(WCHAR
));
639 msg
[MAX_MESSAGE_LEN
] = 0;
642 MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, msg
, title
, MB_ICONWARNING
);
648 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
649 VARIANT_BOOL
*confirmed
)
651 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
654 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
656 if(!confirmed
) return E_INVALIDARG
;
658 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
659 sizeof(wszTitle
)/sizeof(WCHAR
))) {
660 WARN("Could not load message box title: %d\n", GetLastError());
661 *confirmed
= VARIANT_TRUE
;
665 if(MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, message
, wszTitle
,
666 MB_OKCANCEL
|MB_ICONQUESTION
)==IDOK
)
667 *confirmed
= VARIANT_TRUE
;
668 else *confirmed
= VARIANT_FALSE
;
680 static INT_PTR CALLBACK
prompt_dlgproc(HWND hwnd
, UINT msg
,
681 WPARAM wparam
, LPARAM lparam
)
687 prompt_arg
*arg
= (prompt_arg
*)lparam
;
690 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
691 sizeof(wszTitle
)/sizeof(WCHAR
))) {
692 WARN("Could not load message box title: %d\n", GetLastError());
693 EndDialog(hwnd
, wparam
);
697 SetWindowLongPtrW(hwnd
, DWLP_USER
, lparam
);
698 SetWindowTextW(hwnd
, wszTitle
);
699 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_PROMPT
), arg
->message
);
700 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_EDIT
), arg
->dststr
);
706 case MAKEWPARAM(IDCANCEL
, BN_CLICKED
):
707 EndDialog(hwnd
, wparam
);
709 case MAKEWPARAM(IDOK
, BN_CLICKED
):
712 (prompt_arg
*)GetWindowLongPtrW(hwnd
, DWLP_USER
);
713 HWND hwndPrompt
= GetDlgItem(hwnd
, ID_PROMPT_EDIT
);
714 INT len
= GetWindowTextLengthW(hwndPrompt
);
718 EndDialog(hwnd
, wparam
);
722 V_VT(arg
->textdata
) = VT_BSTR
;
723 if(!len
&& !arg
->dststr
)
724 V_BSTR(arg
->textdata
) = NULL
;
727 V_BSTR(arg
->textdata
) = SysAllocStringLen(NULL
, len
);
728 GetWindowTextW(hwndPrompt
, V_BSTR(arg
->textdata
), len
+1);
730 EndDialog(hwnd
, wparam
);
736 EndDialog(hwnd
, IDCANCEL
);
743 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
744 BSTR dststr
, VARIANT
*textdata
)
746 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
749 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
751 if(textdata
) V_VT(textdata
) = VT_NULL
;
753 arg
.message
= message
;
755 arg
.textdata
= textdata
;
757 DialogBoxParamW(hInst
, MAKEINTRESOURCEW(ID_PROMPT_DIALOG
),
758 This
->outer_window
->doc_obj
->hwnd
, prompt_dlgproc
, (LPARAM
)&arg
);
762 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
764 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
765 HTMLInnerWindow
*window
= This
->inner_window
;
767 TRACE("(%p)->(%p)\n", This
, p
);
769 if(!window
->image_factory
) {
772 hres
= HTMLImageElementFactory_Create(window
, &window
->image_factory
);
777 *p
= &window
->image_factory
->IHTMLImageElementFactory_iface
;
778 IHTMLImageElementFactory_AddRef(*p
);
783 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
785 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
786 HTMLLocation
*location
;
789 TRACE("(%p)->(%p)\n", This
, p
);
791 hres
= get_location(This
->inner_window
, &location
);
795 *p
= &location
->IHTMLLocation_iface
;
799 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
801 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
802 HTMLInnerWindow
*window
= This
->inner_window
;
804 TRACE("(%p)->(%p)\n", This
, p
);
806 if(!window
->history
) {
809 hres
= create_history(window
, &window
->history
);
814 IOmHistory_AddRef(&window
->history
->IOmHistory_iface
);
815 *p
= &window
->history
->IOmHistory_iface
;
819 static BOOL
notify_webbrowser_close(HTMLOuterWindow
*window
, HTMLDocumentObj
*doc
)
821 IConnectionPointContainer
*cp_container
;
822 VARIANT_BOOL cancel
= VARIANT_FALSE
;
823 IEnumConnections
*enum_conn
;
825 DISPPARAMS dp
= {args
, NULL
, 2, 0};
826 CONNECTDATA conn_data
;
827 IConnectionPoint
*cp
;
835 hres
= IUnknown_QueryInterface(doc
->webbrowser
, &IID_IConnectionPointContainer
, (void**)&cp_container
);
839 hres
= IConnectionPointContainer_FindConnectionPoint(cp_container
, &DIID_DWebBrowserEvents2
, &cp
);
840 IConnectionPointContainer_Release(cp_container
);
844 hres
= IConnectionPoint_EnumConnections(cp
, &enum_conn
);
845 IConnectionPoint_Release(cp
);
850 conn_data
.pUnk
= NULL
;
851 conn_data
.dwCookie
= 0;
853 hres
= IEnumConnections_Next(enum_conn
, 1, &conn_data
, &fetched
);
857 hres
= IUnknown_QueryInterface(conn_data
.pUnk
, &IID_IDispatch
, (void**)&disp
);
858 IUnknown_Release(conn_data
.pUnk
);
862 V_VT(args
) = VT_BYREF
|VT_BOOL
;
863 V_BOOLREF(args
) = &cancel
;
864 V_VT(args
+1) = VT_BOOL
;
865 V_BOOL(args
+1) = window
->parent
? VARIANT_TRUE
: VARIANT_FALSE
;
866 hres
= IDispatch_Invoke(disp
, DISPID_WINDOWCLOSING
, &IID_NULL
, 0, DISPATCH_METHOD
, &dp
, NULL
, NULL
, NULL
);
867 IDispatch_Release(disp
);
869 cancel
= VARIANT_FALSE
;
872 IEnumConnections_Release(enum_conn
);
876 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
878 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
879 HTMLOuterWindow
*window
= This
->outer_window
;
881 TRACE("(%p)\n", This
);
883 if(!window
->doc_obj
) {
884 FIXME("No document object\n");
888 if(!notify_webbrowser_close(window
, window
->doc_obj
))
891 FIXME("default action not implemented\n");
895 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
897 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
898 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
902 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
904 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
906 FIXME("(%p)->(%p) returning empty\n", This
, p
);
912 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
914 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
916 TRACE("(%p)->(%p)\n", This
, p
);
918 *p
= OmNavigator_Create();
919 return *p
? S_OK
: E_OUTOFMEMORY
;
922 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
924 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
928 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
930 nsAString_InitDepend(&name_str
, v
);
931 nsres
= nsIDOMWindow_SetName(This
->outer_window
->nswindow
, &name_str
);
932 nsAString_Finish(&name_str
);
934 ERR("SetName failed: %08x\n", nsres
);
939 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
941 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
945 TRACE("(%p)->(%p)\n", This
, p
);
947 nsAString_Init(&name_str
, NULL
);
948 nsres
= nsIDOMWindow_GetName(This
->outer_window
->nswindow
, &name_str
);
949 return return_nsstr(nsres
, &name_str
, p
);
952 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
954 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
955 HTMLOuterWindow
*window
= This
->outer_window
;
957 TRACE("(%p)->(%p)\n", This
, p
);
960 return IHTMLWindow2_get_self(&This
->IHTMLWindow2_iface
, p
);
962 *p
= &window
->parent
->base
.IHTMLWindow2_iface
;
963 IHTMLWindow2_AddRef(*p
);
967 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
968 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
970 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
971 HTMLOuterWindow
*window
= This
->outer_window
;
975 static const WCHAR _selfW
[] = {'_','s','e','l','f',0};
977 TRACE("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
978 debugstr_w(features
), replace
, pomWindowResult
);
980 FIXME("unsupported features argument %s\n", debugstr_w(features
));
982 FIXME("unsupported relace argument\n");
984 if(!window
->doc_obj
|| !window
->uri_nofrag
)
987 if(name
&& *name
== '_') {
988 if(!strcmpW(name
, _selfW
)) {
989 if((features
&& *features
) || replace
)
990 FIXME("Unsupported arguments for _self target\n");
992 hres
= IHTMLWindow2_navigate(&This
->IHTMLWindow2_iface
, url
);
996 if(pomWindowResult
) {
997 FIXME("Returning this window for _self target\n");
998 *pomWindowResult
= &This
->IHTMLWindow2_iface
;
999 IHTMLWindow2_AddRef(*pomWindowResult
);
1005 FIXME("Unsupported name %s\n", debugstr_w(name
));
1009 hres
= create_relative_uri(window
, url
, &uri
);
1013 hres
= navigate_new_window(window
, uri
, name
, NULL
, pomWindowResult
);
1018 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1020 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1022 TRACE("(%p)->(%p)\n", This
, p
);
1024 /* FIXME: We should return kind of proxy window here. */
1025 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1026 *p
= &This
->IHTMLWindow2_iface
;
1030 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1032 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1033 HTMLOuterWindow
*top
;
1035 TRACE("(%p)->(%p)\n", This
, p
);
1037 get_top_window(This
->outer_window
, &top
);
1038 *p
= &top
->base
.IHTMLWindow2_iface
;
1039 IHTMLWindow2_AddRef(*p
);
1044 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1046 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1048 TRACE("(%p)->(%p)\n", This
, p
);
1050 /* FIXME: We should return kind of proxy window here. */
1051 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1052 *p
= &This
->IHTMLWindow2_iface
;
1056 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
1058 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1060 TRACE("(%p)->(%s)\n", This
, debugstr_w(url
));
1062 return navigate_url(This
->outer_window
, url
, This
->outer_window
->uri
, BINDING_NAVIGATED
);
1065 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
1067 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1069 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1071 return set_window_event(This
, EVENTID_FOCUS
, &v
);
1074 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
1076 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1078 TRACE("(%p)->(%p)\n", This
, p
);
1080 return get_window_event(This
, EVENTID_FOCUS
, p
);
1083 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
1085 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1087 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1089 return set_window_event(This
, EVENTID_BLUR
, &v
);
1092 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
1094 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1096 TRACE("(%p)->(%p)\n", This
, p
);
1098 return get_window_event(This
, EVENTID_BLUR
, p
);
1101 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
1103 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1105 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1107 return set_window_event(This
, EVENTID_LOAD
, &v
);
1110 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
1112 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1114 TRACE("(%p)->(%p)\n", This
, p
);
1116 return get_window_event(This
, EVENTID_LOAD
, p
);
1119 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
1121 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1123 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1125 return set_window_event(This
, EVENTID_BEFOREUNLOAD
, &v
);
1128 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
1130 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1132 TRACE("(%p)->(%p)\n", This
, p
);
1134 return get_window_event(This
, EVENTID_BEFOREUNLOAD
, p
);
1137 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
1139 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1141 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1143 return set_window_event(This
, EVENTID_UNLOAD
, &v
);
1146 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
1148 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1150 TRACE("(%p)->(%p)\n", This
, p
);
1152 return get_window_event(This
, EVENTID_UNLOAD
, p
);
1155 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
1157 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1159 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1161 return set_window_event(This
, EVENTID_HELP
, &v
);
1164 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
1166 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1168 TRACE("(%p)->(%p)\n", This
, p
);
1170 return get_window_event(This
, EVENTID_HELP
, p
);
1173 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
1175 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1177 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1179 return set_window_event(This
, EVENTID_ERROR
, &v
);
1182 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
1184 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1186 TRACE("(%p)->(%p)\n", This
, p
);
1188 return get_window_event(This
, EVENTID_ERROR
, p
);
1191 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
1193 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1195 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1197 return set_window_event(This
, EVENTID_RESIZE
, &v
);
1200 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
1202 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1204 TRACE("(%p)->(%p)\n", This
, p
);
1206 return get_window_event(This
, EVENTID_RESIZE
, p
);
1209 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
1211 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1213 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1215 return set_window_event(This
, EVENTID_SCROLL
, &v
);
1218 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
1220 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1222 TRACE("(%p)->(%p)\n", This
, p
);
1224 return get_window_event(This
, EVENTID_SCROLL
, p
);
1227 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
1229 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1231 TRACE("(%p)->(%p)\n", This
, p
);
1233 if(This
->inner_window
->doc
) {
1234 /* FIXME: We should return a wrapper object here */
1235 *p
= &This
->inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1236 IHTMLDocument2_AddRef(*p
);
1244 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
1246 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1247 HTMLInnerWindow
*window
= This
->inner_window
;
1249 TRACE("(%p)->(%p)\n", This
, p
);
1252 IHTMLEventObj_AddRef(window
->event
);
1257 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
1259 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1260 FIXME("(%p)->(%p)\n", This
, p
);
1264 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
1265 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
1267 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1268 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
1272 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
1275 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1276 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(helpURL
), debugstr_variant(&helpArg
), debugstr_w(features
));
1280 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
1282 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1283 HTMLInnerWindow
*window
= This
->inner_window
;
1285 TRACE("(%p)->(%p)\n", This
, p
);
1287 if(!window
->screen
) {
1290 hres
= HTMLScreen_Create(&window
->screen
);
1295 *p
= window
->screen
;
1296 IHTMLScreen_AddRef(window
->screen
);
1300 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
1302 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1303 HTMLInnerWindow
*window
= This
->inner_window
;
1305 TRACE("(%p)->(%p)\n", This
, p
);
1307 if(!window
->option_factory
) {
1310 hres
= HTMLOptionElementFactory_Create(window
, &window
->option_factory
);
1315 *p
= &window
->option_factory
->IHTMLOptionElementFactory_iface
;
1316 IHTMLOptionElementFactory_AddRef(*p
);
1321 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
1323 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1325 TRACE("(%p)->()\n", This
);
1327 if(This
->outer_window
->doc_obj
)
1328 SetFocus(This
->outer_window
->doc_obj
->hwnd
);
1332 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
1334 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1335 FIXME("(%p)->(%p)\n", This
, p
);
1339 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
1341 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1342 FIXME("(%p)->()\n", This
);
1346 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1348 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1351 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1353 nsres
= nsIDOMWindow_Scroll(This
->outer_window
->nswindow
, x
, y
);
1354 if(NS_FAILED(nsres
)) {
1355 ERR("ScrollBy failed: %08x\n", nsres
);
1362 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
1364 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1366 TRACE("(%p)->(%p)\n", This
, p
);
1368 return IHTMLWindow2_get_navigator(&This
->IHTMLWindow2_iface
, p
);
1371 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
1372 LONG msec
, VARIANT
*language
, LONG
*timerID
)
1374 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1377 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
1379 V_VT(&expr
) = VT_BSTR
;
1380 V_BSTR(&expr
) = expression
;
1381 return IHTMLWindow3_setInterval(&This
->IHTMLWindow3_iface
, &expr
, msec
, language
, timerID
);
1384 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, LONG timerID
)
1386 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1388 TRACE("(%p)->(%d)\n", This
, timerID
);
1390 return clear_task_timer(This
->inner_window
, timerID
);
1393 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
1395 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1396 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1400 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
1402 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1403 FIXME("(%p)->(%p)\n", This
, p
);
1407 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
1410 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1412 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
1414 return exec_script(This
->inner_window
, scode
, language
, pvarRet
);
1417 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
1419 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1421 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1423 TRACE("(%p)->(%p)\n", This
, String
);
1426 return E_INVALIDARG
;
1428 *String
= SysAllocString(objectW
);
1429 return *String
? S_OK
: E_OUTOFMEMORY
;
1432 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1434 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1437 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1439 nsres
= nsIDOMWindow_ScrollBy(This
->outer_window
->nswindow
, x
, y
);
1440 if(NS_FAILED(nsres
))
1441 ERR("ScrollBy failed: %08x\n", nsres
);
1446 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1448 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1451 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1453 nsres
= nsIDOMWindow_ScrollTo(This
->outer_window
->nswindow
, x
, y
);
1454 if(NS_FAILED(nsres
))
1455 ERR("ScrollTo failed: %08x\n", nsres
);
1460 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1462 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1463 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1467 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1469 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1470 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1474 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1476 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1477 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1481 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1483 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1484 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1488 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
1490 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1492 TRACE("(%p)->(%p)\n", This
, p
);
1496 if(!This
->outer_window
->doc_obj
->hostui
)
1499 return IDocHostUIHandler_GetExternal(This
->outer_window
->doc_obj
->hostui
, p
);
1502 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
1503 HTMLWindow2_QueryInterface
,
1505 HTMLWindow2_Release
,
1506 HTMLWindow2_GetTypeInfoCount
,
1507 HTMLWindow2_GetTypeInfo
,
1508 HTMLWindow2_GetIDsOfNames
,
1511 HTMLWindow2_get_length
,
1512 HTMLWindow2_get_frames
,
1513 HTMLWindow2_put_defaultStatus
,
1514 HTMLWindow2_get_defaultStatus
,
1515 HTMLWindow2_put_status
,
1516 HTMLWindow2_get_status
,
1517 HTMLWindow2_setTimeout
,
1518 HTMLWindow2_clearTimeout
,
1520 HTMLWindow2_confirm
,
1522 HTMLWindow2_get_Image
,
1523 HTMLWindow2_get_location
,
1524 HTMLWindow2_get_history
,
1526 HTMLWindow2_put_opener
,
1527 HTMLWindow2_get_opener
,
1528 HTMLWindow2_get_navigator
,
1529 HTMLWindow2_put_name
,
1530 HTMLWindow2_get_name
,
1531 HTMLWindow2_get_parent
,
1533 HTMLWindow2_get_self
,
1534 HTMLWindow2_get_top
,
1535 HTMLWindow2_get_window
,
1536 HTMLWindow2_navigate
,
1537 HTMLWindow2_put_onfocus
,
1538 HTMLWindow2_get_onfocus
,
1539 HTMLWindow2_put_onblur
,
1540 HTMLWindow2_get_onblur
,
1541 HTMLWindow2_put_onload
,
1542 HTMLWindow2_get_onload
,
1543 HTMLWindow2_put_onbeforeunload
,
1544 HTMLWindow2_get_onbeforeunload
,
1545 HTMLWindow2_put_onunload
,
1546 HTMLWindow2_get_onunload
,
1547 HTMLWindow2_put_onhelp
,
1548 HTMLWindow2_get_onhelp
,
1549 HTMLWindow2_put_onerror
,
1550 HTMLWindow2_get_onerror
,
1551 HTMLWindow2_put_onresize
,
1552 HTMLWindow2_get_onresize
,
1553 HTMLWindow2_put_onscroll
,
1554 HTMLWindow2_get_onscroll
,
1555 HTMLWindow2_get_document
,
1556 HTMLWindow2_get_event
,
1557 HTMLWindow2_get__newEnum
,
1558 HTMLWindow2_showModalDialog
,
1559 HTMLWindow2_showHelp
,
1560 HTMLWindow2_get_screen
,
1561 HTMLWindow2_get_Option
,
1563 HTMLWindow2_get_closed
,
1566 HTMLWindow2_get_clientInformation
,
1567 HTMLWindow2_setInterval
,
1568 HTMLWindow2_clearInterval
,
1569 HTMLWindow2_put_offscreenBuffering
,
1570 HTMLWindow2_get_offscreenBuffering
,
1571 HTMLWindow2_execScript
,
1572 HTMLWindow2_toString
,
1573 HTMLWindow2_scrollBy
,
1574 HTMLWindow2_scrollTo
,
1577 HTMLWindow2_resizeTo
,
1578 HTMLWindow2_resizeBy
,
1579 HTMLWindow2_get_external
1582 static inline HTMLWindow
*impl_from_IHTMLWindow3(IHTMLWindow3
*iface
)
1584 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow3_iface
);
1587 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
1589 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1591 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1594 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
1596 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1598 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1601 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
1603 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1605 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1608 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
1610 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1612 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1615 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
1616 LCID lcid
, ITypeInfo
**ppTInfo
)
1618 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1620 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1623 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
1624 LPOLESTR
*rgszNames
, UINT cNames
,
1625 LCID lcid
, DISPID
*rgDispId
)
1627 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1629 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1633 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
1634 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1635 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1637 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1639 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1640 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1643 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, LONG
*p
)
1645 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1648 TRACE("(%p)->(%p)\n", This
, p
);
1650 nsres
= nsIDOMWindow_GetScreenX(This
->outer_window
->nswindow
, p
);
1651 if(NS_FAILED(nsres
)) {
1652 ERR("GetScreenX failed: %08x\n", nsres
);
1659 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, LONG
*p
)
1661 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1664 TRACE("(%p)->(%p)\n", This
, p
);
1666 nsres
= nsIDOMWindow_GetScreenY(This
->outer_window
->nswindow
, p
);
1667 if(NS_FAILED(nsres
)) {
1668 ERR("GetScreenY failed: %08x\n", nsres
);
1675 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
1677 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1678 HTMLInnerWindow
*window
= This
->inner_window
;
1680 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
1683 FIXME("No document\n");
1687 return attach_event(&window
->event_target
, event
, pDisp
, pfResult
);
1690 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
1692 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1693 HTMLInnerWindow
*window
= This
->inner_window
;
1695 TRACE("(%p)->()\n", This
);
1698 FIXME("No document\n");
1702 return detach_event(&window
->event_target
, event
, pDisp
);
1705 static HRESULT
window_set_timer(HTMLInnerWindow
*This
, VARIANT
*expr
, LONG msec
, VARIANT
*language
,
1706 BOOL interval
, LONG
*timer_id
)
1708 IDispatch
*disp
= NULL
;
1711 switch(V_VT(expr
)) {
1713 disp
= V_DISPATCH(expr
);
1714 IDispatch_AddRef(disp
);
1718 disp
= script_parse_event(This
->base
.inner_window
, V_BSTR(expr
));
1722 FIXME("unimplemented expr %s\n", debugstr_variant(expr
));
1729 hres
= set_task_timer(This
, msec
, interval
, disp
, timer_id
);
1730 IDispatch_Release(disp
);
1735 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1736 VARIANT
*language
, LONG
*timerID
)
1738 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1740 TRACE("(%p)->(%s %d %s %p)\n", This
, debugstr_variant(expression
), msec
, debugstr_variant(language
), timerID
);
1742 return window_set_timer(This
->inner_window
, expression
, msec
, language
, FALSE
, timerID
);
1745 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1746 VARIANT
*language
, LONG
*timerID
)
1748 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1750 TRACE("(%p)->(%p %d %p %p)\n", This
, expression
, msec
, language
, timerID
);
1752 return window_set_timer(This
->inner_window
, expression
, msec
, language
, TRUE
, timerID
);
1755 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
1757 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1758 FIXME("(%p)\n", This
);
1762 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
1764 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1765 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1769 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1771 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1772 FIXME("(%p)->(%p)\n", This
, p
);
1776 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
1778 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1779 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1783 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1785 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1786 FIXME("(%p)->(%p)\n", This
, p
);
1790 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
1792 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1793 FIXME("(%p)->(%p)\n", This
, p
);
1797 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
1798 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
1800 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1801 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
1805 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
1806 HTMLWindow3_QueryInterface
,
1808 HTMLWindow3_Release
,
1809 HTMLWindow3_GetTypeInfoCount
,
1810 HTMLWindow3_GetTypeInfo
,
1811 HTMLWindow3_GetIDsOfNames
,
1813 HTMLWindow3_get_screenLeft
,
1814 HTMLWindow3_get_screenTop
,
1815 HTMLWindow3_attachEvent
,
1816 HTMLWindow3_detachEvent
,
1817 HTMLWindow3_setTimeout
,
1818 HTMLWindow3_setInterval
,
1820 HTMLWindow3_put_onbeforeprint
,
1821 HTMLWindow3_get_onbeforeprint
,
1822 HTMLWindow3_put_onafterprint
,
1823 HTMLWindow3_get_onafterprint
,
1824 HTMLWindow3_get_clipboardData
,
1825 HTMLWindow3_showModelessDialog
1828 static inline HTMLWindow
*impl_from_IHTMLWindow4(IHTMLWindow4
*iface
)
1830 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow4_iface
);
1833 static HRESULT WINAPI
HTMLWindow4_QueryInterface(IHTMLWindow4
*iface
, REFIID riid
, void **ppv
)
1835 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1837 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1840 static ULONG WINAPI
HTMLWindow4_AddRef(IHTMLWindow4
*iface
)
1842 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1844 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1847 static ULONG WINAPI
HTMLWindow4_Release(IHTMLWindow4
*iface
)
1849 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1851 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1854 static HRESULT WINAPI
HTMLWindow4_GetTypeInfoCount(IHTMLWindow4
*iface
, UINT
*pctinfo
)
1856 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1858 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1861 static HRESULT WINAPI
HTMLWindow4_GetTypeInfo(IHTMLWindow4
*iface
, UINT iTInfo
,
1862 LCID lcid
, ITypeInfo
**ppTInfo
)
1864 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1866 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1869 static HRESULT WINAPI
HTMLWindow4_GetIDsOfNames(IHTMLWindow4
*iface
, REFIID riid
,
1870 LPOLESTR
*rgszNames
, UINT cNames
,
1871 LCID lcid
, DISPID
*rgDispId
)
1873 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1875 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1879 static HRESULT WINAPI
HTMLWindow4_Invoke(IHTMLWindow4
*iface
, DISPID dispIdMember
,
1880 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1881 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1883 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1885 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1886 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1889 static HRESULT WINAPI
HTMLWindow4_createPopup(IHTMLWindow4
*iface
, VARIANT
*varArgIn
,
1890 IDispatch
**ppPopup
)
1892 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1893 FIXME("(%p)->(%p %p)\n", This
, varArgIn
, ppPopup
);
1897 static HRESULT WINAPI
HTMLWindow4_get_frameElement(IHTMLWindow4
*iface
, IHTMLFrameBase
**p
)
1899 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1900 TRACE("(%p)->(%p)\n", This
, p
);
1902 if(This
->outer_window
->frame_element
) {
1903 *p
= &This
->outer_window
->frame_element
->IHTMLFrameBase_iface
;
1904 IHTMLFrameBase_AddRef(*p
);
1911 static const IHTMLWindow4Vtbl HTMLWindow4Vtbl
= {
1912 HTMLWindow4_QueryInterface
,
1914 HTMLWindow4_Release
,
1915 HTMLWindow4_GetTypeInfoCount
,
1916 HTMLWindow4_GetTypeInfo
,
1917 HTMLWindow4_GetIDsOfNames
,
1919 HTMLWindow4_createPopup
,
1920 HTMLWindow4_get_frameElement
1923 static inline HTMLWindow
*impl_from_IHTMLWindow5(IHTMLWindow5
*iface
)
1925 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow5_iface
);
1928 static HRESULT WINAPI
HTMLWindow5_QueryInterface(IHTMLWindow5
*iface
, REFIID riid
, void **ppv
)
1930 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1932 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1935 static ULONG WINAPI
HTMLWindow5_AddRef(IHTMLWindow5
*iface
)
1937 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1939 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1942 static ULONG WINAPI
HTMLWindow5_Release(IHTMLWindow5
*iface
)
1944 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1946 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1949 static HRESULT WINAPI
HTMLWindow5_GetTypeInfoCount(IHTMLWindow5
*iface
, UINT
*pctinfo
)
1951 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1953 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1956 static HRESULT WINAPI
HTMLWindow5_GetTypeInfo(IHTMLWindow5
*iface
, UINT iTInfo
,
1957 LCID lcid
, ITypeInfo
**ppTInfo
)
1959 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1961 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1964 static HRESULT WINAPI
HTMLWindow5_GetIDsOfNames(IHTMLWindow5
*iface
, REFIID riid
,
1965 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1967 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1969 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1973 static HRESULT WINAPI
HTMLWindow5_Invoke(IHTMLWindow5
*iface
, DISPID dispIdMember
,
1974 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1975 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1977 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1979 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1980 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1983 static HRESULT WINAPI
HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT v
)
1985 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1986 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1990 static HRESULT WINAPI
HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT
*p
)
1992 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1993 HTMLInnerWindow
*window
= This
->inner_window
;
1995 TRACE("(%p)->(%p)\n", This
, p
);
1997 if(!window
->xhr_factory
) {
2000 hres
= HTMLXMLHttpRequestFactory_Create(window
, &window
->xhr_factory
);
2006 V_VT(p
) = VT_DISPATCH
;
2007 V_DISPATCH(p
) = (IDispatch
*)&window
->xhr_factory
->IHTMLXMLHttpRequestFactory_iface
;
2008 IDispatch_AddRef(V_DISPATCH(p
));
2013 static const IHTMLWindow5Vtbl HTMLWindow5Vtbl
= {
2014 HTMLWindow5_QueryInterface
,
2016 HTMLWindow5_Release
,
2017 HTMLWindow5_GetTypeInfoCount
,
2018 HTMLWindow5_GetTypeInfo
,
2019 HTMLWindow5_GetIDsOfNames
,
2021 HTMLWindow5_put_XMLHttpRequest
,
2022 HTMLWindow5_get_XMLHttpRequest
2025 static inline HTMLWindow
*impl_from_IHTMLWindow6(IHTMLWindow6
*iface
)
2027 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow6_iface
);
2030 static HRESULT WINAPI
HTMLWindow6_QueryInterface(IHTMLWindow6
*iface
, REFIID riid
, void **ppv
)
2032 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2034 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2037 static ULONG WINAPI
HTMLWindow6_AddRef(IHTMLWindow6
*iface
)
2039 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2041 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2044 static ULONG WINAPI
HTMLWindow6_Release(IHTMLWindow6
*iface
)
2046 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2048 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2051 static HRESULT WINAPI
HTMLWindow6_GetTypeInfoCount(IHTMLWindow6
*iface
, UINT
*pctinfo
)
2053 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2055 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2058 static HRESULT WINAPI
HTMLWindow6_GetTypeInfo(IHTMLWindow6
*iface
, UINT iTInfo
,
2059 LCID lcid
, ITypeInfo
**ppTInfo
)
2061 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2063 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2066 static HRESULT WINAPI
HTMLWindow6_GetIDsOfNames(IHTMLWindow6
*iface
, REFIID riid
,
2067 LPOLESTR
*rgszNames
, UINT cNames
,
2068 LCID lcid
, DISPID
*rgDispId
)
2070 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2072 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2076 static HRESULT WINAPI
HTMLWindow6_Invoke(IHTMLWindow6
*iface
, DISPID dispIdMember
,
2077 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2078 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2080 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2082 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2083 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2086 static HRESULT WINAPI
HTMLWindow6_put_XDomainRequest(IHTMLWindow6
*iface
, VARIANT v
)
2088 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2089 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2093 static HRESULT WINAPI
HTMLWindow6_get_XDomainRequest(IHTMLWindow6
*iface
, VARIANT
*p
)
2095 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2096 FIXME("(%p)->(%p)\n", This
, p
);
2100 static HRESULT WINAPI
HTMLWindow6_get_sessionStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
2102 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2104 FIXME("(%p)->(%p)\n", This
, p
);
2106 if(!This
->inner_window
->session_storage
) {
2109 hres
= create_storage(&This
->inner_window
->session_storage
);
2114 IHTMLStorage_AddRef(This
->inner_window
->session_storage
);
2115 *p
= This
->inner_window
->session_storage
;
2119 static HRESULT WINAPI
HTMLWindow6_get_localStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
2121 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2122 FIXME("(%p)->(%p)\n", This
, p
);
2126 static HRESULT WINAPI
HTMLWindow6_put_onhashchange(IHTMLWindow6
*iface
, VARIANT v
)
2128 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2129 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2133 static HRESULT WINAPI
HTMLWindow6_get_onhashchange(IHTMLWindow6
*iface
, VARIANT
*p
)
2135 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2136 FIXME("(%p)->(%p)\n", This
, p
);
2140 static HRESULT WINAPI
HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6
*iface
, LONG
*p
)
2142 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2143 FIXME("(%p)->(%p)\n", This
, p
);
2147 static HRESULT WINAPI
HTMLWindow6_postMessage(IHTMLWindow6
*iface
, BSTR msg
, VARIANT targetOrigin
)
2149 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2151 FIXME("(%p)->(%s %s) semi-stub\n", This
, debugstr_w(msg
), debugstr_variant(&targetOrigin
));
2153 if(!This
->inner_window
->doc
) {
2154 FIXME("No document\n");
2158 fire_event(This
->inner_window
->doc
, EVENTID_MESSAGE
, TRUE
, &This
->inner_window
->doc
->node
, NULL
, NULL
);
2162 static HRESULT WINAPI
HTMLWindow6_toStaticHTML(IHTMLWindow6
*iface
, BSTR bstrHTML
, BSTR
*pbstrStaticHTML
)
2164 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2165 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrHTML
), pbstrStaticHTML
);
2169 static HRESULT WINAPI
HTMLWindow6_put_onmessage(IHTMLWindow6
*iface
, VARIANT v
)
2171 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2173 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2175 return set_window_event(This
, EVENTID_MESSAGE
, &v
);
2178 static HRESULT WINAPI
HTMLWindow6_get_onmessage(IHTMLWindow6
*iface
, VARIANT
*p
)
2180 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2182 TRACE("(%p)->(%p)\n", This
, p
);
2184 return get_window_event(This
, EVENTID_MESSAGE
, p
);
2187 static HRESULT WINAPI
HTMLWindow6_msWriteProfilerMark(IHTMLWindow6
*iface
, BSTR bstrProfilerMark
)
2189 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2190 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrProfilerMark
));
2194 static const IHTMLWindow6Vtbl HTMLWindow6Vtbl
= {
2195 HTMLWindow6_QueryInterface
,
2197 HTMLWindow6_Release
,
2198 HTMLWindow6_GetTypeInfoCount
,
2199 HTMLWindow6_GetTypeInfo
,
2200 HTMLWindow6_GetIDsOfNames
,
2202 HTMLWindow6_put_XDomainRequest
,
2203 HTMLWindow6_get_XDomainRequest
,
2204 HTMLWindow6_get_sessionStorage
,
2205 HTMLWindow6_get_localStorage
,
2206 HTMLWindow6_put_onhashchange
,
2207 HTMLWindow6_get_onhashchange
,
2208 HTMLWindow6_get_maxConnectionsPerServer
,
2209 HTMLWindow6_postMessage
,
2210 HTMLWindow6_toStaticHTML
,
2211 HTMLWindow6_put_onmessage
,
2212 HTMLWindow6_get_onmessage
,
2213 HTMLWindow6_msWriteProfilerMark
2216 static inline HTMLWindow
*impl_from_IHTMLPrivateWindow(IHTMLPrivateWindow
*iface
)
2218 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLPrivateWindow_iface
);
2221 static HRESULT WINAPI
HTMLPrivateWindow_QueryInterface(IHTMLPrivateWindow
*iface
, REFIID riid
, void **ppv
)
2223 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2225 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2228 static ULONG WINAPI
HTMLPrivateWindow_AddRef(IHTMLPrivateWindow
*iface
)
2230 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2232 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2235 static ULONG WINAPI
HTMLPrivateWindow_Release(IHTMLPrivateWindow
*iface
)
2237 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2239 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2242 static HRESULT WINAPI
HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow
*iface
, BSTR url
, BSTR arg2
, BSTR arg3
,
2243 BSTR arg4
, VARIANT
*post_data_var
, VARIANT
*headers_var
, ULONG flags
)
2245 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2246 HTMLOuterWindow
*window
= This
->outer_window
;
2247 OLECHAR
*translated_url
= NULL
;
2248 DWORD post_data_size
= 0;
2249 BYTE
*post_data
= NULL
;
2250 WCHAR
*headers
= NULL
;
2254 TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This
, debugstr_w(url
), debugstr_w(arg2
), debugstr_w(arg3
), debugstr_w(arg4
),
2255 debugstr_variant(post_data_var
), debugstr_variant(headers_var
), flags
);
2257 if(window
->doc_obj
->hostui
) {
2258 hres
= IDocHostUIHandler_TranslateUrl(window
->doc_obj
->hostui
, 0, url
, &translated_url
);
2260 translated_url
= NULL
;
2263 hres
= create_uri(translated_url
? translated_url
: url
, 0, &uri
);
2264 CoTaskMemFree(translated_url
);
2269 if(V_VT(post_data_var
) == (VT_ARRAY
|VT_UI1
)) {
2270 SafeArrayAccessData(V_ARRAY(post_data_var
), (void**)&post_data
);
2271 post_data_size
= V_ARRAY(post_data_var
)->rgsabound
[0].cElements
;
2275 if(headers_var
&& V_VT(headers_var
) != VT_EMPTY
&& V_VT(headers_var
) != VT_ERROR
) {
2276 if(V_VT(headers_var
) != VT_BSTR
)
2277 return E_INVALIDARG
;
2279 headers
= V_BSTR(headers_var
);
2282 hres
= super_navigate(window
, uri
, BINDING_NAVIGATED
|BINDING_NOFRAG
, headers
, post_data
, post_data_size
);
2285 SafeArrayUnaccessData(V_ARRAY(post_data_var
));
2290 static HRESULT WINAPI
HTMLPrivateWindow_GetPendingUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2292 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2293 FIXME("(%p)->(%p)\n", This
, url
);
2297 static HRESULT WINAPI
HTMLPrivateWindow_SetPICSTarget(IHTMLPrivateWindow
*iface
, IOleCommandTarget
*cmdtrg
)
2299 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2300 FIXME("(%p)->(%p)\n", This
, cmdtrg
);
2304 static HRESULT WINAPI
HTMLPrivateWindow_PICSComplete(IHTMLPrivateWindow
*iface
, int arg
)
2306 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2307 FIXME("(%p)->(%x)\n", This
, arg
);
2311 static HRESULT WINAPI
HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow
*iface
, LPCWSTR name
, IHTMLWindow2
**ret
)
2313 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2314 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), ret
);
2318 static HRESULT WINAPI
HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2320 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2321 TRACE("(%p)->(%p)\n", This
, url
);
2324 return E_INVALIDARG
;
2326 *url
= SysAllocString(This
->outer_window
->url
);
2330 static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl
= {
2331 HTMLPrivateWindow_QueryInterface
,
2332 HTMLPrivateWindow_AddRef
,
2333 HTMLPrivateWindow_Release
,
2334 HTMLPrivateWindow_SuperNavigate
,
2335 HTMLPrivateWindow_GetPendingUrl
,
2336 HTMLPrivateWindow_SetPICSTarget
,
2337 HTMLPrivateWindow_PICSComplete
,
2338 HTMLPrivateWindow_FindWindowByName
,
2339 HTMLPrivateWindow_GetAddressBarUrl
2342 static inline HTMLWindow
*impl_from_ITravelLogClient(ITravelLogClient
*iface
)
2344 return CONTAINING_RECORD(iface
, HTMLWindow
, ITravelLogClient_iface
);
2347 static HRESULT WINAPI
TravelLogClient_QueryInterface(ITravelLogClient
*iface
, REFIID riid
, void **ppv
)
2349 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2351 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2354 static ULONG WINAPI
TravelLogClient_AddRef(ITravelLogClient
*iface
)
2356 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2358 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2361 static ULONG WINAPI
TravelLogClient_Release(ITravelLogClient
*iface
)
2363 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2365 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2368 static HRESULT WINAPI
TravelLogClient_FindWindowByIndex(ITravelLogClient
*iface
, DWORD dwID
, IUnknown
**ppunk
)
2370 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2372 FIXME("(%p)->(%d %p) semi-stub\n", This
, dwID
, ppunk
);
2378 static HRESULT WINAPI
TravelLogClient_GetWindowData(ITravelLogClient
*iface
, IStream
*pStream
, LPWINDOWDATA pWinData
)
2380 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2381 FIXME("(%p)->(%p %p)\n", This
, pStream
, pWinData
);
2385 static HRESULT WINAPI
TravelLogClient_LoadHistoryPosition(ITravelLogClient
*iface
, LPWSTR pszUrlLocation
, DWORD dwPosition
)
2387 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2388 FIXME("(%p)->(%s %d)\n", This
, debugstr_w(pszUrlLocation
), dwPosition
);
2392 static const ITravelLogClientVtbl TravelLogClientVtbl
= {
2393 TravelLogClient_QueryInterface
,
2394 TravelLogClient_AddRef
,
2395 TravelLogClient_Release
,
2396 TravelLogClient_FindWindowByIndex
,
2397 TravelLogClient_GetWindowData
,
2398 TravelLogClient_LoadHistoryPosition
2401 static inline HTMLWindow
*impl_from_IObjectIdentity(IObjectIdentity
*iface
)
2403 return CONTAINING_RECORD(iface
, HTMLWindow
, IObjectIdentity_iface
);
2406 static HRESULT WINAPI
ObjectIdentity_QueryInterface(IObjectIdentity
*iface
, REFIID riid
, void **ppv
)
2408 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2410 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2413 static ULONG WINAPI
ObjectIdentity_AddRef(IObjectIdentity
*iface
)
2415 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2417 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2420 static ULONG WINAPI
ObjectIdentity_Release(IObjectIdentity
*iface
)
2422 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2424 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2427 static HRESULT WINAPI
ObjectIdentity_IsEqualObject(IObjectIdentity
*iface
, IUnknown
*unk
)
2429 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2430 IServiceProvider
*sp
;
2433 TRACE("(%p)->(%p)\n", This
, unk
);
2435 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&sp
);
2439 hres
= &This
->inner_window
->base
.IServiceProvider_iface
==sp
||
2440 &This
->outer_window
->base
.IServiceProvider_iface
==sp
? S_OK
: S_FALSE
;
2441 IServiceProvider_Release(sp
);
2445 static const IObjectIdentityVtbl ObjectIdentityVtbl
= {
2446 ObjectIdentity_QueryInterface
,
2447 ObjectIdentity_AddRef
,
2448 ObjectIdentity_Release
,
2449 ObjectIdentity_IsEqualObject
2452 static inline HTMLWindow
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
2454 return CONTAINING_RECORD(iface
, HTMLWindow
, IProvideMultipleClassInfo_iface
);
2457 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
2458 REFIID riid
, void **ppv
)
2460 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2461 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2464 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
2466 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2467 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2470 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
2472 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2473 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2476 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
2478 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2479 TRACE("(%p)->(%p)\n", This
, ppTI
);
2480 return get_class_typeinfo(&CLSID_HTMLWindow2
, ppTI
);
2483 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
2485 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2486 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
2490 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
2492 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2493 FIXME("(%p)->(%p)\n", This
, pcti
);
2498 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
2499 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
2501 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2502 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
2506 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
2507 ProvideClassInfo_QueryInterface
,
2508 ProvideClassInfo_AddRef
,
2509 ProvideClassInfo_Release
,
2510 ProvideClassInfo_GetClassInfo
,
2511 ProvideClassInfo2_GetGUID
,
2512 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
2513 ProvideMultipleClassInfo_GetInfoOfIndex
2516 static inline HTMLWindow
*impl_from_IDispatchEx(IDispatchEx
*iface
)
2518 return CONTAINING_RECORD(iface
, HTMLWindow
, IDispatchEx_iface
);
2521 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
2523 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2525 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2528 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
2530 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2532 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2535 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
2537 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2539 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2542 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
2544 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2546 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2548 return IDispatchEx_GetTypeInfoCount(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
2551 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
2552 LCID lcid
, ITypeInfo
**ppTInfo
)
2554 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2556 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2558 return IDispatchEx_GetTypeInfo(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2561 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
2562 LPOLESTR
*rgszNames
, UINT cNames
,
2563 LCID lcid
, DISPID
*rgDispId
)
2565 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2569 WARN("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
2571 for(i
=0; i
< cNames
; i
++) {
2572 /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
2573 hres
= IDispatchEx_GetDispID(&This
->IDispatchEx_iface
, rgszNames
[i
], 0, rgDispId
+i
);
2581 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
2582 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2583 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2585 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2587 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2588 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2590 /* FIXME: Use script dispatch */
2592 return IDispatchEx_Invoke(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2593 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2596 static global_prop_t
*alloc_global_prop(HTMLInnerWindow
*This
, global_prop_type_t type
, BSTR name
)
2598 if(This
->global_prop_cnt
== This
->global_prop_size
) {
2599 global_prop_t
*new_props
;
2602 if(This
->global_props
) {
2603 new_size
= This
->global_prop_size
*2;
2604 new_props
= heap_realloc(This
->global_props
, new_size
*sizeof(global_prop_t
));
2607 new_props
= heap_alloc(new_size
*sizeof(global_prop_t
));
2611 This
->global_props
= new_props
;
2612 This
->global_prop_size
= new_size
;
2615 This
->global_props
[This
->global_prop_cnt
].name
= heap_strdupW(name
);
2616 if(!This
->global_props
[This
->global_prop_cnt
].name
)
2619 This
->global_props
[This
->global_prop_cnt
].type
= type
;
2620 return This
->global_props
+ This
->global_prop_cnt
++;
2623 static inline DWORD
prop_to_dispid(HTMLInnerWindow
*This
, global_prop_t
*prop
)
2625 return MSHTML_DISPID_CUSTOM_MIN
+ (prop
-This
->global_props
);
2628 HRESULT
search_window_props(HTMLInnerWindow
*This
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2631 ScriptHost
*script_host
;
2634 for(i
=0; i
< This
->global_prop_cnt
; i
++) {
2635 /* FIXME: case sensitivity */
2636 if(!strcmpW(This
->global_props
[i
].name
, bstrName
)) {
2637 *pid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
2642 if(find_global_prop(This
->base
.inner_window
, bstrName
, grfdex
, &script_host
, &id
)) {
2643 global_prop_t
*prop
;
2645 prop
= alloc_global_prop(This
, GLOBAL_SCRIPTVAR
, bstrName
);
2647 return E_OUTOFMEMORY
;
2649 prop
->script_host
= script_host
;
2652 *pid
= prop_to_dispid(This
, prop
);
2656 return DISP_E_UNKNOWNNAME
;
2659 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2661 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2662 HTMLInnerWindow
*window
= This
->inner_window
;
2665 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
2667 hres
= search_window_props(window
, bstrName
, grfdex
, pid
);
2668 if(hres
!= DISP_E_UNKNOWNNAME
)
2671 hres
= IDispatchEx_GetDispID(&window
->base
.inner_window
->event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
, pid
);
2672 if(hres
!= DISP_E_UNKNOWNNAME
)
2675 if(This
->outer_window
) {
2676 HTMLOuterWindow
*frame
;
2678 hres
= get_frame_by_name(This
->outer_window
, bstrName
, FALSE
, &frame
);
2679 if(SUCCEEDED(hres
) && frame
) {
2680 global_prop_t
*prop
;
2682 IHTMLWindow2_Release(&frame
->base
.IHTMLWindow2_iface
);
2684 prop
= alloc_global_prop(window
, GLOBAL_FRAMEVAR
, bstrName
);
2686 return E_OUTOFMEMORY
;
2688 *pid
= prop_to_dispid(window
, prop
);
2694 global_prop_t
*prop
;
2697 hres
= IHTMLDocument3_getElementById(&window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2699 if(SUCCEEDED(hres
) && elem
) {
2700 IHTMLElement_Release(elem
);
2702 prop
= alloc_global_prop(window
, GLOBAL_ELEMENTVAR
, bstrName
);
2704 return E_OUTOFMEMORY
;
2706 *pid
= prop_to_dispid(window
, prop
);
2711 return DISP_E_UNKNOWNNAME
;
2714 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
2715 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
2717 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2718 HTMLInnerWindow
*window
= This
->inner_window
;
2720 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2723 case DISPID_IHTMLWINDOW2_LOCATION
: {
2724 HTMLLocation
*location
;
2727 if(!(wFlags
& DISPATCH_PROPERTYPUT
))
2730 TRACE("forwarding to location.href\n");
2732 hres
= get_location(window
, &location
);
2736 hres
= IDispatchEx_InvokeEx(&location
->dispex
.IDispatchEx_iface
, DISPID_VALUE
, lcid
,
2737 wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2738 IHTMLLocation_Release(&location
->IHTMLLocation_iface
);
2741 case DISPID_IHTMLWINDOW2_SETTIMEOUT
:
2742 case DISPID_IHTMLWINDOW3_SETTIMEOUT
: {
2744 DISPPARAMS dp
= {args
, NULL
, 2, 0};
2747 * setTimeout calls should use default value 0 for the second argument if only one is provided,
2748 * but IDL file does not reflect that. We fixup arguments here instead.
2750 if(!(wFlags
& DISPATCH_METHOD
) || pdp
->cArgs
!= 1 || pdp
->cNamedArgs
)
2753 TRACE("Fixing args\n");
2757 args
[1] = *pdp
->rgvarg
;
2758 return IDispatchEx_InvokeEx(&window
->event_target
.dispex
.IDispatchEx_iface
, id
, lcid
,
2759 wFlags
, &dp
, pvarRes
, pei
, pspCaller
);
2763 return IDispatchEx_InvokeEx(&window
->event_target
.dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2766 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
2768 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2770 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
2772 return IDispatchEx_DeleteMemberByName(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
2775 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
2777 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2779 TRACE("(%p)->(%x)\n", This
, id
);
2781 return IDispatchEx_DeleteMemberByDispID(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
);
2784 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
2786 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2788 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
2790 return IDispatchEx_GetMemberProperties(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
, grfdexFetch
,
2794 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
2796 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2798 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
2800 return IDispatchEx_GetMemberName(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
, pbstrName
);
2803 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
2805 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2807 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
2809 return IDispatchEx_GetNextDispID(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
2812 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
2814 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2816 TRACE("(%p)->(%p)\n", This
, ppunk
);
2822 static const IDispatchExVtbl WindowDispExVtbl
= {
2823 WindowDispEx_QueryInterface
,
2824 WindowDispEx_AddRef
,
2825 WindowDispEx_Release
,
2826 WindowDispEx_GetTypeInfoCount
,
2827 WindowDispEx_GetTypeInfo
,
2828 WindowDispEx_GetIDsOfNames
,
2829 WindowDispEx_Invoke
,
2830 WindowDispEx_GetDispID
,
2831 WindowDispEx_InvokeEx
,
2832 WindowDispEx_DeleteMemberByName
,
2833 WindowDispEx_DeleteMemberByDispID
,
2834 WindowDispEx_GetMemberProperties
,
2835 WindowDispEx_GetMemberName
,
2836 WindowDispEx_GetNextDispID
,
2837 WindowDispEx_GetNameSpaceParent
2840 static inline HTMLWindow
*impl_from_IServiceProvider(IServiceProvider
*iface
)
2842 return CONTAINING_RECORD(iface
, HTMLWindow
, IServiceProvider_iface
);
2845 static HRESULT WINAPI
HTMLWindowSP_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
2847 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2848 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2851 static ULONG WINAPI
HTMLWindowSP_AddRef(IServiceProvider
*iface
)
2853 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2854 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2857 static ULONG WINAPI
HTMLWindowSP_Release(IServiceProvider
*iface
)
2859 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2860 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2863 static HRESULT WINAPI
HTMLWindowSP_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
2865 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2867 if(IsEqualGUID(guidService
, &IID_IHTMLWindow2
)) {
2868 TRACE("IID_IHTMLWindow2\n");
2869 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2872 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_mshtml_guid(guidService
), debugstr_mshtml_guid(riid
), ppv
);
2874 if(!This
->outer_window
->doc_obj
)
2875 return E_NOINTERFACE
;
2877 return IServiceProvider_QueryService(&This
->outer_window
->doc_obj
->basedoc
.IServiceProvider_iface
,
2878 guidService
, riid
, ppv
);
2881 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2882 HTMLWindowSP_QueryInterface
,
2883 HTMLWindowSP_AddRef
,
2884 HTMLWindowSP_Release
,
2885 HTMLWindowSP_QueryService
2888 static inline HTMLInnerWindow
*impl_from_DispatchEx(DispatchEx
*iface
)
2890 return CONTAINING_RECORD(iface
, HTMLInnerWindow
, event_target
.dispex
);
2893 static HRESULT
HTMLWindow_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2894 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2896 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
2897 global_prop_t
*prop
;
2901 idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
2902 if(idx
>= This
->global_prop_cnt
)
2903 return DISP_E_MEMBERNOTFOUND
;
2905 prop
= This
->global_props
+idx
;
2907 switch(prop
->type
) {
2908 case GLOBAL_SCRIPTVAR
: {
2912 disp
= get_script_disp(prop
->script_host
);
2914 return E_UNEXPECTED
;
2916 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&iface
);
2917 if(SUCCEEDED(hres
)) {
2918 TRACE("%s >>>\n", debugstr_w(prop
->name
));
2919 hres
= IDispatchEx_InvokeEx(iface
, prop
->id
, lcid
, flags
, params
, res
, ei
, caller
);
2921 TRACE("%s <<<\n", debugstr_w(prop
->name
));
2923 WARN("%s <<< %08x\n", debugstr_w(prop
->name
), hres
);
2924 IDispatchEx_Release(iface
);
2926 FIXME("No IDispatchEx\n");
2928 IDispatch_Release(disp
);
2931 case GLOBAL_ELEMENTVAR
:
2933 case DISPATCH_PROPERTYGET
|DISPATCH_METHOD
:
2934 case DISPATCH_PROPERTYGET
: {
2937 hres
= IHTMLDocument3_getElementById(&This
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2943 return DISP_E_MEMBERNOTFOUND
;
2945 V_VT(res
) = VT_DISPATCH
;
2946 V_DISPATCH(res
) = (IDispatch
*)elem
;
2949 case DISPATCH_PROPERTYPUT
: {
2952 hres
= dispex_get_dynid(&This
->event_target
.dispex
, prop
->name
, &dispex_id
);
2956 prop
->type
= GLOBAL_DISPEXVAR
;
2957 prop
->id
= dispex_id
;
2958 return IDispatchEx_InvokeEx(&This
->event_target
.dispex
.IDispatchEx_iface
, dispex_id
, 0, flags
, params
, res
, ei
, caller
);
2961 FIXME("Not supported flags: %x\n", flags
);
2964 case GLOBAL_FRAMEVAR
:
2965 if(!This
->base
.outer_window
)
2966 return E_UNEXPECTED
;
2969 case DISPATCH_PROPERTYGET
: {
2970 HTMLOuterWindow
*frame
;
2972 hres
= get_frame_by_name(This
->base
.outer_window
, prop
->name
, FALSE
, &frame
);
2977 return DISP_E_MEMBERNOTFOUND
;
2979 V_VT(res
) = VT_DISPATCH
;
2980 V_DISPATCH(res
) = (IDispatch
*)&frame
->base
.inner_window
->base
.IHTMLWindow2_iface
;
2981 IDispatch_AddRef(V_DISPATCH(res
));
2985 FIXME("Not supported flags: %x\n", flags
);
2988 case GLOBAL_DISPEXVAR
:
2989 return IDispatchEx_InvokeEx(&This
->event_target
.dispex
.IDispatchEx_iface
, prop
->id
, 0, flags
, params
, res
, ei
, caller
);
2991 ERR("invalid type %d\n", prop
->type
);
2992 hres
= DISP_E_MEMBERNOTFOUND
;
2998 static EventTarget
*HTMLWindow_get_event_target(DispatchEx
*dispex
)
3000 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
3001 return &This
->event_target
;
3004 static void HTMLWindow_bind_event(DispatchEx
*dispex
, int eid
)
3006 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
3007 dispex_get_vtbl(&This
->doc
->node
.event_target
.dispex
)->bind_event(&This
->doc
->node
.event_target
.dispex
, eid
);
3010 static void HTMLWindow_init_dispex_info(dispex_data_t
*info
, compat_mode_t compat_mode
)
3012 dispex_info_add_interface(info
, IHTMLWindow5_tid
, NULL
);
3015 static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl
= {
3021 HTMLWindow_get_event_target
,
3022 HTMLWindow_bind_event
3025 static const tid_t HTMLWindow_iface_tids
[] = {
3033 static dispex_static_data_t HTMLWindow_dispex
= {
3034 &HTMLWindow_dispex_vtbl
,
3035 DispHTMLWindow2_tid
,
3036 HTMLWindow_iface_tids
,
3037 HTMLWindow_init_dispex_info
3040 static void *alloc_window(size_t size
)
3044 window
= heap_alloc_zero(size
);
3048 window
->IHTMLWindow2_iface
.lpVtbl
= &HTMLWindow2Vtbl
;
3049 window
->IHTMLWindow3_iface
.lpVtbl
= &HTMLWindow3Vtbl
;
3050 window
->IHTMLWindow4_iface
.lpVtbl
= &HTMLWindow4Vtbl
;
3051 window
->IHTMLWindow5_iface
.lpVtbl
= &HTMLWindow5Vtbl
;
3052 window
->IHTMLWindow6_iface
.lpVtbl
= &HTMLWindow6Vtbl
;
3053 window
->IHTMLPrivateWindow_iface
.lpVtbl
= &HTMLPrivateWindowVtbl
;
3054 window
->IDispatchEx_iface
.lpVtbl
= &WindowDispExVtbl
;
3055 window
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
3056 window
->ITravelLogClient_iface
.lpVtbl
= &TravelLogClientVtbl
;
3057 window
->IObjectIdentity_iface
.lpVtbl
= &ObjectIdentityVtbl
;
3058 window
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
3064 static HRESULT
create_inner_window(HTMLOuterWindow
*outer_window
, IMoniker
*mon
, HTMLInnerWindow
**ret
)
3066 HTMLInnerWindow
*window
;
3068 window
= alloc_window(sizeof(HTMLInnerWindow
));
3070 return E_OUTOFMEMORY
;
3072 list_init(&window
->script_hosts
);
3073 list_init(&window
->bindings
);
3074 list_init(&window
->script_queue
);
3076 window
->base
.outer_window
= outer_window
;
3077 window
->base
.inner_window
= window
;
3079 EventTarget_Init(&window
->event_target
, (IUnknown
*)&window
->base
.IHTMLWindow2_iface
,
3080 &HTMLWindow_dispex
, COMPAT_MODE_NONE
);
3082 window
->task_magic
= get_task_target_magic();
3085 IMoniker_AddRef(mon
);
3093 HRESULT
HTMLOuterWindow_Create(HTMLDocumentObj
*doc_obj
, nsIDOMWindow
*nswindow
,
3094 HTMLOuterWindow
*parent
, HTMLOuterWindow
**ret
)
3096 HTMLOuterWindow
*window
;
3099 window
= alloc_window(sizeof(HTMLOuterWindow
));
3101 return E_OUTOFMEMORY
;
3103 window
->base
.outer_window
= window
;
3104 window
->base
.inner_window
= NULL
;
3106 window
->window_ref
= heap_alloc(sizeof(windowref_t
));
3107 if(!window
->window_ref
) {
3109 return E_OUTOFMEMORY
;
3112 window
->doc_obj
= doc_obj
;
3114 window
->window_ref
->window
= window
;
3115 window
->window_ref
->ref
= 1;
3120 nsIDOMWindow_AddRef(nswindow
);
3121 window
->nswindow
= nswindow
;
3123 nsres
= nsIDOMWindow_QueryInterface(nswindow
, &IID_mozIDOMWindowProxy
, (void**)&window
->window_proxy
);
3124 assert(nsres
== NS_OK
);
3127 window
->scriptmode
= parent
? parent
->scriptmode
: SCRIPTMODE_GECKO
;
3128 window
->readystate
= READYSTATE_UNINITIALIZED
;
3129 window
->task_magic
= get_task_target_magic();
3131 list_init(&window
->children
);
3132 wine_rb_put(&window_map
, window
->window_proxy
, &window
->entry
);
3134 hres
= create_pending_window(window
, NULL
);
3136 hres
= update_window_doc(window
->pending_window
);
3138 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
3142 hres
= CoInternetCreateSecurityManager(NULL
, &window
->secmgr
, 0);
3144 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
3149 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
3151 window
->parent
= parent
;
3152 list_add_tail(&parent
->children
, &window
->sibling_entry
);
3155 TRACE("%p inner_window %p\n", window
, window
->base
.inner_window
);
3161 HRESULT
create_pending_window(HTMLOuterWindow
*outer_window
, nsChannelBSC
*channelbsc
)
3163 HTMLInnerWindow
*pending_window
;
3166 hres
= create_inner_window(outer_window
, outer_window
->mon
/* FIXME */, &pending_window
);
3171 IBindStatusCallback_AddRef(&channelbsc
->bsc
.IBindStatusCallback_iface
);
3172 pending_window
->bscallback
= channelbsc
;
3175 if(outer_window
->pending_window
) {
3176 abort_window_bindings(outer_window
->pending_window
);
3177 outer_window
->pending_window
->base
.outer_window
= NULL
;
3178 IHTMLWindow2_Release(&outer_window
->pending_window
->base
.IHTMLWindow2_iface
);
3181 outer_window
->pending_window
= pending_window
;
3185 HRESULT
update_window_doc(HTMLInnerWindow
*window
)
3187 HTMLOuterWindow
*outer_window
= window
->base
.outer_window
;
3188 nsIDOMHTMLDocument
*nshtmldoc
;
3189 nsIDOMDocument
*nsdoc
;
3193 assert(!window
->doc
);
3196 ERR("NULL outer window\n");
3197 return E_UNEXPECTED
;
3200 nsres
= nsIDOMWindow_GetDocument(outer_window
->nswindow
, &nsdoc
);
3201 if(NS_FAILED(nsres
) || !nsdoc
) {
3202 ERR("GetDocument failed: %08x\n", nsres
);
3206 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
3207 nsIDOMDocument_Release(nsdoc
);
3208 if(NS_FAILED(nsres
)) {
3209 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
3213 hres
= create_doc_from_nsdoc(nshtmldoc
, outer_window
->doc_obj
, window
, &window
->doc
);
3214 nsIDOMHTMLDocument_Release(nshtmldoc
);
3218 if(outer_window
->doc_obj
->usermode
== EDITMODE
) {
3222 static const PRUnichar onW
[] = {'o','n',0};
3224 nsAString_InitDepend(&mode_str
, onW
);
3225 nsres
= nsIDOMHTMLDocument_SetDesignMode(window
->doc
->nsdoc
, &mode_str
);
3226 nsAString_Finish(&mode_str
);
3227 if(NS_FAILED(nsres
))
3228 ERR("SetDesignMode failed: %08x\n", nsres
);
3231 if(window
!= outer_window
->pending_window
) {
3232 ERR("not current pending window\n");
3236 if(outer_window
->base
.inner_window
)
3237 detach_inner_window(outer_window
->base
.inner_window
);
3238 outer_window
->base
.inner_window
= window
;
3239 outer_window
->pending_window
= NULL
;
3241 if(outer_window
->doc_obj
->basedoc
.window
== outer_window
|| !outer_window
->doc_obj
->basedoc
.window
) {
3242 if(outer_window
->doc_obj
->basedoc
.doc_node
)
3243 htmldoc_release(&outer_window
->doc_obj
->basedoc
.doc_node
->basedoc
);
3244 outer_window
->doc_obj
->basedoc
.doc_node
= window
->doc
;
3245 htmldoc_addref(&window
->doc
->basedoc
);