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
;
202 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
203 return E_NOINTERFACE
;
206 IUnknown_AddRef((IUnknown
*)*ppv
);
210 static ULONG WINAPI
HTMLWindow2_AddRef(IHTMLWindow2
*iface
)
212 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
213 LONG ref
= InterlockedIncrement(&This
->ref
);
215 TRACE("(%p) ref=%d\n", This
, ref
);
220 static void release_outer_window(HTMLOuterWindow
*This
)
222 if(This
->pending_window
) {
223 abort_window_bindings(This
->pending_window
);
224 This
->pending_window
->base
.outer_window
= NULL
;
225 IHTMLWindow2_Release(&This
->pending_window
->base
.IHTMLWindow2_iface
);
228 remove_target_tasks(This
->task_magic
);
229 set_current_mon(This
, NULL
, 0);
230 set_current_uri(This
, NULL
);
231 if(This
->base
.inner_window
)
232 detach_inner_window(This
->base
.inner_window
);
233 release_children(This
);
236 IInternetSecurityManager_Release(This
->secmgr
);
238 if(This
->frame_element
)
239 This
->frame_element
->content_window
= NULL
;
241 This
->window_ref
->window
= NULL
;
242 windowref_release(This
->window_ref
);
245 nsIDOMWindow_Release(This
->nswindow
);
246 if(This
->window_proxy
)
247 mozIDOMWindowProxy_Release(This
->window_proxy
);
249 wine_rb_remove(&window_map
, &This
->entry
);
253 static void release_inner_window(HTMLInnerWindow
*This
)
259 detach_inner_window(This
);
262 This
->doc
->window
= NULL
;
263 htmldoc_release(&This
->doc
->basedoc
);
266 release_event_target(&This
->event_target
);
267 release_dispex(&This
->event_target
.dispex
);
269 for(i
=0; i
< This
->global_prop_cnt
; i
++)
270 heap_free(This
->global_props
[i
].name
);
271 heap_free(This
->global_props
);
274 This
->location
->window
= NULL
;
275 IHTMLLocation_Release(&This
->location
->IHTMLLocation_iface
);
278 if(This
->image_factory
) {
279 This
->image_factory
->window
= NULL
;
280 IHTMLImageElementFactory_Release(&This
->image_factory
->IHTMLImageElementFactory_iface
);
283 if(This
->option_factory
) {
284 This
->option_factory
->window
= NULL
;
285 IHTMLOptionElementFactory_Release(&This
->option_factory
->IHTMLOptionElementFactory_iface
);
288 if(This
->xhr_factory
) {
289 This
->xhr_factory
->window
= NULL
;
290 IHTMLXMLHttpRequestFactory_Release(&This
->xhr_factory
->IHTMLXMLHttpRequestFactory_iface
);
294 IHTMLScreen_Release(This
->screen
);
297 This
->history
->window
= NULL
;
298 IOmHistory_Release(&This
->history
->IOmHistory_iface
);
301 if(This
->session_storage
)
302 IHTMLStorage_Release(This
->session_storage
);
305 IMoniker_Release(This
->mon
);
310 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
312 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
313 LONG ref
= InterlockedDecrement(&This
->ref
);
315 TRACE("(%p) ref=%d\n", This
, ref
);
318 if(is_outer_window(This
))
319 release_outer_window(This
->outer_window
);
321 release_inner_window(This
->inner_window
);
327 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
329 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
331 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
334 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
335 LCID lcid
, ITypeInfo
**ppTInfo
)
337 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
339 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
342 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
343 LPOLESTR
*rgszNames
, UINT cNames
,
344 LCID lcid
, DISPID
*rgDispId
)
346 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
348 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
352 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
353 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
354 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
356 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
358 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
359 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
362 static HRESULT
get_frame_by_index(HTMLOuterWindow
*This
, UINT32 index
, HTMLOuterWindow
**ret
)
364 nsIDOMWindowCollection
*nsframes
;
365 mozIDOMWindowProxy
*mozwindow
;
369 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nsframes
);
370 if(NS_FAILED(nsres
)) {
371 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
375 nsres
= nsIDOMWindowCollection_GetLength(nsframes
, &length
);
376 assert(nsres
== NS_OK
);
378 if(index
>= length
) {
379 nsIDOMWindowCollection_Release(nsframes
);
380 return DISP_E_MEMBERNOTFOUND
;
383 nsres
= nsIDOMWindowCollection_Item(nsframes
, index
, &mozwindow
);
384 nsIDOMWindowCollection_Release(nsframes
);
385 if(NS_FAILED(nsres
)) {
386 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
390 *ret
= mozwindow_to_window(mozwindow
);
392 mozIDOMWindowProxy_Release(mozwindow
);
396 HRESULT
get_frame_by_name(HTMLOuterWindow
*This
, const WCHAR
*name
, BOOL deep
, HTMLOuterWindow
**ret
)
398 nsIDOMWindowCollection
*nsframes
;
399 HTMLOuterWindow
*window
= NULL
;
400 mozIDOMWindowProxy
*mozwindow
;
406 nsres
= nsIDOMWindow_GetFrames(This
->nswindow
, &nsframes
);
407 if(NS_FAILED(nsres
)) {
408 FIXME("nsIDOMWindow_GetFrames failed: 0x%08x\n", nsres
);
413 WARN("nsIDOMWindow_GetFrames returned NULL nsframes: %p\n", This
->nswindow
);
414 return DISP_E_MEMBERNOTFOUND
;
417 nsAString_InitDepend(&name_str
, name
);
418 nsres
= nsIDOMWindowCollection_NamedItem(nsframes
, &name_str
, &mozwindow
);
419 nsAString_Finish(&name_str
);
420 if(NS_FAILED(nsres
)) {
421 nsIDOMWindowCollection_Release(nsframes
);
426 *ret
= mozwindow_to_window(mozwindow
);
430 nsres
= nsIDOMWindowCollection_GetLength(nsframes
, &length
);
431 assert(nsres
== NS_OK
);
433 for(i
= 0; i
< length
&& !window
; ++i
) {
434 HTMLOuterWindow
*window_iter
;
437 nsres
= nsIDOMWindowCollection_Item(nsframes
, i
, &mozwindow
);
438 if(NS_FAILED(nsres
)) {
439 FIXME("nsIDOMWindowCollection_Item failed: 0x%08x\n", nsres
);
444 window_iter
= mozwindow_to_window(mozwindow
);
446 mozIDOMWindowProxy_Release(mozwindow
);
449 WARN("nsIDOMWindow without HTMLOuterWindow: %p\n", mozwindow
);
453 hres
= IHTMLElement_get_id(&window_iter
->frame_element
->element
.IHTMLElement_iface
, &id
);
455 FIXME("IHTMLElement_get_id failed: 0x%08x\n", hres
);
459 if(id
&& !strcmpiW(id
, name
))
460 window
= window_iter
;
465 get_frame_by_name(window_iter
, name
, TRUE
, &window
);
468 nsIDOMWindowCollection_Release(nsframes
);
476 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
478 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
479 HTMLOuterWindow
*window
= NULL
;
482 TRACE("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
484 switch(V_VT(pvarIndex
)) {
486 int index
= V_I4(pvarIndex
);
487 TRACE("Getting index %d\n", index
);
489 return DISP_E_MEMBERNOTFOUND
;
490 hres
= get_frame_by_index(This
->outer_window
, index
, &window
);
494 unsigned int index
= V_UINT(pvarIndex
);
495 TRACE("Getting index %u\n", index
);
496 hres
= get_frame_by_index(This
->outer_window
, index
, &window
);
500 BSTR str
= V_BSTR(pvarIndex
);
501 TRACE("Getting name %s\n", wine_dbgstr_w(str
));
502 hres
= get_frame_by_name(This
->outer_window
, str
, FALSE
, &window
);
506 WARN("Invalid index %s\n", debugstr_variant(pvarIndex
));
513 return DISP_E_MEMBERNOTFOUND
;
515 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
516 V_VT(pvarResult
) = VT_DISPATCH
;
517 V_DISPATCH(pvarResult
) = (IDispatch
*)window
;
521 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, LONG
*p
)
523 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
524 nsIDOMWindowCollection
*nscollection
;
528 TRACE("(%p)->(%p)\n", This
, p
);
530 nsres
= nsIDOMWindow_GetFrames(This
->outer_window
->nswindow
, &nscollection
);
531 if(NS_FAILED(nsres
)) {
532 ERR("GetFrames failed: %08x\n", nsres
);
536 nsres
= nsIDOMWindowCollection_GetLength(nscollection
, &length
);
537 nsIDOMWindowCollection_Release(nscollection
);
538 if(NS_FAILED(nsres
)) {
539 ERR("GetLength failed: %08x\n", nsres
);
547 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
549 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
550 FIXME("(%p)->(%p): semi-stub\n", This
, p
);
552 /* FIXME: Should return a separate Window object */
553 *p
= (IHTMLFramesCollection2
*)&This
->IHTMLWindow2_iface
;
554 IHTMLWindow2_AddRef(iface
);
558 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
560 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
561 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
565 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
567 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
568 FIXME("(%p)->(%p)\n", This
, p
);
572 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
574 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
576 WARN("(%p)->(%s)\n", This
, debugstr_w(v
));
579 * FIXME: Since IE7, setting status is blocked, but still possible in certain circumstances.
580 * Ignoring the call should be enough for us.
585 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
587 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
589 TRACE("(%p)->(%p)\n", This
, p
);
596 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
597 LONG msec
, VARIANT
*language
, LONG
*timerID
)
599 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
602 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
604 V_VT(&expr_var
) = VT_BSTR
;
605 V_BSTR(&expr_var
) = expression
;
607 return IHTMLWindow3_setTimeout(&This
->IHTMLWindow3_iface
, &expr_var
, msec
, language
, timerID
);
610 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, LONG timerID
)
612 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
614 TRACE("(%p)->(%d)\n", This
, timerID
);
616 return clear_task_timer(This
->inner_window
, timerID
);
619 #define MAX_MESSAGE_LEN 2000
621 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
623 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
624 WCHAR title
[100], *msg
= message
;
627 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
629 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, title
,
630 sizeof(title
)/sizeof(WCHAR
))) {
631 WARN("Could not load message box title: %d\n", GetLastError());
635 len
= SysStringLen(message
);
636 if(len
> MAX_MESSAGE_LEN
) {
637 msg
= heap_alloc((MAX_MESSAGE_LEN
+1)*sizeof(WCHAR
));
639 return E_OUTOFMEMORY
;
640 memcpy(msg
, message
, MAX_MESSAGE_LEN
*sizeof(WCHAR
));
641 msg
[MAX_MESSAGE_LEN
] = 0;
644 MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, msg
, title
, MB_ICONWARNING
);
650 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
651 VARIANT_BOOL
*confirmed
)
653 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
656 TRACE("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
658 if(!confirmed
) return E_INVALIDARG
;
660 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
661 sizeof(wszTitle
)/sizeof(WCHAR
))) {
662 WARN("Could not load message box title: %d\n", GetLastError());
663 *confirmed
= VARIANT_TRUE
;
667 if(MessageBoxW(This
->outer_window
->doc_obj
->hwnd
, message
, wszTitle
,
668 MB_OKCANCEL
|MB_ICONQUESTION
)==IDOK
)
669 *confirmed
= VARIANT_TRUE
;
670 else *confirmed
= VARIANT_FALSE
;
682 static INT_PTR CALLBACK
prompt_dlgproc(HWND hwnd
, UINT msg
,
683 WPARAM wparam
, LPARAM lparam
)
689 prompt_arg
*arg
= (prompt_arg
*)lparam
;
692 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
693 sizeof(wszTitle
)/sizeof(WCHAR
))) {
694 WARN("Could not load message box title: %d\n", GetLastError());
695 EndDialog(hwnd
, wparam
);
699 SetWindowLongPtrW(hwnd
, DWLP_USER
, lparam
);
700 SetWindowTextW(hwnd
, wszTitle
);
701 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_PROMPT
), arg
->message
);
702 SetWindowTextW(GetDlgItem(hwnd
, ID_PROMPT_EDIT
), arg
->dststr
);
708 case MAKEWPARAM(IDCANCEL
, BN_CLICKED
):
709 EndDialog(hwnd
, wparam
);
711 case MAKEWPARAM(IDOK
, BN_CLICKED
):
714 (prompt_arg
*)GetWindowLongPtrW(hwnd
, DWLP_USER
);
715 HWND hwndPrompt
= GetDlgItem(hwnd
, ID_PROMPT_EDIT
);
716 INT len
= GetWindowTextLengthW(hwndPrompt
);
720 EndDialog(hwnd
, wparam
);
724 V_VT(arg
->textdata
) = VT_BSTR
;
725 if(!len
&& !arg
->dststr
)
726 V_BSTR(arg
->textdata
) = NULL
;
729 V_BSTR(arg
->textdata
) = SysAllocStringLen(NULL
, len
);
730 GetWindowTextW(hwndPrompt
, V_BSTR(arg
->textdata
), len
+1);
732 EndDialog(hwnd
, wparam
);
738 EndDialog(hwnd
, IDCANCEL
);
745 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
746 BSTR dststr
, VARIANT
*textdata
)
748 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
751 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
753 if(textdata
) V_VT(textdata
) = VT_NULL
;
755 arg
.message
= message
;
757 arg
.textdata
= textdata
;
759 DialogBoxParamW(hInst
, MAKEINTRESOURCEW(ID_PROMPT_DIALOG
),
760 This
->outer_window
->doc_obj
->hwnd
, prompt_dlgproc
, (LPARAM
)&arg
);
764 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
766 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
767 HTMLInnerWindow
*window
= This
->inner_window
;
769 TRACE("(%p)->(%p)\n", This
, p
);
771 if(!window
->image_factory
) {
774 hres
= HTMLImageElementFactory_Create(window
, &window
->image_factory
);
779 *p
= &window
->image_factory
->IHTMLImageElementFactory_iface
;
780 IHTMLImageElementFactory_AddRef(*p
);
785 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
787 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
788 HTMLLocation
*location
;
791 TRACE("(%p)->(%p)\n", This
, p
);
793 hres
= get_location(This
->inner_window
, &location
);
797 *p
= &location
->IHTMLLocation_iface
;
801 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
803 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
804 HTMLInnerWindow
*window
= This
->inner_window
;
806 TRACE("(%p)->(%p)\n", This
, p
);
808 if(!window
->history
) {
811 hres
= create_history(window
, &window
->history
);
816 IOmHistory_AddRef(&window
->history
->IOmHistory_iface
);
817 *p
= &window
->history
->IOmHistory_iface
;
821 static BOOL
notify_webbrowser_close(HTMLOuterWindow
*window
, HTMLDocumentObj
*doc
)
823 IConnectionPointContainer
*cp_container
;
824 VARIANT_BOOL cancel
= VARIANT_FALSE
;
825 IEnumConnections
*enum_conn
;
827 DISPPARAMS dp
= {args
, NULL
, 2, 0};
828 CONNECTDATA conn_data
;
829 IConnectionPoint
*cp
;
837 hres
= IUnknown_QueryInterface(doc
->webbrowser
, &IID_IConnectionPointContainer
, (void**)&cp_container
);
841 hres
= IConnectionPointContainer_FindConnectionPoint(cp_container
, &DIID_DWebBrowserEvents2
, &cp
);
842 IConnectionPointContainer_Release(cp_container
);
846 hres
= IConnectionPoint_EnumConnections(cp
, &enum_conn
);
847 IConnectionPoint_Release(cp
);
852 conn_data
.pUnk
= NULL
;
853 conn_data
.dwCookie
= 0;
855 hres
= IEnumConnections_Next(enum_conn
, 1, &conn_data
, &fetched
);
859 hres
= IUnknown_QueryInterface(conn_data
.pUnk
, &IID_IDispatch
, (void**)&disp
);
860 IUnknown_Release(conn_data
.pUnk
);
864 V_VT(args
) = VT_BYREF
|VT_BOOL
;
865 V_BOOLREF(args
) = &cancel
;
866 V_VT(args
+1) = VT_BOOL
;
867 V_BOOL(args
+1) = window
->parent
? VARIANT_TRUE
: VARIANT_FALSE
;
868 hres
= IDispatch_Invoke(disp
, DISPID_WINDOWCLOSING
, &IID_NULL
, 0, DISPATCH_METHOD
, &dp
, NULL
, NULL
, NULL
);
869 IDispatch_Release(disp
);
871 cancel
= VARIANT_FALSE
;
874 IEnumConnections_Release(enum_conn
);
878 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
880 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
881 HTMLOuterWindow
*window
= This
->outer_window
;
883 TRACE("(%p)\n", This
);
885 if(!window
->doc_obj
) {
886 FIXME("No document object\n");
890 if(!notify_webbrowser_close(window
, window
->doc_obj
))
893 FIXME("default action not implemented\n");
897 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
899 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
900 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
904 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
906 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
908 FIXME("(%p)->(%p) returning empty\n", This
, p
);
914 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
916 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
918 TRACE("(%p)->(%p)\n", This
, p
);
920 *p
= OmNavigator_Create();
921 return *p
? S_OK
: E_OUTOFMEMORY
;
924 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
926 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
930 TRACE("(%p)->(%s)\n", This
, debugstr_w(v
));
932 nsAString_InitDepend(&name_str
, v
);
933 nsres
= nsIDOMWindow_SetName(This
->outer_window
->nswindow
, &name_str
);
934 nsAString_Finish(&name_str
);
936 ERR("SetName failed: %08x\n", nsres
);
941 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
943 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
947 TRACE("(%p)->(%p)\n", This
, p
);
949 nsAString_Init(&name_str
, NULL
);
950 nsres
= nsIDOMWindow_GetName(This
->outer_window
->nswindow
, &name_str
);
951 return return_nsstr(nsres
, &name_str
, p
);
954 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
956 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
957 HTMLOuterWindow
*window
= This
->outer_window
;
959 TRACE("(%p)->(%p)\n", This
, p
);
962 return IHTMLWindow2_get_self(&This
->IHTMLWindow2_iface
, p
);
964 *p
= &window
->parent
->base
.IHTMLWindow2_iface
;
965 IHTMLWindow2_AddRef(*p
);
969 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
970 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
972 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
973 HTMLOuterWindow
*window
= This
->outer_window
;
977 static const WCHAR _selfW
[] = {'_','s','e','l','f',0};
979 TRACE("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
980 debugstr_w(features
), replace
, pomWindowResult
);
982 FIXME("unsupported features argument %s\n", debugstr_w(features
));
984 FIXME("unsupported relace argument\n");
986 if(!window
->doc_obj
|| !window
->uri_nofrag
)
989 if(name
&& *name
== '_') {
990 if(!strcmpW(name
, _selfW
)) {
991 if((features
&& *features
) || replace
)
992 FIXME("Unsupported arguments for _self target\n");
994 hres
= IHTMLWindow2_navigate(&This
->IHTMLWindow2_iface
, url
);
998 if(pomWindowResult
) {
999 FIXME("Returning this window for _self target\n");
1000 *pomWindowResult
= &This
->IHTMLWindow2_iface
;
1001 IHTMLWindow2_AddRef(*pomWindowResult
);
1007 FIXME("Unsupported name %s\n", debugstr_w(name
));
1011 hres
= create_relative_uri(window
, url
, &uri
);
1015 hres
= navigate_new_window(window
, uri
, name
, NULL
, pomWindowResult
);
1020 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1022 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1024 TRACE("(%p)->(%p)\n", This
, p
);
1026 /* FIXME: We should return kind of proxy window here. */
1027 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1028 *p
= &This
->IHTMLWindow2_iface
;
1032 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1034 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1035 HTMLOuterWindow
*top
;
1037 TRACE("(%p)->(%p)\n", This
, p
);
1039 get_top_window(This
->outer_window
, &top
);
1040 *p
= &top
->base
.IHTMLWindow2_iface
;
1041 IHTMLWindow2_AddRef(*p
);
1046 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
1048 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1050 TRACE("(%p)->(%p)\n", This
, p
);
1052 /* FIXME: We should return kind of proxy window here. */
1053 IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1054 *p
= &This
->IHTMLWindow2_iface
;
1058 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
1060 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1062 TRACE("(%p)->(%s)\n", This
, debugstr_w(url
));
1064 return navigate_url(This
->outer_window
, url
, This
->outer_window
->uri
, BINDING_NAVIGATED
);
1067 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
1069 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1071 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1073 return set_window_event(This
, EVENTID_FOCUS
, &v
);
1076 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
1078 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1080 TRACE("(%p)->(%p)\n", This
, p
);
1082 return get_window_event(This
, EVENTID_FOCUS
, p
);
1085 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
1087 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1089 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1091 return set_window_event(This
, EVENTID_BLUR
, &v
);
1094 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
1096 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1098 TRACE("(%p)->(%p)\n", This
, p
);
1100 return get_window_event(This
, EVENTID_BLUR
, p
);
1103 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
1105 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1107 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1109 return set_window_event(This
, EVENTID_LOAD
, &v
);
1112 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
1114 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1116 TRACE("(%p)->(%p)\n", This
, p
);
1118 return get_window_event(This
, EVENTID_LOAD
, p
);
1121 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
1123 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1125 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1127 return set_window_event(This
, EVENTID_BEFOREUNLOAD
, &v
);
1130 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
1132 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1134 TRACE("(%p)->(%p)\n", This
, p
);
1136 return get_window_event(This
, EVENTID_BEFOREUNLOAD
, p
);
1139 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
1141 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1143 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1145 return set_window_event(This
, EVENTID_UNLOAD
, &v
);
1148 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
1150 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1152 TRACE("(%p)->(%p)\n", This
, p
);
1154 return get_window_event(This
, EVENTID_UNLOAD
, p
);
1157 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
1159 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1161 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1163 return set_window_event(This
, EVENTID_HELP
, &v
);
1166 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
1168 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1170 TRACE("(%p)->(%p)\n", This
, p
);
1172 return get_window_event(This
, EVENTID_HELP
, p
);
1175 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
1177 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1179 FIXME("(%p)->(%s) semi-stub\n", This
, debugstr_variant(&v
));
1181 return set_window_event(This
, EVENTID_ERROR
, &v
);
1184 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
1186 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1188 TRACE("(%p)->(%p)\n", This
, p
);
1190 return get_window_event(This
, EVENTID_ERROR
, p
);
1193 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
1195 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1197 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1199 return set_window_event(This
, EVENTID_RESIZE
, &v
);
1202 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
1204 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1206 TRACE("(%p)->(%p)\n", This
, p
);
1208 return get_window_event(This
, EVENTID_RESIZE
, p
);
1211 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
1213 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1215 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1217 return set_window_event(This
, EVENTID_SCROLL
, &v
);
1220 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
1222 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1224 TRACE("(%p)->(%p)\n", This
, p
);
1226 return get_window_event(This
, EVENTID_SCROLL
, p
);
1229 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
1231 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1233 TRACE("(%p)->(%p)\n", This
, p
);
1235 if(This
->inner_window
->doc
) {
1236 /* FIXME: We should return a wrapper object here */
1237 *p
= &This
->inner_window
->doc
->basedoc
.IHTMLDocument2_iface
;
1238 IHTMLDocument2_AddRef(*p
);
1246 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
1248 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1249 HTMLInnerWindow
*window
= This
->inner_window
;
1251 TRACE("(%p)->(%p)\n", This
, p
);
1254 IHTMLEventObj_AddRef(window
->event
);
1259 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
1261 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1262 FIXME("(%p)->(%p)\n", This
, p
);
1266 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
1267 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
1269 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1270 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
1274 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
1277 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1278 FIXME("(%p)->(%s %s %s)\n", This
, debugstr_w(helpURL
), debugstr_variant(&helpArg
), debugstr_w(features
));
1282 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
1284 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1285 HTMLInnerWindow
*window
= This
->inner_window
;
1287 TRACE("(%p)->(%p)\n", This
, p
);
1289 if(!window
->screen
) {
1292 hres
= HTMLScreen_Create(&window
->screen
);
1297 *p
= window
->screen
;
1298 IHTMLScreen_AddRef(window
->screen
);
1302 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
1304 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1305 HTMLInnerWindow
*window
= This
->inner_window
;
1307 TRACE("(%p)->(%p)\n", This
, p
);
1309 if(!window
->option_factory
) {
1312 hres
= HTMLOptionElementFactory_Create(window
, &window
->option_factory
);
1317 *p
= &window
->option_factory
->IHTMLOptionElementFactory_iface
;
1318 IHTMLOptionElementFactory_AddRef(*p
);
1323 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
1325 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1327 TRACE("(%p)->()\n", This
);
1329 if(This
->outer_window
->doc_obj
)
1330 SetFocus(This
->outer_window
->doc_obj
->hwnd
);
1334 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
1336 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1337 FIXME("(%p)->(%p)\n", This
, p
);
1341 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
1343 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1344 FIXME("(%p)->()\n", This
);
1348 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1350 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1353 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1355 nsres
= nsIDOMWindow_Scroll(This
->outer_window
->nswindow
, x
, y
);
1356 if(NS_FAILED(nsres
)) {
1357 ERR("ScrollBy failed: %08x\n", nsres
);
1364 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
1366 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1368 TRACE("(%p)->(%p)\n", This
, p
);
1370 return IHTMLWindow2_get_navigator(&This
->IHTMLWindow2_iface
, p
);
1373 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
1374 LONG msec
, VARIANT
*language
, LONG
*timerID
)
1376 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1379 TRACE("(%p)->(%s %d %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
1381 V_VT(&expr
) = VT_BSTR
;
1382 V_BSTR(&expr
) = expression
;
1383 return IHTMLWindow3_setInterval(&This
->IHTMLWindow3_iface
, &expr
, msec
, language
, timerID
);
1386 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, LONG timerID
)
1388 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1390 TRACE("(%p)->(%d)\n", This
, timerID
);
1392 return clear_task_timer(This
->inner_window
, timerID
);
1395 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
1397 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1398 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1402 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
1404 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1405 FIXME("(%p)->(%p)\n", This
, p
);
1409 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
1412 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1414 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
1416 return exec_script(This
->inner_window
, scode
, language
, pvarRet
);
1419 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
1421 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1423 static const WCHAR objectW
[] = {'[','o','b','j','e','c','t',']',0};
1425 TRACE("(%p)->(%p)\n", This
, String
);
1428 return E_INVALIDARG
;
1430 *String
= SysAllocString(objectW
);
1431 return *String
? S_OK
: E_OUTOFMEMORY
;
1434 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1436 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1439 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1441 nsres
= nsIDOMWindow_ScrollBy(This
->outer_window
->nswindow
, x
, y
);
1442 if(NS_FAILED(nsres
))
1443 ERR("ScrollBy failed: %08x\n", nsres
);
1448 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1450 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1453 TRACE("(%p)->(%d %d)\n", This
, x
, y
);
1455 nsres
= nsIDOMWindow_ScrollTo(This
->outer_window
->nswindow
, x
, y
);
1456 if(NS_FAILED(nsres
))
1457 ERR("ScrollTo failed: %08x\n", nsres
);
1462 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1464 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1465 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1469 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1471 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1472 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1476 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1478 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1479 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1483 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, LONG x
, LONG y
)
1485 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1486 FIXME("(%p)->(%d %d)\n", This
, x
, y
);
1490 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
1492 HTMLWindow
*This
= impl_from_IHTMLWindow2(iface
);
1494 TRACE("(%p)->(%p)\n", This
, p
);
1498 if(!This
->outer_window
->doc_obj
->hostui
)
1501 return IDocHostUIHandler_GetExternal(This
->outer_window
->doc_obj
->hostui
, p
);
1504 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
1505 HTMLWindow2_QueryInterface
,
1507 HTMLWindow2_Release
,
1508 HTMLWindow2_GetTypeInfoCount
,
1509 HTMLWindow2_GetTypeInfo
,
1510 HTMLWindow2_GetIDsOfNames
,
1513 HTMLWindow2_get_length
,
1514 HTMLWindow2_get_frames
,
1515 HTMLWindow2_put_defaultStatus
,
1516 HTMLWindow2_get_defaultStatus
,
1517 HTMLWindow2_put_status
,
1518 HTMLWindow2_get_status
,
1519 HTMLWindow2_setTimeout
,
1520 HTMLWindow2_clearTimeout
,
1522 HTMLWindow2_confirm
,
1524 HTMLWindow2_get_Image
,
1525 HTMLWindow2_get_location
,
1526 HTMLWindow2_get_history
,
1528 HTMLWindow2_put_opener
,
1529 HTMLWindow2_get_opener
,
1530 HTMLWindow2_get_navigator
,
1531 HTMLWindow2_put_name
,
1532 HTMLWindow2_get_name
,
1533 HTMLWindow2_get_parent
,
1535 HTMLWindow2_get_self
,
1536 HTMLWindow2_get_top
,
1537 HTMLWindow2_get_window
,
1538 HTMLWindow2_navigate
,
1539 HTMLWindow2_put_onfocus
,
1540 HTMLWindow2_get_onfocus
,
1541 HTMLWindow2_put_onblur
,
1542 HTMLWindow2_get_onblur
,
1543 HTMLWindow2_put_onload
,
1544 HTMLWindow2_get_onload
,
1545 HTMLWindow2_put_onbeforeunload
,
1546 HTMLWindow2_get_onbeforeunload
,
1547 HTMLWindow2_put_onunload
,
1548 HTMLWindow2_get_onunload
,
1549 HTMLWindow2_put_onhelp
,
1550 HTMLWindow2_get_onhelp
,
1551 HTMLWindow2_put_onerror
,
1552 HTMLWindow2_get_onerror
,
1553 HTMLWindow2_put_onresize
,
1554 HTMLWindow2_get_onresize
,
1555 HTMLWindow2_put_onscroll
,
1556 HTMLWindow2_get_onscroll
,
1557 HTMLWindow2_get_document
,
1558 HTMLWindow2_get_event
,
1559 HTMLWindow2_get__newEnum
,
1560 HTMLWindow2_showModalDialog
,
1561 HTMLWindow2_showHelp
,
1562 HTMLWindow2_get_screen
,
1563 HTMLWindow2_get_Option
,
1565 HTMLWindow2_get_closed
,
1568 HTMLWindow2_get_clientInformation
,
1569 HTMLWindow2_setInterval
,
1570 HTMLWindow2_clearInterval
,
1571 HTMLWindow2_put_offscreenBuffering
,
1572 HTMLWindow2_get_offscreenBuffering
,
1573 HTMLWindow2_execScript
,
1574 HTMLWindow2_toString
,
1575 HTMLWindow2_scrollBy
,
1576 HTMLWindow2_scrollTo
,
1579 HTMLWindow2_resizeTo
,
1580 HTMLWindow2_resizeBy
,
1581 HTMLWindow2_get_external
1584 static inline HTMLWindow
*impl_from_IHTMLWindow3(IHTMLWindow3
*iface
)
1586 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow3_iface
);
1589 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
1591 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1593 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1596 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
1598 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1600 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1603 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
1605 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1607 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1610 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
1612 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1614 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1617 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
1618 LCID lcid
, ITypeInfo
**ppTInfo
)
1620 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1622 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1625 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
1626 LPOLESTR
*rgszNames
, UINT cNames
,
1627 LCID lcid
, DISPID
*rgDispId
)
1629 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1631 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1635 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
1636 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1637 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1639 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1641 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1642 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1645 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, LONG
*p
)
1647 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1650 TRACE("(%p)->(%p)\n", This
, p
);
1652 nsres
= nsIDOMWindow_GetScreenX(This
->outer_window
->nswindow
, p
);
1653 if(NS_FAILED(nsres
)) {
1654 ERR("GetScreenX failed: %08x\n", nsres
);
1661 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, LONG
*p
)
1663 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1666 TRACE("(%p)->(%p)\n", This
, p
);
1668 nsres
= nsIDOMWindow_GetScreenY(This
->outer_window
->nswindow
, p
);
1669 if(NS_FAILED(nsres
)) {
1670 ERR("GetScreenY failed: %08x\n", nsres
);
1677 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
1679 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1680 HTMLInnerWindow
*window
= This
->inner_window
;
1682 TRACE("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
1685 FIXME("No document\n");
1689 return attach_event(&window
->event_target
, event
, pDisp
, pfResult
);
1692 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
1694 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1695 HTMLInnerWindow
*window
= This
->inner_window
;
1697 TRACE("(%p)->()\n", This
);
1700 FIXME("No document\n");
1704 return detach_event(&window
->event_target
, event
, pDisp
);
1707 static HRESULT
window_set_timer(HTMLInnerWindow
*This
, VARIANT
*expr
, LONG msec
, VARIANT
*language
,
1708 BOOL interval
, LONG
*timer_id
)
1710 IDispatch
*disp
= NULL
;
1713 switch(V_VT(expr
)) {
1715 disp
= V_DISPATCH(expr
);
1716 IDispatch_AddRef(disp
);
1720 disp
= script_parse_event(This
->base
.inner_window
, V_BSTR(expr
));
1724 FIXME("unimplemented expr %s\n", debugstr_variant(expr
));
1731 hres
= set_task_timer(This
, msec
, interval
, disp
, timer_id
);
1732 IDispatch_Release(disp
);
1737 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1738 VARIANT
*language
, LONG
*timerID
)
1740 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1742 TRACE("(%p)->(%s %d %s %p)\n", This
, debugstr_variant(expression
), msec
, debugstr_variant(language
), timerID
);
1744 return window_set_timer(This
->inner_window
, expression
, msec
, language
, FALSE
, timerID
);
1747 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, LONG msec
,
1748 VARIANT
*language
, LONG
*timerID
)
1750 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1752 TRACE("(%p)->(%p %d %p %p)\n", This
, expression
, msec
, language
, timerID
);
1754 return window_set_timer(This
->inner_window
, expression
, msec
, language
, TRUE
, timerID
);
1757 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
1759 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1760 FIXME("(%p)\n", This
);
1764 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
1766 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1767 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1771 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1773 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1774 FIXME("(%p)->(%p)\n", This
, p
);
1778 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
1780 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1781 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1785 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
1787 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1788 FIXME("(%p)->(%p)\n", This
, p
);
1792 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
1794 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1795 FIXME("(%p)->(%p)\n", This
, p
);
1799 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
1800 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
1802 HTMLWindow
*This
= impl_from_IHTMLWindow3(iface
);
1803 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
1807 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
1808 HTMLWindow3_QueryInterface
,
1810 HTMLWindow3_Release
,
1811 HTMLWindow3_GetTypeInfoCount
,
1812 HTMLWindow3_GetTypeInfo
,
1813 HTMLWindow3_GetIDsOfNames
,
1815 HTMLWindow3_get_screenLeft
,
1816 HTMLWindow3_get_screenTop
,
1817 HTMLWindow3_attachEvent
,
1818 HTMLWindow3_detachEvent
,
1819 HTMLWindow3_setTimeout
,
1820 HTMLWindow3_setInterval
,
1822 HTMLWindow3_put_onbeforeprint
,
1823 HTMLWindow3_get_onbeforeprint
,
1824 HTMLWindow3_put_onafterprint
,
1825 HTMLWindow3_get_onafterprint
,
1826 HTMLWindow3_get_clipboardData
,
1827 HTMLWindow3_showModelessDialog
1830 static inline HTMLWindow
*impl_from_IHTMLWindow4(IHTMLWindow4
*iface
)
1832 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow4_iface
);
1835 static HRESULT WINAPI
HTMLWindow4_QueryInterface(IHTMLWindow4
*iface
, REFIID riid
, void **ppv
)
1837 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1839 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1842 static ULONG WINAPI
HTMLWindow4_AddRef(IHTMLWindow4
*iface
)
1844 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1846 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1849 static ULONG WINAPI
HTMLWindow4_Release(IHTMLWindow4
*iface
)
1851 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1853 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1856 static HRESULT WINAPI
HTMLWindow4_GetTypeInfoCount(IHTMLWindow4
*iface
, UINT
*pctinfo
)
1858 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1860 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1863 static HRESULT WINAPI
HTMLWindow4_GetTypeInfo(IHTMLWindow4
*iface
, UINT iTInfo
,
1864 LCID lcid
, ITypeInfo
**ppTInfo
)
1866 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1868 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1871 static HRESULT WINAPI
HTMLWindow4_GetIDsOfNames(IHTMLWindow4
*iface
, REFIID riid
,
1872 LPOLESTR
*rgszNames
, UINT cNames
,
1873 LCID lcid
, DISPID
*rgDispId
)
1875 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1877 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1881 static HRESULT WINAPI
HTMLWindow4_Invoke(IHTMLWindow4
*iface
, DISPID dispIdMember
,
1882 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1883 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1885 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1887 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1888 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1891 static HRESULT WINAPI
HTMLWindow4_createPopup(IHTMLWindow4
*iface
, VARIANT
*varArgIn
,
1892 IDispatch
**ppPopup
)
1894 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1895 FIXME("(%p)->(%p %p)\n", This
, varArgIn
, ppPopup
);
1899 static HRESULT WINAPI
HTMLWindow4_get_frameElement(IHTMLWindow4
*iface
, IHTMLFrameBase
**p
)
1901 HTMLWindow
*This
= impl_from_IHTMLWindow4(iface
);
1902 TRACE("(%p)->(%p)\n", This
, p
);
1904 if(This
->outer_window
->frame_element
) {
1905 *p
= &This
->outer_window
->frame_element
->IHTMLFrameBase_iface
;
1906 IHTMLFrameBase_AddRef(*p
);
1913 static const IHTMLWindow4Vtbl HTMLWindow4Vtbl
= {
1914 HTMLWindow4_QueryInterface
,
1916 HTMLWindow4_Release
,
1917 HTMLWindow4_GetTypeInfoCount
,
1918 HTMLWindow4_GetTypeInfo
,
1919 HTMLWindow4_GetIDsOfNames
,
1921 HTMLWindow4_createPopup
,
1922 HTMLWindow4_get_frameElement
1925 static inline HTMLWindow
*impl_from_IHTMLWindow5(IHTMLWindow5
*iface
)
1927 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow5_iface
);
1930 static HRESULT WINAPI
HTMLWindow5_QueryInterface(IHTMLWindow5
*iface
, REFIID riid
, void **ppv
)
1932 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1934 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
1937 static ULONG WINAPI
HTMLWindow5_AddRef(IHTMLWindow5
*iface
)
1939 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1941 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
1944 static ULONG WINAPI
HTMLWindow5_Release(IHTMLWindow5
*iface
)
1946 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1948 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
1951 static HRESULT WINAPI
HTMLWindow5_GetTypeInfoCount(IHTMLWindow5
*iface
, UINT
*pctinfo
)
1953 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1955 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
1958 static HRESULT WINAPI
HTMLWindow5_GetTypeInfo(IHTMLWindow5
*iface
, UINT iTInfo
,
1959 LCID lcid
, ITypeInfo
**ppTInfo
)
1961 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1963 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
1966 static HRESULT WINAPI
HTMLWindow5_GetIDsOfNames(IHTMLWindow5
*iface
, REFIID riid
,
1967 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1969 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1971 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
1975 static HRESULT WINAPI
HTMLWindow5_Invoke(IHTMLWindow5
*iface
, DISPID dispIdMember
,
1976 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1977 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1979 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1981 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
1982 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1985 static HRESULT WINAPI
HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT v
)
1987 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1988 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
1992 static HRESULT WINAPI
HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5
*iface
, VARIANT
*p
)
1994 HTMLWindow
*This
= impl_from_IHTMLWindow5(iface
);
1995 HTMLInnerWindow
*window
= This
->inner_window
;
1997 TRACE("(%p)->(%p)\n", This
, p
);
1999 if(!window
->xhr_factory
) {
2002 hres
= HTMLXMLHttpRequestFactory_Create(window
, &window
->xhr_factory
);
2008 V_VT(p
) = VT_DISPATCH
;
2009 V_DISPATCH(p
) = (IDispatch
*)&window
->xhr_factory
->IHTMLXMLHttpRequestFactory_iface
;
2010 IDispatch_AddRef(V_DISPATCH(p
));
2015 static const IHTMLWindow5Vtbl HTMLWindow5Vtbl
= {
2016 HTMLWindow5_QueryInterface
,
2018 HTMLWindow5_Release
,
2019 HTMLWindow5_GetTypeInfoCount
,
2020 HTMLWindow5_GetTypeInfo
,
2021 HTMLWindow5_GetIDsOfNames
,
2023 HTMLWindow5_put_XMLHttpRequest
,
2024 HTMLWindow5_get_XMLHttpRequest
2027 static inline HTMLWindow
*impl_from_IHTMLWindow6(IHTMLWindow6
*iface
)
2029 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLWindow6_iface
);
2032 static HRESULT WINAPI
HTMLWindow6_QueryInterface(IHTMLWindow6
*iface
, REFIID riid
, void **ppv
)
2034 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2036 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2039 static ULONG WINAPI
HTMLWindow6_AddRef(IHTMLWindow6
*iface
)
2041 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2043 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2046 static ULONG WINAPI
HTMLWindow6_Release(IHTMLWindow6
*iface
)
2048 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2050 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2053 static HRESULT WINAPI
HTMLWindow6_GetTypeInfoCount(IHTMLWindow6
*iface
, UINT
*pctinfo
)
2055 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2057 return IDispatchEx_GetTypeInfoCount(&This
->IDispatchEx_iface
, pctinfo
);
2060 static HRESULT WINAPI
HTMLWindow6_GetTypeInfo(IHTMLWindow6
*iface
, UINT iTInfo
,
2061 LCID lcid
, ITypeInfo
**ppTInfo
)
2063 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2065 return IDispatchEx_GetTypeInfo(&This
->IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2068 static HRESULT WINAPI
HTMLWindow6_GetIDsOfNames(IHTMLWindow6
*iface
, REFIID riid
,
2069 LPOLESTR
*rgszNames
, UINT cNames
,
2070 LCID lcid
, DISPID
*rgDispId
)
2072 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2074 return IDispatchEx_GetIDsOfNames(&This
->IDispatchEx_iface
, riid
, rgszNames
, cNames
, lcid
,
2078 static HRESULT WINAPI
HTMLWindow6_Invoke(IHTMLWindow6
*iface
, DISPID dispIdMember
,
2079 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2080 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2082 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2084 return IDispatchEx_Invoke(&This
->IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2085 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2088 static HRESULT WINAPI
HTMLWindow6_put_XDomainRequest(IHTMLWindow6
*iface
, VARIANT v
)
2090 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2091 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2095 static HRESULT WINAPI
HTMLWindow6_get_XDomainRequest(IHTMLWindow6
*iface
, VARIANT
*p
)
2097 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2098 FIXME("(%p)->(%p)\n", This
, p
);
2102 static HRESULT WINAPI
HTMLWindow6_get_sessionStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
2104 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2106 FIXME("(%p)->(%p)\n", This
, p
);
2108 if(!This
->inner_window
->session_storage
) {
2111 hres
= create_storage(&This
->inner_window
->session_storage
);
2116 IHTMLStorage_AddRef(This
->inner_window
->session_storage
);
2117 *p
= This
->inner_window
->session_storage
;
2121 static HRESULT WINAPI
HTMLWindow6_get_localStorage(IHTMLWindow6
*iface
, IHTMLStorage
**p
)
2123 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2124 FIXME("(%p)->(%p)\n", This
, p
);
2128 static HRESULT WINAPI
HTMLWindow6_put_onhashchange(IHTMLWindow6
*iface
, VARIANT v
)
2130 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2131 FIXME("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2135 static HRESULT WINAPI
HTMLWindow6_get_onhashchange(IHTMLWindow6
*iface
, VARIANT
*p
)
2137 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2138 FIXME("(%p)->(%p)\n", This
, p
);
2142 static HRESULT WINAPI
HTMLWindow6_get_maxConnectionsPerServer(IHTMLWindow6
*iface
, LONG
*p
)
2144 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2145 FIXME("(%p)->(%p)\n", This
, p
);
2149 static HRESULT WINAPI
HTMLWindow6_postMessage(IHTMLWindow6
*iface
, BSTR msg
, VARIANT targetOrigin
)
2151 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2153 FIXME("(%p)->(%s %s) semi-stub\n", This
, debugstr_w(msg
), debugstr_variant(&targetOrigin
));
2155 if(!This
->inner_window
->doc
) {
2156 FIXME("No document\n");
2160 fire_event(This
->inner_window
->doc
, EVENTID_MESSAGE
, TRUE
, &This
->inner_window
->doc
->node
, NULL
, NULL
);
2164 static HRESULT WINAPI
HTMLWindow6_toStaticHTML(IHTMLWindow6
*iface
, BSTR bstrHTML
, BSTR
*pbstrStaticHTML
)
2166 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2167 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrHTML
), pbstrStaticHTML
);
2171 static HRESULT WINAPI
HTMLWindow6_put_onmessage(IHTMLWindow6
*iface
, VARIANT v
)
2173 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2175 TRACE("(%p)->(%s)\n", This
, debugstr_variant(&v
));
2177 return set_window_event(This
, EVENTID_MESSAGE
, &v
);
2180 static HRESULT WINAPI
HTMLWindow6_get_onmessage(IHTMLWindow6
*iface
, VARIANT
*p
)
2182 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2184 TRACE("(%p)->(%p)\n", This
, p
);
2186 return get_window_event(This
, EVENTID_MESSAGE
, p
);
2189 static HRESULT WINAPI
HTMLWindow6_msWriteProfilerMark(IHTMLWindow6
*iface
, BSTR bstrProfilerMark
)
2191 HTMLWindow
*This
= impl_from_IHTMLWindow6(iface
);
2192 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrProfilerMark
));
2196 static const IHTMLWindow6Vtbl HTMLWindow6Vtbl
= {
2197 HTMLWindow6_QueryInterface
,
2199 HTMLWindow6_Release
,
2200 HTMLWindow6_GetTypeInfoCount
,
2201 HTMLWindow6_GetTypeInfo
,
2202 HTMLWindow6_GetIDsOfNames
,
2204 HTMLWindow6_put_XDomainRequest
,
2205 HTMLWindow6_get_XDomainRequest
,
2206 HTMLWindow6_get_sessionStorage
,
2207 HTMLWindow6_get_localStorage
,
2208 HTMLWindow6_put_onhashchange
,
2209 HTMLWindow6_get_onhashchange
,
2210 HTMLWindow6_get_maxConnectionsPerServer
,
2211 HTMLWindow6_postMessage
,
2212 HTMLWindow6_toStaticHTML
,
2213 HTMLWindow6_put_onmessage
,
2214 HTMLWindow6_get_onmessage
,
2215 HTMLWindow6_msWriteProfilerMark
2218 static inline HTMLWindow
*impl_from_IHTMLPrivateWindow(IHTMLPrivateWindow
*iface
)
2220 return CONTAINING_RECORD(iface
, HTMLWindow
, IHTMLPrivateWindow_iface
);
2223 static HRESULT WINAPI
HTMLPrivateWindow_QueryInterface(IHTMLPrivateWindow
*iface
, REFIID riid
, void **ppv
)
2225 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2227 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2230 static ULONG WINAPI
HTMLPrivateWindow_AddRef(IHTMLPrivateWindow
*iface
)
2232 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2234 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2237 static ULONG WINAPI
HTMLPrivateWindow_Release(IHTMLPrivateWindow
*iface
)
2239 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2241 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2244 static HRESULT WINAPI
HTMLPrivateWindow_SuperNavigate(IHTMLPrivateWindow
*iface
, BSTR url
, BSTR arg2
, BSTR arg3
,
2245 BSTR arg4
, VARIANT
*post_data_var
, VARIANT
*headers_var
, ULONG flags
)
2247 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2248 HTMLOuterWindow
*window
= This
->outer_window
;
2249 OLECHAR
*translated_url
= NULL
;
2250 DWORD post_data_size
= 0;
2251 BYTE
*post_data
= NULL
;
2252 WCHAR
*headers
= NULL
;
2256 TRACE("(%p)->(%s %s %s %s %s %s %x)\n", This
, debugstr_w(url
), debugstr_w(arg2
), debugstr_w(arg3
), debugstr_w(arg4
),
2257 debugstr_variant(post_data_var
), debugstr_variant(headers_var
), flags
);
2259 if(window
->doc_obj
->hostui
) {
2260 hres
= IDocHostUIHandler_TranslateUrl(window
->doc_obj
->hostui
, 0, url
, &translated_url
);
2262 translated_url
= NULL
;
2265 hres
= create_uri(translated_url
? translated_url
: url
, 0, &uri
);
2266 CoTaskMemFree(translated_url
);
2271 if(V_VT(post_data_var
) == (VT_ARRAY
|VT_UI1
)) {
2272 SafeArrayAccessData(V_ARRAY(post_data_var
), (void**)&post_data
);
2273 post_data_size
= V_ARRAY(post_data_var
)->rgsabound
[0].cElements
;
2277 if(headers_var
&& V_VT(headers_var
) != VT_EMPTY
&& V_VT(headers_var
) != VT_ERROR
) {
2278 if(V_VT(headers_var
) != VT_BSTR
)
2279 return E_INVALIDARG
;
2281 headers
= V_BSTR(headers_var
);
2284 hres
= super_navigate(window
, uri
, BINDING_NAVIGATED
|BINDING_NOFRAG
, headers
, post_data
, post_data_size
);
2287 SafeArrayUnaccessData(V_ARRAY(post_data_var
));
2292 static HRESULT WINAPI
HTMLPrivateWindow_GetPendingUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2294 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2295 FIXME("(%p)->(%p)\n", This
, url
);
2299 static HRESULT WINAPI
HTMLPrivateWindow_SetPICSTarget(IHTMLPrivateWindow
*iface
, IOleCommandTarget
*cmdtrg
)
2301 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2302 FIXME("(%p)->(%p)\n", This
, cmdtrg
);
2306 static HRESULT WINAPI
HTMLPrivateWindow_PICSComplete(IHTMLPrivateWindow
*iface
, int arg
)
2308 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2309 FIXME("(%p)->(%x)\n", This
, arg
);
2313 static HRESULT WINAPI
HTMLPrivateWindow_FindWindowByName(IHTMLPrivateWindow
*iface
, LPCWSTR name
, IHTMLWindow2
**ret
)
2315 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2316 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(name
), ret
);
2320 static HRESULT WINAPI
HTMLPrivateWindow_GetAddressBarUrl(IHTMLPrivateWindow
*iface
, BSTR
*url
)
2322 HTMLWindow
*This
= impl_from_IHTMLPrivateWindow(iface
);
2323 TRACE("(%p)->(%p)\n", This
, url
);
2326 return E_INVALIDARG
;
2328 *url
= SysAllocString(This
->outer_window
->url
);
2332 static const IHTMLPrivateWindowVtbl HTMLPrivateWindowVtbl
= {
2333 HTMLPrivateWindow_QueryInterface
,
2334 HTMLPrivateWindow_AddRef
,
2335 HTMLPrivateWindow_Release
,
2336 HTMLPrivateWindow_SuperNavigate
,
2337 HTMLPrivateWindow_GetPendingUrl
,
2338 HTMLPrivateWindow_SetPICSTarget
,
2339 HTMLPrivateWindow_PICSComplete
,
2340 HTMLPrivateWindow_FindWindowByName
,
2341 HTMLPrivateWindow_GetAddressBarUrl
2344 static inline HTMLWindow
*impl_from_ITravelLogClient(ITravelLogClient
*iface
)
2346 return CONTAINING_RECORD(iface
, HTMLWindow
, ITravelLogClient_iface
);
2349 static HRESULT WINAPI
TravelLogClient_QueryInterface(ITravelLogClient
*iface
, REFIID riid
, void **ppv
)
2351 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2353 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2356 static ULONG WINAPI
TravelLogClient_AddRef(ITravelLogClient
*iface
)
2358 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2360 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2363 static ULONG WINAPI
TravelLogClient_Release(ITravelLogClient
*iface
)
2365 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2367 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2370 static HRESULT WINAPI
TravelLogClient_FindWindowByIndex(ITravelLogClient
*iface
, DWORD dwID
, IUnknown
**ppunk
)
2372 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2374 FIXME("(%p)->(%d %p) semi-stub\n", This
, dwID
, ppunk
);
2380 static HRESULT WINAPI
TravelLogClient_GetWindowData(ITravelLogClient
*iface
, IStream
*pStream
, LPWINDOWDATA pWinData
)
2382 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2383 FIXME("(%p)->(%p %p)\n", This
, pStream
, pWinData
);
2387 static HRESULT WINAPI
TravelLogClient_LoadHistoryPosition(ITravelLogClient
*iface
, LPWSTR pszUrlLocation
, DWORD dwPosition
)
2389 HTMLWindow
*This
= impl_from_ITravelLogClient(iface
);
2390 FIXME("(%p)->(%s %d)\n", This
, debugstr_w(pszUrlLocation
), dwPosition
);
2394 static const ITravelLogClientVtbl TravelLogClientVtbl
= {
2395 TravelLogClient_QueryInterface
,
2396 TravelLogClient_AddRef
,
2397 TravelLogClient_Release
,
2398 TravelLogClient_FindWindowByIndex
,
2399 TravelLogClient_GetWindowData
,
2400 TravelLogClient_LoadHistoryPosition
2403 static inline HTMLWindow
*impl_from_IObjectIdentity(IObjectIdentity
*iface
)
2405 return CONTAINING_RECORD(iface
, HTMLWindow
, IObjectIdentity_iface
);
2408 static HRESULT WINAPI
ObjectIdentity_QueryInterface(IObjectIdentity
*iface
, REFIID riid
, void **ppv
)
2410 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2412 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2415 static ULONG WINAPI
ObjectIdentity_AddRef(IObjectIdentity
*iface
)
2417 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2419 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2422 static ULONG WINAPI
ObjectIdentity_Release(IObjectIdentity
*iface
)
2424 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2426 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2429 static HRESULT WINAPI
ObjectIdentity_IsEqualObject(IObjectIdentity
*iface
, IUnknown
*unk
)
2431 HTMLWindow
*This
= impl_from_IObjectIdentity(iface
);
2432 IServiceProvider
*sp
;
2435 TRACE("(%p)->(%p)\n", This
, unk
);
2437 hres
= IUnknown_QueryInterface(unk
, &IID_IServiceProvider
, (void**)&sp
);
2441 hres
= &This
->inner_window
->base
.IServiceProvider_iface
==sp
||
2442 &This
->outer_window
->base
.IServiceProvider_iface
==sp
? S_OK
: S_FALSE
;
2443 IServiceProvider_Release(sp
);
2447 static const IObjectIdentityVtbl ObjectIdentityVtbl
= {
2448 ObjectIdentity_QueryInterface
,
2449 ObjectIdentity_AddRef
,
2450 ObjectIdentity_Release
,
2451 ObjectIdentity_IsEqualObject
2454 static inline HTMLWindow
*impl_from_IProvideMultipleClassInfo(IProvideMultipleClassInfo
*iface
)
2456 return CONTAINING_RECORD(iface
, HTMLWindow
, IProvideMultipleClassInfo_iface
);
2459 static HRESULT WINAPI
ProvideClassInfo_QueryInterface(IProvideMultipleClassInfo
*iface
,
2460 REFIID riid
, void **ppv
)
2462 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2463 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2466 static ULONG WINAPI
ProvideClassInfo_AddRef(IProvideMultipleClassInfo
*iface
)
2468 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2469 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2472 static ULONG WINAPI
ProvideClassInfo_Release(IProvideMultipleClassInfo
*iface
)
2474 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2475 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2478 static HRESULT WINAPI
ProvideClassInfo_GetClassInfo(IProvideMultipleClassInfo
*iface
, ITypeInfo
**ppTI
)
2480 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2481 TRACE("(%p)->(%p)\n", This
, ppTI
);
2482 return get_class_typeinfo(&CLSID_HTMLWindow2
, ppTI
);
2485 static HRESULT WINAPI
ProvideClassInfo2_GetGUID(IProvideMultipleClassInfo
*iface
, DWORD dwGuidKind
, GUID
*pGUID
)
2487 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2488 FIXME("(%p)->(%u %p)\n", This
, dwGuidKind
, pGUID
);
2492 static HRESULT WINAPI
ProvideMultipleClassInfo_GetMultiTypeInfoCount(IProvideMultipleClassInfo
*iface
, ULONG
*pcti
)
2494 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2495 FIXME("(%p)->(%p)\n", This
, pcti
);
2500 static HRESULT WINAPI
ProvideMultipleClassInfo_GetInfoOfIndex(IProvideMultipleClassInfo
*iface
, ULONG iti
,
2501 DWORD dwFlags
, ITypeInfo
**pptiCoClass
, DWORD
*pdwTIFlags
, ULONG
*pcdispidReserved
, IID
*piidPrimary
, IID
*piidSource
)
2503 HTMLWindow
*This
= impl_from_IProvideMultipleClassInfo(iface
);
2504 FIXME("(%p)->(%u %x %p %p %p %p %p)\n", This
, iti
, dwFlags
, pptiCoClass
, pdwTIFlags
, pcdispidReserved
, piidPrimary
, piidSource
);
2508 static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl
= {
2509 ProvideClassInfo_QueryInterface
,
2510 ProvideClassInfo_AddRef
,
2511 ProvideClassInfo_Release
,
2512 ProvideClassInfo_GetClassInfo
,
2513 ProvideClassInfo2_GetGUID
,
2514 ProvideMultipleClassInfo_GetMultiTypeInfoCount
,
2515 ProvideMultipleClassInfo_GetInfoOfIndex
2518 static inline HTMLWindow
*impl_from_IDispatchEx(IDispatchEx
*iface
)
2520 return CONTAINING_RECORD(iface
, HTMLWindow
, IDispatchEx_iface
);
2523 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
2525 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2527 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2530 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
2532 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2534 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2537 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
2539 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2541 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2544 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
2546 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2548 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2550 return IDispatchEx_GetTypeInfoCount(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, pctinfo
);
2553 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
2554 LCID lcid
, ITypeInfo
**ppTInfo
)
2556 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2558 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2560 return IDispatchEx_GetTypeInfo(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
2563 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
2564 LPOLESTR
*rgszNames
, UINT cNames
,
2565 LCID lcid
, DISPID
*rgDispId
)
2567 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2571 WARN("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
2573 for(i
=0; i
< cNames
; i
++) {
2574 /* We shouldn't use script's IDispatchEx here, so we shouldn't use GetDispID */
2575 hres
= IDispatchEx_GetDispID(&This
->IDispatchEx_iface
, rgszNames
[i
], 0, rgDispId
+i
);
2583 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
2584 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
2585 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
2587 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2589 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2590 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2592 /* FIXME: Use script dispatch */
2594 return IDispatchEx_Invoke(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
2595 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2598 static global_prop_t
*alloc_global_prop(HTMLInnerWindow
*This
, global_prop_type_t type
, BSTR name
)
2600 if(This
->global_prop_cnt
== This
->global_prop_size
) {
2601 global_prop_t
*new_props
;
2604 if(This
->global_props
) {
2605 new_size
= This
->global_prop_size
*2;
2606 new_props
= heap_realloc(This
->global_props
, new_size
*sizeof(global_prop_t
));
2609 new_props
= heap_alloc(new_size
*sizeof(global_prop_t
));
2613 This
->global_props
= new_props
;
2614 This
->global_prop_size
= new_size
;
2617 This
->global_props
[This
->global_prop_cnt
].name
= heap_strdupW(name
);
2618 if(!This
->global_props
[This
->global_prop_cnt
].name
)
2621 This
->global_props
[This
->global_prop_cnt
].type
= type
;
2622 return This
->global_props
+ This
->global_prop_cnt
++;
2625 static inline DWORD
prop_to_dispid(HTMLInnerWindow
*This
, global_prop_t
*prop
)
2627 return MSHTML_DISPID_CUSTOM_MIN
+ (prop
-This
->global_props
);
2630 HRESULT
search_window_props(HTMLInnerWindow
*This
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2633 ScriptHost
*script_host
;
2636 for(i
=0; i
< This
->global_prop_cnt
; i
++) {
2637 /* FIXME: case sensitivity */
2638 if(!strcmpW(This
->global_props
[i
].name
, bstrName
)) {
2639 *pid
= MSHTML_DISPID_CUSTOM_MIN
+i
;
2644 if(find_global_prop(This
->base
.inner_window
, bstrName
, grfdex
, &script_host
, &id
)) {
2645 global_prop_t
*prop
;
2647 prop
= alloc_global_prop(This
, GLOBAL_SCRIPTVAR
, bstrName
);
2649 return E_OUTOFMEMORY
;
2651 prop
->script_host
= script_host
;
2654 *pid
= prop_to_dispid(This
, prop
);
2658 return DISP_E_UNKNOWNNAME
;
2661 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
2663 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2664 HTMLInnerWindow
*window
= This
->inner_window
;
2667 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
2669 hres
= search_window_props(window
, bstrName
, grfdex
, pid
);
2670 if(hres
!= DISP_E_UNKNOWNNAME
)
2673 hres
= IDispatchEx_GetDispID(&window
->base
.inner_window
->event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
, pid
);
2674 if(hres
!= DISP_E_UNKNOWNNAME
)
2677 if(This
->outer_window
) {
2678 HTMLOuterWindow
*frame
;
2680 hres
= get_frame_by_name(This
->outer_window
, bstrName
, FALSE
, &frame
);
2681 if(SUCCEEDED(hres
) && frame
) {
2682 global_prop_t
*prop
;
2684 IHTMLWindow2_Release(&frame
->base
.IHTMLWindow2_iface
);
2686 prop
= alloc_global_prop(window
, GLOBAL_FRAMEVAR
, bstrName
);
2688 return E_OUTOFMEMORY
;
2690 *pid
= prop_to_dispid(window
, prop
);
2696 global_prop_t
*prop
;
2699 hres
= IHTMLDocument3_getElementById(&window
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2701 if(SUCCEEDED(hres
) && elem
) {
2702 IHTMLElement_Release(elem
);
2704 prop
= alloc_global_prop(window
, GLOBAL_ELEMENTVAR
, bstrName
);
2706 return E_OUTOFMEMORY
;
2708 *pid
= prop_to_dispid(window
, prop
);
2713 return DISP_E_UNKNOWNNAME
;
2716 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
2717 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
2719 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2720 HTMLInnerWindow
*window
= This
->inner_window
;
2722 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2725 case DISPID_IHTMLWINDOW2_LOCATION
: {
2726 HTMLLocation
*location
;
2729 if(!(wFlags
& DISPATCH_PROPERTYPUT
))
2732 TRACE("forwarding to location.href\n");
2734 hres
= get_location(window
, &location
);
2738 hres
= IDispatchEx_InvokeEx(&location
->dispex
.IDispatchEx_iface
, DISPID_VALUE
, lcid
,
2739 wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2740 IHTMLLocation_Release(&location
->IHTMLLocation_iface
);
2743 case DISPID_IHTMLWINDOW2_SETTIMEOUT
:
2744 case DISPID_IHTMLWINDOW3_SETTIMEOUT
: {
2746 DISPPARAMS dp
= {args
, NULL
, 2, 0};
2749 * setTimeout calls should use default value 0 for the second argument if only one is provided,
2750 * but IDL file does not reflect that. We fixup arguments here instead.
2752 if(!(wFlags
& DISPATCH_METHOD
) || pdp
->cArgs
!= 1 || pdp
->cNamedArgs
)
2755 TRACE("Fixing args\n");
2759 args
[1] = *pdp
->rgvarg
;
2760 return IDispatchEx_InvokeEx(&window
->event_target
.dispex
.IDispatchEx_iface
, id
, lcid
,
2761 wFlags
, &dp
, pvarRes
, pei
, pspCaller
);
2765 return IDispatchEx_InvokeEx(&window
->event_target
.dispex
.IDispatchEx_iface
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
2768 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
2770 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2772 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
2774 return IDispatchEx_DeleteMemberByName(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, bstrName
, grfdex
);
2777 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
2779 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2781 TRACE("(%p)->(%x)\n", This
, id
);
2783 return IDispatchEx_DeleteMemberByDispID(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
);
2786 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
2788 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2790 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
2792 return IDispatchEx_GetMemberProperties(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
, grfdexFetch
,
2796 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
2798 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2800 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
2802 return IDispatchEx_GetMemberName(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, id
, pbstrName
);
2805 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
2807 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2809 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
2811 return IDispatchEx_GetNextDispID(&This
->inner_window
->event_target
.dispex
.IDispatchEx_iface
, grfdex
, id
, pid
);
2814 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
2816 HTMLWindow
*This
= impl_from_IDispatchEx(iface
);
2818 TRACE("(%p)->(%p)\n", This
, ppunk
);
2824 static const IDispatchExVtbl WindowDispExVtbl
= {
2825 WindowDispEx_QueryInterface
,
2826 WindowDispEx_AddRef
,
2827 WindowDispEx_Release
,
2828 WindowDispEx_GetTypeInfoCount
,
2829 WindowDispEx_GetTypeInfo
,
2830 WindowDispEx_GetIDsOfNames
,
2831 WindowDispEx_Invoke
,
2832 WindowDispEx_GetDispID
,
2833 WindowDispEx_InvokeEx
,
2834 WindowDispEx_DeleteMemberByName
,
2835 WindowDispEx_DeleteMemberByDispID
,
2836 WindowDispEx_GetMemberProperties
,
2837 WindowDispEx_GetMemberName
,
2838 WindowDispEx_GetNextDispID
,
2839 WindowDispEx_GetNameSpaceParent
2842 static inline HTMLWindow
*impl_from_IServiceProvider(IServiceProvider
*iface
)
2844 return CONTAINING_RECORD(iface
, HTMLWindow
, IServiceProvider_iface
);
2847 static HRESULT WINAPI
HTMLWindowSP_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
2849 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2850 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2853 static ULONG WINAPI
HTMLWindowSP_AddRef(IServiceProvider
*iface
)
2855 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2856 return IHTMLWindow2_AddRef(&This
->IHTMLWindow2_iface
);
2859 static ULONG WINAPI
HTMLWindowSP_Release(IServiceProvider
*iface
)
2861 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2862 return IHTMLWindow2_Release(&This
->IHTMLWindow2_iface
);
2865 static HRESULT WINAPI
HTMLWindowSP_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
2867 HTMLWindow
*This
= impl_from_IServiceProvider(iface
);
2869 if(IsEqualGUID(guidService
, &IID_IHTMLWindow2
)) {
2870 TRACE("IID_IHTMLWindow2\n");
2871 return IHTMLWindow2_QueryInterface(&This
->IHTMLWindow2_iface
, riid
, ppv
);
2874 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_mshtml_guid(guidService
), debugstr_mshtml_guid(riid
), ppv
);
2876 if(!This
->outer_window
->doc_obj
)
2877 return E_NOINTERFACE
;
2879 return IServiceProvider_QueryService(&This
->outer_window
->doc_obj
->basedoc
.IServiceProvider_iface
,
2880 guidService
, riid
, ppv
);
2883 static const IServiceProviderVtbl ServiceProviderVtbl
= {
2884 HTMLWindowSP_QueryInterface
,
2885 HTMLWindowSP_AddRef
,
2886 HTMLWindowSP_Release
,
2887 HTMLWindowSP_QueryService
2890 static inline HTMLInnerWindow
*impl_from_DispatchEx(DispatchEx
*iface
)
2892 return CONTAINING_RECORD(iface
, HTMLInnerWindow
, event_target
.dispex
);
2895 static HRESULT
HTMLWindow_invoke(DispatchEx
*dispex
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
2896 VARIANT
*res
, EXCEPINFO
*ei
, IServiceProvider
*caller
)
2898 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
2899 global_prop_t
*prop
;
2903 idx
= id
- MSHTML_DISPID_CUSTOM_MIN
;
2904 if(idx
>= This
->global_prop_cnt
)
2905 return DISP_E_MEMBERNOTFOUND
;
2907 prop
= This
->global_props
+idx
;
2909 switch(prop
->type
) {
2910 case GLOBAL_SCRIPTVAR
: {
2914 disp
= get_script_disp(prop
->script_host
);
2916 return E_UNEXPECTED
;
2918 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&iface
);
2919 if(SUCCEEDED(hres
)) {
2920 TRACE("%s >>>\n", debugstr_w(prop
->name
));
2921 hres
= IDispatchEx_InvokeEx(iface
, prop
->id
, lcid
, flags
, params
, res
, ei
, caller
);
2923 TRACE("%s <<<\n", debugstr_w(prop
->name
));
2925 WARN("%s <<< %08x\n", debugstr_w(prop
->name
), hres
);
2926 IDispatchEx_Release(iface
);
2928 FIXME("No IDispatchEx\n");
2930 IDispatch_Release(disp
);
2933 case GLOBAL_ELEMENTVAR
:
2935 case DISPATCH_PROPERTYGET
|DISPATCH_METHOD
:
2936 case DISPATCH_PROPERTYGET
: {
2939 hres
= IHTMLDocument3_getElementById(&This
->base
.inner_window
->doc
->basedoc
.IHTMLDocument3_iface
,
2945 return DISP_E_MEMBERNOTFOUND
;
2947 V_VT(res
) = VT_DISPATCH
;
2948 V_DISPATCH(res
) = (IDispatch
*)elem
;
2951 case DISPATCH_PROPERTYPUT
: {
2954 hres
= dispex_get_dynid(&This
->event_target
.dispex
, prop
->name
, &dispex_id
);
2958 prop
->type
= GLOBAL_DISPEXVAR
;
2959 prop
->id
= dispex_id
;
2960 return IDispatchEx_InvokeEx(&This
->event_target
.dispex
.IDispatchEx_iface
, dispex_id
, 0, flags
, params
, res
, ei
, caller
);
2963 FIXME("Not supported flags: %x\n", flags
);
2966 case GLOBAL_FRAMEVAR
:
2967 if(!This
->base
.outer_window
)
2968 return E_UNEXPECTED
;
2971 case DISPATCH_PROPERTYGET
: {
2972 HTMLOuterWindow
*frame
;
2974 hres
= get_frame_by_name(This
->base
.outer_window
, prop
->name
, FALSE
, &frame
);
2979 return DISP_E_MEMBERNOTFOUND
;
2981 V_VT(res
) = VT_DISPATCH
;
2982 V_DISPATCH(res
) = (IDispatch
*)&frame
->base
.inner_window
->base
.IHTMLWindow2_iface
;
2983 IDispatch_AddRef(V_DISPATCH(res
));
2987 FIXME("Not supported flags: %x\n", flags
);
2990 case GLOBAL_DISPEXVAR
:
2991 return IDispatchEx_InvokeEx(&This
->event_target
.dispex
.IDispatchEx_iface
, prop
->id
, 0, flags
, params
, res
, ei
, caller
);
2993 ERR("invalid type %d\n", prop
->type
);
2994 hres
= DISP_E_MEMBERNOTFOUND
;
3000 static EventTarget
*HTMLWindow_get_event_target(DispatchEx
*dispex
)
3002 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
3003 return &This
->event_target
;
3006 static void HTMLWindow_bind_event(DispatchEx
*dispex
, int eid
)
3008 HTMLInnerWindow
*This
= impl_from_DispatchEx(dispex
);
3009 dispex_get_vtbl(&This
->doc
->node
.event_target
.dispex
)->bind_event(&This
->doc
->node
.event_target
.dispex
, eid
);
3012 static void HTMLWindow_init_dispex_info(dispex_data_t
*info
, compat_mode_t compat_mode
)
3014 dispex_info_add_interface(info
, IHTMLWindow5_tid
, NULL
);
3017 static const dispex_static_data_vtbl_t HTMLWindow_dispex_vtbl
= {
3023 HTMLWindow_get_event_target
,
3024 HTMLWindow_bind_event
3027 static const tid_t HTMLWindow_iface_tids
[] = {
3035 static dispex_static_data_t HTMLWindow_dispex
= {
3036 &HTMLWindow_dispex_vtbl
,
3037 DispHTMLWindow2_tid
,
3038 HTMLWindow_iface_tids
,
3039 HTMLWindow_init_dispex_info
3042 static void *alloc_window(size_t size
)
3046 window
= heap_alloc_zero(size
);
3050 window
->IHTMLWindow2_iface
.lpVtbl
= &HTMLWindow2Vtbl
;
3051 window
->IHTMLWindow3_iface
.lpVtbl
= &HTMLWindow3Vtbl
;
3052 window
->IHTMLWindow4_iface
.lpVtbl
= &HTMLWindow4Vtbl
;
3053 window
->IHTMLWindow5_iface
.lpVtbl
= &HTMLWindow5Vtbl
;
3054 window
->IHTMLWindow6_iface
.lpVtbl
= &HTMLWindow6Vtbl
;
3055 window
->IHTMLPrivateWindow_iface
.lpVtbl
= &HTMLPrivateWindowVtbl
;
3056 window
->IDispatchEx_iface
.lpVtbl
= &WindowDispExVtbl
;
3057 window
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
3058 window
->ITravelLogClient_iface
.lpVtbl
= &TravelLogClientVtbl
;
3059 window
->IObjectIdentity_iface
.lpVtbl
= &ObjectIdentityVtbl
;
3060 window
->IProvideMultipleClassInfo_iface
.lpVtbl
= &ProvideMultipleClassInfoVtbl
;
3066 static HRESULT
create_inner_window(HTMLOuterWindow
*outer_window
, IMoniker
*mon
, HTMLInnerWindow
**ret
)
3068 HTMLInnerWindow
*window
;
3070 window
= alloc_window(sizeof(HTMLInnerWindow
));
3072 return E_OUTOFMEMORY
;
3074 list_init(&window
->script_hosts
);
3075 list_init(&window
->bindings
);
3076 list_init(&window
->script_queue
);
3078 window
->base
.outer_window
= outer_window
;
3079 window
->base
.inner_window
= window
;
3081 init_event_target(&window
->event_target
);
3082 init_dispex(&window
->event_target
.dispex
, (IUnknown
*)&window
->base
.IHTMLWindow2_iface
, &HTMLWindow_dispex
);
3084 window
->task_magic
= get_task_target_magic();
3087 IMoniker_AddRef(mon
);
3095 HRESULT
HTMLOuterWindow_Create(HTMLDocumentObj
*doc_obj
, nsIDOMWindow
*nswindow
,
3096 HTMLOuterWindow
*parent
, HTMLOuterWindow
**ret
)
3098 HTMLOuterWindow
*window
;
3101 window
= alloc_window(sizeof(HTMLOuterWindow
));
3103 return E_OUTOFMEMORY
;
3105 window
->base
.outer_window
= window
;
3106 window
->base
.inner_window
= NULL
;
3108 window
->window_ref
= heap_alloc(sizeof(windowref_t
));
3109 if(!window
->window_ref
) {
3111 return E_OUTOFMEMORY
;
3114 window
->doc_obj
= doc_obj
;
3116 window
->window_ref
->window
= window
;
3117 window
->window_ref
->ref
= 1;
3122 nsIDOMWindow_AddRef(nswindow
);
3123 window
->nswindow
= nswindow
;
3125 nsres
= nsIDOMWindow_QueryInterface(nswindow
, &IID_mozIDOMWindowProxy
, (void**)&window
->window_proxy
);
3126 assert(nsres
== NS_OK
);
3129 window
->scriptmode
= parent
? parent
->scriptmode
: SCRIPTMODE_GECKO
;
3130 window
->readystate
= READYSTATE_UNINITIALIZED
;
3131 window
->task_magic
= get_task_target_magic();
3133 list_init(&window
->children
);
3134 wine_rb_put(&window_map
, window
->window_proxy
, &window
->entry
);
3136 hres
= create_pending_window(window
, NULL
);
3138 hres
= update_window_doc(window
->pending_window
);
3140 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
3144 hres
= CoInternetCreateSecurityManager(NULL
, &window
->secmgr
, 0);
3146 IHTMLWindow2_Release(&window
->base
.IHTMLWindow2_iface
);
3151 IHTMLWindow2_AddRef(&window
->base
.IHTMLWindow2_iface
);
3153 window
->parent
= parent
;
3154 list_add_tail(&parent
->children
, &window
->sibling_entry
);
3157 TRACE("%p inner_window %p\n", window
, window
->base
.inner_window
);
3163 HRESULT
create_pending_window(HTMLOuterWindow
*outer_window
, nsChannelBSC
*channelbsc
)
3165 HTMLInnerWindow
*pending_window
;
3168 hres
= create_inner_window(outer_window
, outer_window
->mon
/* FIXME */, &pending_window
);
3173 IBindStatusCallback_AddRef(&channelbsc
->bsc
.IBindStatusCallback_iface
);
3174 pending_window
->bscallback
= channelbsc
;
3177 if(outer_window
->pending_window
) {
3178 abort_window_bindings(outer_window
->pending_window
);
3179 outer_window
->pending_window
->base
.outer_window
= NULL
;
3180 IHTMLWindow2_Release(&outer_window
->pending_window
->base
.IHTMLWindow2_iface
);
3183 outer_window
->pending_window
= pending_window
;
3187 HRESULT
update_window_doc(HTMLInnerWindow
*window
)
3189 HTMLOuterWindow
*outer_window
= window
->base
.outer_window
;
3190 nsIDOMHTMLDocument
*nshtmldoc
;
3191 nsIDOMDocument
*nsdoc
;
3195 assert(!window
->doc
);
3198 ERR("NULL outer window\n");
3199 return E_UNEXPECTED
;
3202 nsres
= nsIDOMWindow_GetDocument(outer_window
->nswindow
, &nsdoc
);
3203 if(NS_FAILED(nsres
) || !nsdoc
) {
3204 ERR("GetDocument failed: %08x\n", nsres
);
3208 nsres
= nsIDOMDocument_QueryInterface(nsdoc
, &IID_nsIDOMHTMLDocument
, (void**)&nshtmldoc
);
3209 nsIDOMDocument_Release(nsdoc
);
3210 if(NS_FAILED(nsres
)) {
3211 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres
);
3215 hres
= create_doc_from_nsdoc(nshtmldoc
, outer_window
->doc_obj
, window
, &window
->doc
);
3216 nsIDOMHTMLDocument_Release(nshtmldoc
);
3220 if(outer_window
->doc_obj
->usermode
== EDITMODE
) {
3224 static const PRUnichar onW
[] = {'o','n',0};
3226 nsAString_InitDepend(&mode_str
, onW
);
3227 nsres
= nsIDOMHTMLDocument_SetDesignMode(window
->doc
->nsdoc
, &mode_str
);
3228 nsAString_Finish(&mode_str
);
3229 if(NS_FAILED(nsres
))
3230 ERR("SetDesignMode failed: %08x\n", nsres
);
3233 if(window
!= outer_window
->pending_window
) {
3234 ERR("not current pending window\n");
3238 if(outer_window
->base
.inner_window
)
3239 detach_inner_window(outer_window
->base
.inner_window
);
3240 outer_window
->base
.inner_window
= window
;
3241 outer_window
->pending_window
= NULL
;
3243 if(outer_window
->doc_obj
->basedoc
.window
== outer_window
|| !outer_window
->doc_obj
->basedoc
.window
) {
3244 if(outer_window
->doc_obj
->basedoc
.doc_node
)
3245 htmldoc_release(&outer_window
->doc_obj
->basedoc
.doc_node
->basedoc
);
3246 outer_window
->doc_obj
->basedoc
.doc_node
= window
->doc
;
3247 htmldoc_addref(&window
->doc
->basedoc
);