2 * Copyright 2006 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
28 #include "wine/debug.h"
29 #include "wine/unicode.h"
31 #include "mshtml_private.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
36 static struct list window_list
= LIST_INIT(window_list
);
38 #define HTMLWINDOW2_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow2, iface)
40 static HRESULT WINAPI
HTMLWindow2_QueryInterface(IHTMLWindow2
*iface
, REFIID riid
, void **ppv
)
42 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
46 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
47 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
48 *ppv
= HTMLWINDOW2(This
);
49 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
50 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
51 *ppv
= HTMLWINDOW2(This
);
52 }else if(IsEqualGUID(&IID_IDispatchEx
, riid
)) {
53 TRACE("(%p)->(IID_IDispatchEx %p)\n", This
, ppv
);
54 *ppv
= DISPATCHEX(This
);
55 }else if(IsEqualGUID(&IID_IHTMLFramesCollection2
, riid
)) {
56 TRACE("(%p)->(IID_IHTMLFramesCollection2 %p)\n", This
, ppv
);
57 *ppv
= HTMLWINDOW2(This
);
58 }else if(IsEqualGUID(&IID_IHTMLWindow2
, riid
)) {
59 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This
, ppv
);
60 *ppv
= HTMLWINDOW2(This
);
61 }else if(IsEqualGUID(&IID_IHTMLWindow3
, riid
)) {
62 TRACE("(%p)->(IID_IHTMLWindow2 %p)\n", This
, ppv
);
63 *ppv
= HTMLWINDOW3(This
);
64 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
65 return *ppv
? S_OK
: E_NOINTERFACE
;
69 IUnknown_AddRef((IUnknown
*)*ppv
);
73 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
77 static ULONG WINAPI
HTMLWindow2_AddRef(IHTMLWindow2
*iface
)
79 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
80 LONG ref
= InterlockedIncrement(&This
->ref
);
82 TRACE("(%p) ref=%d\n", This
, ref
);
87 static ULONG WINAPI
HTMLWindow2_Release(IHTMLWindow2
*iface
)
89 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
90 LONG ref
= InterlockedDecrement(&This
->ref
);
92 TRACE("(%p) ref=%d\n", This
, ref
);
95 list_remove(&This
->entry
);
102 static HRESULT WINAPI
HTMLWindow2_GetTypeInfoCount(IHTMLWindow2
*iface
, UINT
*pctinfo
)
104 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
106 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
109 static HRESULT WINAPI
HTMLWindow2_GetTypeInfo(IHTMLWindow2
*iface
, UINT iTInfo
,
110 LCID lcid
, ITypeInfo
**ppTInfo
)
112 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
114 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
117 static HRESULT WINAPI
HTMLWindow2_GetIDsOfNames(IHTMLWindow2
*iface
, REFIID riid
,
118 LPOLESTR
*rgszNames
, UINT cNames
,
119 LCID lcid
, DISPID
*rgDispId
)
121 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
123 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
126 static HRESULT WINAPI
HTMLWindow2_Invoke(IHTMLWindow2
*iface
, DISPID dispIdMember
,
127 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
128 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
130 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
132 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
133 pVarResult
, pExcepInfo
, puArgErr
);
136 static HRESULT WINAPI
HTMLWindow2_item(IHTMLWindow2
*iface
, VARIANT
*pvarIndex
, VARIANT
*pvarResult
)
138 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
139 FIXME("(%p)->(%p %p)\n", This
, pvarIndex
, pvarResult
);
143 static HRESULT WINAPI
HTMLWindow2_get_length(IHTMLWindow2
*iface
, long *p
)
145 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
146 FIXME("(%p)->(%p)\n", This
, p
);
150 static HRESULT WINAPI
HTMLWindow2_get_frames(IHTMLWindow2
*iface
, IHTMLFramesCollection2
**p
)
152 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
153 FIXME("(%p)->(%p)\n", This
, p
);
157 static HRESULT WINAPI
HTMLWindow2_put_defaultStatus(IHTMLWindow2
*iface
, BSTR v
)
159 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
160 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
164 static HRESULT WINAPI
HTMLWindow2_get_defaultStatus(IHTMLWindow2
*iface
, BSTR
*p
)
166 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
167 FIXME("(%p)->(%p)\n", This
, p
);
171 static HRESULT WINAPI
HTMLWindow2_put_status(IHTMLWindow2
*iface
, BSTR v
)
173 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
174 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
178 static HRESULT WINAPI
HTMLWindow2_get_status(IHTMLWindow2
*iface
, BSTR
*p
)
180 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
181 FIXME("(%p)->(%p)\n", This
, p
);
185 static HRESULT WINAPI
HTMLWindow2_setTimeout(IHTMLWindow2
*iface
, BSTR expression
,
186 long msec
, VARIANT
*language
, long *timerID
)
188 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
191 TRACE("(%p)->(%s %ld %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
193 V_VT(&expr_var
) = VT_BSTR
;
194 V_BSTR(&expr_var
) = expression
;
196 return IHTMLWindow3_setTimeout(HTMLWINDOW3(This
), &expr_var
, msec
, language
, timerID
);
199 static HRESULT WINAPI
HTMLWindow2_clearTimeout(IHTMLWindow2
*iface
, long timerID
)
201 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
203 TRACE("(%p)->(%ld)\n", This
, timerID
);
205 return clear_task_timer(This
->doc
, FALSE
, timerID
);
208 static HRESULT WINAPI
HTMLWindow2_alert(IHTMLWindow2
*iface
, BSTR message
)
210 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
213 TRACE("(%p)->(%s)\n", This
, debugstr_w(message
));
215 if(!LoadStringW(get_shdoclc(), IDS_MESSAGE_BOX_TITLE
, wszTitle
,
216 sizeof(wszTitle
)/sizeof(WCHAR
))) {
217 WARN("Could not load message box title: %d\n", GetLastError());
221 MessageBoxW(This
->doc
->hwnd
, message
, wszTitle
, MB_ICONWARNING
);
225 static HRESULT WINAPI
HTMLWindow2_confirm(IHTMLWindow2
*iface
, BSTR message
,
226 VARIANT_BOOL
*confirmed
)
228 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
229 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(message
), confirmed
);
233 static HRESULT WINAPI
HTMLWindow2_prompt(IHTMLWindow2
*iface
, BSTR message
,
234 BSTR dststr
, VARIANT
*textdata
)
236 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
237 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(message
), debugstr_w(dststr
), textdata
);
241 static HRESULT WINAPI
HTMLWindow2_get_Image(IHTMLWindow2
*iface
, IHTMLImageElementFactory
**p
)
243 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
244 FIXME("(%p)->(%p)\n", This
, p
);
248 static HRESULT WINAPI
HTMLWindow2_get_location(IHTMLWindow2
*iface
, IHTMLLocation
**p
)
250 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
251 FIXME("(%p)->(%p)\n", This
, p
);
255 static HRESULT WINAPI
HTMLWindow2_get_history(IHTMLWindow2
*iface
, IOmHistory
**p
)
257 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
258 FIXME("(%p)->(%p)\n", This
, p
);
262 static HRESULT WINAPI
HTMLWindow2_close(IHTMLWindow2
*iface
)
264 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
265 FIXME("(%p)->()\n", This
);
269 static HRESULT WINAPI
HTMLWindow2_put_opener(IHTMLWindow2
*iface
, VARIANT v
)
271 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
272 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
276 static HRESULT WINAPI
HTMLWindow2_get_opener(IHTMLWindow2
*iface
, VARIANT
*p
)
278 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
279 FIXME("(%p)->(%p)\n", This
, p
);
283 static HRESULT WINAPI
HTMLWindow2_get_navigator(IHTMLWindow2
*iface
, IOmNavigator
**p
)
285 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
287 TRACE("(%p)->(%p)\n", This
, p
);
289 *p
= OmNavigator_Create();
293 static HRESULT WINAPI
HTMLWindow2_put_name(IHTMLWindow2
*iface
, BSTR v
)
295 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
296 FIXME("(%p)->(%s)\n", This
, debugstr_w(v
));
300 static HRESULT WINAPI
HTMLWindow2_get_name(IHTMLWindow2
*iface
, BSTR
*p
)
302 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
303 FIXME("(%p)->(%p)\n", This
, p
);
307 static HRESULT WINAPI
HTMLWindow2_get_parent(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
309 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
310 FIXME("(%p)->(%p)\n", This
, p
);
314 static HRESULT WINAPI
HTMLWindow2_open(IHTMLWindow2
*iface
, BSTR url
, BSTR name
,
315 BSTR features
, VARIANT_BOOL replace
, IHTMLWindow2
**pomWindowResult
)
317 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
318 FIXME("(%p)->(%s %s %s %x %p)\n", This
, debugstr_w(url
), debugstr_w(name
),
319 debugstr_w(features
), replace
, pomWindowResult
);
323 static HRESULT WINAPI
HTMLWindow2_get_self(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
325 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
327 TRACE("(%p)->(%p)\n", This
, p
);
329 /* FIXME: We should return kind of proxy window here. */
330 IHTMLWindow2_AddRef(HTMLWINDOW2(This
));
331 *p
= HTMLWINDOW2(This
);
335 static HRESULT WINAPI
HTMLWindow2_get_top(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
337 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
338 FIXME("(%p)->(%p)\n", This
, p
);
342 static HRESULT WINAPI
HTMLWindow2_get_window(IHTMLWindow2
*iface
, IHTMLWindow2
**p
)
344 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
346 TRACE("(%p)->(%p)\n", This
, p
);
348 /* FIXME: We should return kind of proxy window here. */
349 IHTMLWindow2_AddRef(HTMLWINDOW2(This
));
350 *p
= HTMLWINDOW2(This
);
354 static HRESULT WINAPI
HTMLWindow2_navigate(IHTMLWindow2
*iface
, BSTR url
)
356 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
357 FIXME("(%p)->(%s)\n", This
, debugstr_w(url
));
361 static HRESULT WINAPI
HTMLWindow2_put_onfocus(IHTMLWindow2
*iface
, VARIANT v
)
363 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
364 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
368 static HRESULT WINAPI
HTMLWindow2_get_onfocus(IHTMLWindow2
*iface
, VARIANT
*p
)
370 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
371 FIXME("(%p)->(%p)\n", This
, p
);
375 static HRESULT WINAPI
HTMLWindow2_put_onblur(IHTMLWindow2
*iface
, VARIANT v
)
377 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
378 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
382 static HRESULT WINAPI
HTMLWindow2_get_onblur(IHTMLWindow2
*iface
, VARIANT
*p
)
384 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
385 FIXME("(%p)->(%p)\n", This
, p
);
389 static HRESULT WINAPI
HTMLWindow2_put_onload(IHTMLWindow2
*iface
, VARIANT v
)
391 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
392 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
396 static HRESULT WINAPI
HTMLWindow2_get_onload(IHTMLWindow2
*iface
, VARIANT
*p
)
398 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
399 FIXME("(%p)->(%p)\n", This
, p
);
403 static HRESULT WINAPI
HTMLWindow2_put_onbeforeunload(IHTMLWindow2
*iface
, VARIANT v
)
405 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
406 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
410 static HRESULT WINAPI
HTMLWindow2_get_onbeforeunload(IHTMLWindow2
*iface
, VARIANT
*p
)
412 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
413 FIXME("(%p)->(%p)\n", This
, p
);
417 static HRESULT WINAPI
HTMLWindow2_put_onunload(IHTMLWindow2
*iface
, VARIANT v
)
419 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
420 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
424 static HRESULT WINAPI
HTMLWindow2_get_onunload(IHTMLWindow2
*iface
, VARIANT
*p
)
426 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
427 FIXME("(%p)->(%p)\n", This
, p
);
431 static HRESULT WINAPI
HTMLWindow2_put_onhelp(IHTMLWindow2
*iface
, VARIANT v
)
433 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
434 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
438 static HRESULT WINAPI
HTMLWindow2_get_onhelp(IHTMLWindow2
*iface
, VARIANT
*p
)
440 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
441 FIXME("(%p)->(%p)\n", This
, p
);
445 static HRESULT WINAPI
HTMLWindow2_put_onerror(IHTMLWindow2
*iface
, VARIANT v
)
447 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
448 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
452 static HRESULT WINAPI
HTMLWindow2_get_onerror(IHTMLWindow2
*iface
, VARIANT
*p
)
454 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
455 FIXME("(%p)->(%p)\n", This
, p
);
459 static HRESULT WINAPI
HTMLWindow2_put_onresize(IHTMLWindow2
*iface
, VARIANT v
)
461 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
462 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
466 static HRESULT WINAPI
HTMLWindow2_get_onresize(IHTMLWindow2
*iface
, VARIANT
*p
)
468 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
469 FIXME("(%p)->(%p)\n", This
, p
);
473 static HRESULT WINAPI
HTMLWindow2_put_onscroll(IHTMLWindow2
*iface
, VARIANT v
)
475 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
476 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
480 static HRESULT WINAPI
HTMLWindow2_get_onscroll(IHTMLWindow2
*iface
, VARIANT
*p
)
482 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
483 FIXME("(%p)->(%p)\n", This
, p
);
487 static HRESULT WINAPI
HTMLWindow2_get_document(IHTMLWindow2
*iface
, IHTMLDocument2
**p
)
489 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
491 TRACE("(%p)->(%p)\n", This
, p
);
494 /* FIXME: We should return a wrapper object here */
495 *p
= HTMLDOC(This
->doc
);
496 IHTMLDocument2_AddRef(*p
);
504 static HRESULT WINAPI
HTMLWindow2_get_event(IHTMLWindow2
*iface
, IHTMLEventObj
**p
)
506 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
507 FIXME("(%p)->(%p)\n", This
, p
);
511 static HRESULT WINAPI
HTMLWindow2_get__newEnum(IHTMLWindow2
*iface
, IUnknown
**p
)
513 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
514 FIXME("(%p)->(%p)\n", This
, p
);
518 static HRESULT WINAPI
HTMLWindow2_showModalDialog(IHTMLWindow2
*iface
, BSTR dialog
,
519 VARIANT
*varArgIn
, VARIANT
*varOptions
, VARIANT
*varArgOut
)
521 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
522 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(dialog
), varArgIn
, varOptions
, varArgOut
);
526 static HRESULT WINAPI
HTMLWindow2_showHelp(IHTMLWindow2
*iface
, BSTR helpURL
, VARIANT helpArg
,
529 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
530 FIXME("(%p)->(%s v(%d) %s)\n", This
, debugstr_w(helpURL
), V_VT(&helpArg
), debugstr_w(features
));
534 static HRESULT WINAPI
HTMLWindow2_get_screen(IHTMLWindow2
*iface
, IHTMLScreen
**p
)
536 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
537 FIXME("(%p)->(%p)\n", This
, p
);
541 static HRESULT WINAPI
HTMLWindow2_get_Option(IHTMLWindow2
*iface
, IHTMLOptionElementFactory
**p
)
543 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
545 TRACE("(%p)->(%p)\n", This
, p
);
547 if(!This
->doc
->option_factory
)
548 This
->doc
->option_factory
= HTMLOptionElementFactory_Create(This
->doc
);
550 *p
= HTMLOPTFACTORY(This
->doc
->option_factory
);
551 IHTMLOptionElementFactory_AddRef(*p
);
556 static HRESULT WINAPI
HTMLWindow2_focus(IHTMLWindow2
*iface
)
558 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
559 FIXME("(%p)->()\n", This
);
563 static HRESULT WINAPI
HTMLWindow2_get_closed(IHTMLWindow2
*iface
, VARIANT_BOOL
*p
)
565 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
566 FIXME("(%p)->(%p)\n", This
, p
);
570 static HRESULT WINAPI
HTMLWindow2_blur(IHTMLWindow2
*iface
)
572 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
573 FIXME("(%p)->()\n", This
);
577 static HRESULT WINAPI
HTMLWindow2_scroll(IHTMLWindow2
*iface
, long x
, long y
)
579 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
580 FIXME("(%p)->(%ld %ld)\n", This
, x
, y
);
584 static HRESULT WINAPI
HTMLWindow2_get_clientInformation(IHTMLWindow2
*iface
, IOmNavigator
**p
)
586 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
587 FIXME("(%p)->(%p)\n", This
, p
);
591 static HRESULT WINAPI
HTMLWindow2_setInterval(IHTMLWindow2
*iface
, BSTR expression
,
592 long msec
, VARIANT
*language
, long *timerID
)
594 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
597 TRACE("(%p)->(%s %ld %p %p)\n", This
, debugstr_w(expression
), msec
, language
, timerID
);
599 V_VT(&expr
) = VT_BSTR
;
600 V_BSTR(&expr
) = expression
;
601 return IHTMLWindow3_setInterval(HTMLWINDOW3(This
), &expr
, msec
, language
, timerID
);
604 static HRESULT WINAPI
HTMLWindow2_clearInterval(IHTMLWindow2
*iface
, long timerID
)
606 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
608 TRACE("(%p)->(%ld)\n", This
, timerID
);
610 return clear_task_timer(This
->doc
, TRUE
, timerID
);
613 static HRESULT WINAPI
HTMLWindow2_put_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT v
)
615 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
616 FIXME("(%p)->(v(%d))\n", This
, V_VT(&v
));
620 static HRESULT WINAPI
HTMLWindow2_get_offscreenBuffering(IHTMLWindow2
*iface
, VARIANT
*p
)
622 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
623 FIXME("(%p)->(%p)\n", This
, p
);
627 static HRESULT WINAPI
HTMLWindow2_execScript(IHTMLWindow2
*iface
, BSTR scode
, BSTR language
,
630 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
631 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_w(scode
), debugstr_w(language
), pvarRet
);
635 static HRESULT WINAPI
HTMLWindow2_toString(IHTMLWindow2
*iface
, BSTR
*String
)
637 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
638 FIXME("(%p)->(%p)\n", This
, String
);
642 static HRESULT WINAPI
HTMLWindow2_scrollBy(IHTMLWindow2
*iface
, long x
, long y
)
644 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
647 TRACE("(%p)->(%ld %ld)\n", This
, x
, y
);
649 nsres
= nsIDOMWindow_ScrollBy(This
->nswindow
, x
, y
);
651 ERR("ScrollBy failed: %08x\n", nsres
);
656 static HRESULT WINAPI
HTMLWindow2_scrollTo(IHTMLWindow2
*iface
, long x
, long y
)
658 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
661 TRACE("(%p)->(%ld %ld)\n", This
, x
, y
);
663 nsres
= nsIDOMWindow_ScrollTo(This
->nswindow
, x
, y
);
665 ERR("ScrollTo failed: %08x\n", nsres
);
670 static HRESULT WINAPI
HTMLWindow2_moveTo(IHTMLWindow2
*iface
, long x
, long y
)
672 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
673 FIXME("(%p)->(%ld %ld)\n", This
, x
, y
);
677 static HRESULT WINAPI
HTMLWindow2_moveBy(IHTMLWindow2
*iface
, long x
, long y
)
679 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
680 FIXME("(%p)->(%ld %ld)\n", This
, x
, y
);
684 static HRESULT WINAPI
HTMLWindow2_resizeTo(IHTMLWindow2
*iface
, long x
, long y
)
686 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
687 FIXME("(%p)->(%ld %ld)\n", This
, x
, y
);
691 static HRESULT WINAPI
HTMLWindow2_resizeBy(IHTMLWindow2
*iface
, long x
, long y
)
693 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
694 FIXME("(%p)->(%ld %ld)\n", This
, x
, y
);
698 static HRESULT WINAPI
HTMLWindow2_get_external(IHTMLWindow2
*iface
, IDispatch
**p
)
700 HTMLWindow
*This
= HTMLWINDOW2_THIS(iface
);
702 TRACE("(%p)->(%p)\n", This
, p
);
706 if(!This
->doc
->hostui
)
709 return IDocHostUIHandler_GetExternal(This
->doc
->hostui
, p
);
712 #undef HTMLWINDOW2_THIS
714 static const IHTMLWindow2Vtbl HTMLWindow2Vtbl
= {
715 HTMLWindow2_QueryInterface
,
718 HTMLWindow2_GetTypeInfoCount
,
719 HTMLWindow2_GetTypeInfo
,
720 HTMLWindow2_GetIDsOfNames
,
723 HTMLWindow2_get_length
,
724 HTMLWindow2_get_frames
,
725 HTMLWindow2_put_defaultStatus
,
726 HTMLWindow2_get_defaultStatus
,
727 HTMLWindow2_put_status
,
728 HTMLWindow2_get_status
,
729 HTMLWindow2_setTimeout
,
730 HTMLWindow2_clearTimeout
,
734 HTMLWindow2_get_Image
,
735 HTMLWindow2_get_location
,
736 HTMLWindow2_get_history
,
738 HTMLWindow2_put_opener
,
739 HTMLWindow2_get_opener
,
740 HTMLWindow2_get_navigator
,
741 HTMLWindow2_put_name
,
742 HTMLWindow2_get_name
,
743 HTMLWindow2_get_parent
,
745 HTMLWindow2_get_self
,
747 HTMLWindow2_get_window
,
748 HTMLWindow2_navigate
,
749 HTMLWindow2_put_onfocus
,
750 HTMLWindow2_get_onfocus
,
751 HTMLWindow2_put_onblur
,
752 HTMLWindow2_get_onblur
,
753 HTMLWindow2_put_onload
,
754 HTMLWindow2_get_onload
,
755 HTMLWindow2_put_onbeforeunload
,
756 HTMLWindow2_get_onbeforeunload
,
757 HTMLWindow2_put_onunload
,
758 HTMLWindow2_get_onunload
,
759 HTMLWindow2_put_onhelp
,
760 HTMLWindow2_get_onhelp
,
761 HTMLWindow2_put_onerror
,
762 HTMLWindow2_get_onerror
,
763 HTMLWindow2_put_onresize
,
764 HTMLWindow2_get_onresize
,
765 HTMLWindow2_put_onscroll
,
766 HTMLWindow2_get_onscroll
,
767 HTMLWindow2_get_document
,
768 HTMLWindow2_get_event
,
769 HTMLWindow2_get__newEnum
,
770 HTMLWindow2_showModalDialog
,
771 HTMLWindow2_showHelp
,
772 HTMLWindow2_get_screen
,
773 HTMLWindow2_get_Option
,
775 HTMLWindow2_get_closed
,
778 HTMLWindow2_get_clientInformation
,
779 HTMLWindow2_setInterval
,
780 HTMLWindow2_clearInterval
,
781 HTMLWindow2_put_offscreenBuffering
,
782 HTMLWindow2_get_offscreenBuffering
,
783 HTMLWindow2_execScript
,
784 HTMLWindow2_toString
,
785 HTMLWindow2_scrollBy
,
786 HTMLWindow2_scrollTo
,
789 HTMLWindow2_resizeTo
,
790 HTMLWindow2_resizeBy
,
791 HTMLWindow2_get_external
794 #define HTMLWINDOW3_THIS(iface) DEFINE_THIS(HTMLWindow, HTMLWindow3, iface)
796 static HRESULT WINAPI
HTMLWindow3_QueryInterface(IHTMLWindow3
*iface
, REFIID riid
, void **ppv
)
798 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
800 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This
), riid
, ppv
);
803 static ULONG WINAPI
HTMLWindow3_AddRef(IHTMLWindow3
*iface
)
805 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
807 return IHTMLWindow2_AddRef(HTMLWINDOW2(This
));
810 static ULONG WINAPI
HTMLWindow3_Release(IHTMLWindow3
*iface
)
812 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
814 return IHTMLWindow2_Release(HTMLWINDOW2(This
));
817 static HRESULT WINAPI
HTMLWindow3_GetTypeInfoCount(IHTMLWindow3
*iface
, UINT
*pctinfo
)
819 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
821 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This
), pctinfo
);
824 static HRESULT WINAPI
HTMLWindow3_GetTypeInfo(IHTMLWindow3
*iface
, UINT iTInfo
,
825 LCID lcid
, ITypeInfo
**ppTInfo
)
827 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
829 return IDispatchEx_GetTypeInfo(DISPATCHEX(This
), iTInfo
, lcid
, ppTInfo
);
832 static HRESULT WINAPI
HTMLWindow3_GetIDsOfNames(IHTMLWindow3
*iface
, REFIID riid
,
833 LPOLESTR
*rgszNames
, UINT cNames
,
834 LCID lcid
, DISPID
*rgDispId
)
836 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
838 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
841 static HRESULT WINAPI
HTMLWindow3_Invoke(IHTMLWindow3
*iface
, DISPID dispIdMember
,
842 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
843 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
845 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
847 return IDispatchEx_Invoke(DISPATCHEX(This
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
848 pVarResult
, pExcepInfo
, puArgErr
);
851 static HRESULT WINAPI
HTMLWindow3_get_screenLeft(IHTMLWindow3
*iface
, long *p
)
853 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
854 FIXME("(%p)->(%p)\n", This
, p
);
858 static HRESULT WINAPI
HTMLWindow3_get_screenTop(IHTMLWindow3
*iface
, long *p
)
860 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
861 FIXME("(%p)->(%p)\n", This
, p
);
865 static HRESULT WINAPI
HTMLWindow3_attachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
, VARIANT_BOOL
*pfResult
)
867 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
868 FIXME("(%p)->(%s %p %p)\n", This
, debugstr_w(event
), pDisp
, pfResult
);
872 static HRESULT WINAPI
HTMLWindow3_detachEvent(IHTMLWindow3
*iface
, BSTR event
, IDispatch
*pDisp
)
874 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
875 FIXME("(%p)->()\n", This
);
879 static HRESULT
window_set_timer(HTMLWindow
*This
, VARIANT
*expr
, long msec
, VARIANT
*language
,
880 BOOL interval
, long *timer_id
)
882 IDispatch
*disp
= NULL
;
886 disp
= V_DISPATCH(expr
);
887 IDispatch_AddRef(disp
);
891 disp
= script_parse_event(This
->doc
, V_BSTR(expr
));
895 FIXME("unimplemented vt=%d\n", V_VT(expr
));
902 *timer_id
= set_task_timer(This
->doc
, msec
, interval
, disp
);
903 IDispatch_Release(disp
);
908 static HRESULT WINAPI
HTMLWindow3_setTimeout(IHTMLWindow3
*iface
, VARIANT
*expression
, long msec
,
909 VARIANT
*language
, long *timerID
)
911 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
913 TRACE("(%p)->(%p(%d) %ld %p %p)\n", This
, expression
, V_VT(expression
), msec
, language
, timerID
);
915 return window_set_timer(This
, expression
, msec
, language
, FALSE
, timerID
);
918 static HRESULT WINAPI
HTMLWindow3_setInterval(IHTMLWindow3
*iface
, VARIANT
*expression
, long msec
,
919 VARIANT
*language
, long *timerID
)
921 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
923 TRACE("(%p)->(%p %ld %p %p)\n", This
, expression
, msec
, language
, timerID
);
925 return window_set_timer(This
, expression
, msec
, language
, TRUE
, timerID
);
928 static HRESULT WINAPI
HTMLWindow3_print(IHTMLWindow3
*iface
)
930 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
931 FIXME("(%p)\n", This
);
935 static HRESULT WINAPI
HTMLWindow3_put_onbeforeprint(IHTMLWindow3
*iface
, VARIANT v
)
937 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
938 FIXME("(%p)->()\n", This
);
942 static HRESULT WINAPI
HTMLWindow3_get_onbeforeprint(IHTMLWindow3
*iface
, VARIANT
*p
)
944 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
945 FIXME("(%p)->(%p)\n", This
, p
);
949 static HRESULT WINAPI
HTMLWindow3_put_onafterprint(IHTMLWindow3
*iface
, VARIANT v
)
951 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
952 FIXME("(%p)->()\n", This
);
956 static HRESULT WINAPI
HTMLWindow3_get_onafterprint(IHTMLWindow3
*iface
, VARIANT
*p
)
958 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
959 FIXME("(%p)->(%p)\n", This
, p
);
963 static HRESULT WINAPI
HTMLWindow3_get_clipboardData(IHTMLWindow3
*iface
, IHTMLDataTransfer
**p
)
965 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
966 FIXME("(%p)->(%p)\n", This
, p
);
970 static HRESULT WINAPI
HTMLWindow3_showModelessDialog(IHTMLWindow3
*iface
, BSTR url
,
971 VARIANT
*varArgIn
, VARIANT
*options
, IHTMLWindow2
**pDialog
)
973 HTMLWindow
*This
= HTMLWINDOW3_THIS(iface
);
974 FIXME("(%p)->(%s %p %p %p)\n", This
, debugstr_w(url
), varArgIn
, options
, pDialog
);
978 #undef HTMLWINDOW3_THIS
980 static const IHTMLWindow3Vtbl HTMLWindow3Vtbl
= {
981 HTMLWindow3_QueryInterface
,
984 HTMLWindow3_GetTypeInfoCount
,
985 HTMLWindow3_GetTypeInfo
,
986 HTMLWindow3_GetIDsOfNames
,
988 HTMLWindow3_get_screenLeft
,
989 HTMLWindow3_get_screenTop
,
990 HTMLWindow3_attachEvent
,
991 HTMLWindow3_detachEvent
,
992 HTMLWindow3_setTimeout
,
993 HTMLWindow3_setInterval
,
995 HTMLWindow3_put_onbeforeprint
,
996 HTMLWindow3_get_onbeforeprint
,
997 HTMLWindow3_put_onafterprint
,
998 HTMLWindow3_get_onafterprint
,
999 HTMLWindow3_get_clipboardData
,
1000 HTMLWindow3_showModelessDialog
1003 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLWindow, IDispatchEx, iface)
1005 static HRESULT WINAPI
WindowDispEx_QueryInterface(IDispatchEx
*iface
, REFIID riid
, void **ppv
)
1007 HTMLWindow
*This
= DISPEX_THIS(iface
);
1009 return IHTMLWindow2_QueryInterface(HTMLWINDOW2(This
), riid
, ppv
);
1012 static ULONG WINAPI
WindowDispEx_AddRef(IDispatchEx
*iface
)
1014 HTMLWindow
*This
= DISPEX_THIS(iface
);
1016 return IHTMLWindow2_AddRef(HTMLWINDOW2(This
));
1019 static ULONG WINAPI
WindowDispEx_Release(IDispatchEx
*iface
)
1021 HTMLWindow
*This
= DISPEX_THIS(iface
);
1023 return IHTMLWindow2_Release(HTMLWINDOW2(This
));
1026 static HRESULT WINAPI
WindowDispEx_GetTypeInfoCount(IDispatchEx
*iface
, UINT
*pctinfo
)
1028 HTMLWindow
*This
= DISPEX_THIS(iface
);
1030 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1032 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This
->dispex
), pctinfo
);
1035 static HRESULT WINAPI
WindowDispEx_GetTypeInfo(IDispatchEx
*iface
, UINT iTInfo
,
1036 LCID lcid
, ITypeInfo
**ppTInfo
)
1038 HTMLWindow
*This
= DISPEX_THIS(iface
);
1040 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1042 return IDispatchEx_GetTypeInfo(DISPATCHEX(&This
->dispex
), iTInfo
, lcid
, ppTInfo
);
1045 static HRESULT WINAPI
WindowDispEx_GetIDsOfNames(IDispatchEx
*iface
, REFIID riid
,
1046 LPOLESTR
*rgszNames
, UINT cNames
,
1047 LCID lcid
, DISPID
*rgDispId
)
1049 HTMLWindow
*This
= DISPEX_THIS(iface
);
1051 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
1054 /* FIXME: Use script dispatch */
1056 return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This
->dispex
), riid
, rgszNames
, cNames
, lcid
, rgDispId
);
1059 static HRESULT WINAPI
WindowDispEx_Invoke(IDispatchEx
*iface
, DISPID dispIdMember
,
1060 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1061 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
1063 HTMLWindow
*This
= DISPEX_THIS(iface
);
1065 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1066 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1068 /* FIXME: Use script dispatch */
1070 return IDispatchEx_Invoke(DISPATCHEX(&This
->dispex
), dispIdMember
, riid
, lcid
, wFlags
, pDispParams
,
1071 pVarResult
, pExcepInfo
, puArgErr
);
1074 static HRESULT WINAPI
WindowDispEx_GetDispID(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
, DISPID
*pid
)
1076 HTMLWindow
*This
= DISPEX_THIS(iface
);
1078 TRACE("(%p)->(%s %x %p)\n", This
, debugstr_w(bstrName
), grfdex
, pid
);
1080 return IDispatchEx_GetDispID(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
, pid
);
1083 static HRESULT WINAPI
WindowDispEx_InvokeEx(IDispatchEx
*iface
, DISPID id
, LCID lcid
, WORD wFlags
, DISPPARAMS
*pdp
,
1084 VARIANT
*pvarRes
, EXCEPINFO
*pei
, IServiceProvider
*pspCaller
)
1086 HTMLWindow
*This
= DISPEX_THIS(iface
);
1088 TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This
, id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1090 return IDispatchEx_InvokeEx(DISPATCHEX(&This
->dispex
), id
, lcid
, wFlags
, pdp
, pvarRes
, pei
, pspCaller
);
1093 static HRESULT WINAPI
WindowDispEx_DeleteMemberByName(IDispatchEx
*iface
, BSTR bstrName
, DWORD grfdex
)
1095 HTMLWindow
*This
= DISPEX_THIS(iface
);
1097 TRACE("(%p)->(%s %x)\n", This
, debugstr_w(bstrName
), grfdex
);
1099 return IDispatchEx_DeleteMemberByName(DISPATCHEX(&This
->dispex
), bstrName
, grfdex
);
1102 static HRESULT WINAPI
WindowDispEx_DeleteMemberByDispID(IDispatchEx
*iface
, DISPID id
)
1104 HTMLWindow
*This
= DISPEX_THIS(iface
);
1106 TRACE("(%p)->(%x)\n", This
, id
);
1108 return IDispatchEx_DeleteMemberByDispID(DISPATCHEX(&This
->dispex
), id
);
1111 static HRESULT WINAPI
WindowDispEx_GetMemberProperties(IDispatchEx
*iface
, DISPID id
, DWORD grfdexFetch
, DWORD
*pgrfdex
)
1113 HTMLWindow
*This
= DISPEX_THIS(iface
);
1115 TRACE("(%p)->(%x %x %p)\n", This
, id
, grfdexFetch
, pgrfdex
);
1117 return IDispatchEx_GetMemberProperties(DISPATCHEX(&This
->dispex
), id
, grfdexFetch
, pgrfdex
);
1120 static HRESULT WINAPI
WindowDispEx_GetMemberName(IDispatchEx
*iface
, DISPID id
, BSTR
*pbstrName
)
1122 HTMLWindow
*This
= DISPEX_THIS(iface
);
1124 TRACE("(%p)->(%x %p)\n", This
, id
, pbstrName
);
1126 return IDispatchEx_GetMemberName(DISPATCHEX(&This
->dispex
), id
, pbstrName
);
1129 static HRESULT WINAPI
WindowDispEx_GetNextDispID(IDispatchEx
*iface
, DWORD grfdex
, DISPID id
, DISPID
*pid
)
1131 HTMLWindow
*This
= DISPEX_THIS(iface
);
1133 TRACE("(%p)->(%x %x %p)\n", This
, grfdex
, id
, pid
);
1135 return IDispatchEx_GetNextDispID(DISPATCHEX(&This
->dispex
), grfdex
, id
, pid
);
1138 static HRESULT WINAPI
WindowDispEx_GetNameSpaceParent(IDispatchEx
*iface
, IUnknown
**ppunk
)
1140 HTMLWindow
*This
= DISPEX_THIS(iface
);
1142 TRACE("(%p)->(%p)\n", This
, ppunk
);
1150 static const IDispatchExVtbl WindowDispExVtbl
= {
1151 WindowDispEx_QueryInterface
,
1152 WindowDispEx_AddRef
,
1153 WindowDispEx_Release
,
1154 WindowDispEx_GetTypeInfoCount
,
1155 WindowDispEx_GetTypeInfo
,
1156 WindowDispEx_GetIDsOfNames
,
1157 WindowDispEx_Invoke
,
1158 WindowDispEx_GetDispID
,
1159 WindowDispEx_InvokeEx
,
1160 WindowDispEx_DeleteMemberByName
,
1161 WindowDispEx_DeleteMemberByDispID
,
1162 WindowDispEx_GetMemberProperties
,
1163 WindowDispEx_GetMemberName
,
1164 WindowDispEx_GetNextDispID
,
1165 WindowDispEx_GetNameSpaceParent
1168 static const tid_t HTMLWindow_iface_tids
[] = {
1173 static dispex_static_data_t HTMLWindow_dispex
= {
1175 DispHTMLWindow2_tid
,
1177 HTMLWindow_iface_tids
1180 static const char wineConfig_func
[] =
1181 "window.__defineGetter__(\"external\",function() {\n"
1182 " return window.__wineWindow__.external;\n"
1184 "window.__wineWindow__ = wineWindow;\n";
1186 static void astr_to_nswstr(const char *str
, nsAString
*nsstr
)
1191 len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
1192 wstr
= heap_alloc(len
*sizeof(WCHAR
));
1193 MultiByteToWideChar(CP_ACP
, 0, str
, -1, wstr
, len
);
1195 nsAString_Init(nsstr
, wstr
);
1200 static nsresult
call_js_func(nsIScriptContainer
*script_container
, nsISupports
*target
,
1201 const char *name
, const char *body
,
1202 PRUint32 argc
, const char **arg_names
, nsIArray
*argv
)
1204 nsACString name_str
;
1206 JSObject func_obj
, jsglobal
;
1210 nsres
= nsIScriptContainer_GetGlobalObject(script_container
, &jsglobal
);
1211 if(NS_FAILED(nsres
))
1212 ERR("GetGlobalObject: %08x\n", nsres
);
1214 nsACString_Init(&name_str
, name
);
1215 astr_to_nswstr(body
, &body_str
);
1217 nsres
= nsIScriptContainer_CompileFunction(script_container
, jsglobal
, &name_str
, argc
, arg_names
,
1218 &body_str
, NULL
, 1, FALSE
, &func_obj
);
1220 nsACString_Finish(&name_str
);
1221 nsAString_Finish(&body_str
);
1223 if(NS_FAILED(nsres
)) {
1224 ERR("CompileFunction failed: %08x\n", nsres
);
1228 nsres
= nsIScriptContainer_CallFunction(script_container
, target
, jsglobal
, func_obj
, argv
, &jsret
);
1230 nsIScriptContainer_DropScriptObject(script_container
, func_obj
);
1231 nsIScriptContainer_DropScriptObject(script_container
, jsglobal
);
1232 if(NS_FAILED(nsres
)) {
1233 ERR("CallFunction failed: %08x\n", nsres
);
1237 nsIVariant_Release(jsret
);
1241 void setup_nswindow(HTMLWindow
*This
)
1243 nsIScriptContainer
*script_container
;
1244 nsIDOMWindow
*nswindow
;
1245 nsIDOMDocument
*domdoc
;
1246 nsIWritableVariant
*nsvar
;
1247 nsIMutableArray
*argv
;
1250 static const char *args
[] = {"wineWindow"};
1252 TRACE("(%p)\n", This
);
1254 nsIWebNavigation_GetDocument(This
->doc
->nscontainer
->navigation
, &domdoc
);
1255 nsres
= nsIDOMDocument_QueryInterface(domdoc
, &IID_nsIScriptContainer
, (void**)&script_container
);
1256 nsIDOMDocument_Release(domdoc
);
1257 if(NS_FAILED(nsres
)) {
1258 TRACE("Could not get nsIDOMScriptContainer: %08x\n", nsres
);
1262 nsIWebBrowser_GetContentDOMWindow(This
->doc
->nscontainer
->webbrowser
, &nswindow
);
1264 nsvar
= create_nsvariant();
1265 nsres
= nsIWritableVariant_SetAsInterface(nsvar
, &IID_IDispatch
, HTMLWINDOW2(This
));
1266 if(NS_FAILED(nsres
))
1267 ERR("SetAsInterface failed: %08x\n", nsres
);
1269 argv
= create_nsarray();
1270 nsres
= nsIMutableArray_AppendElement(argv
, (nsISupports
*)nsvar
, FALSE
);
1271 nsIWritableVariant_Release(nsvar
);
1272 if(NS_FAILED(nsres
))
1273 ERR("AppendElement failed: %08x\n", nsres
);
1275 call_js_func(script_container
, (nsISupports
*)nswindow
/*HTMLWINDOW2(This)*/, "wineConfig",
1276 wineConfig_func
, 1, args
, (nsIArray
*)argv
);
1278 nsIMutableArray_Release(argv
);
1279 nsIScriptContainer_Release(script_container
);
1282 HTMLWindow
*HTMLWindow_Create(HTMLDocument
*doc
)
1284 HTMLWindow
*ret
= heap_alloc_zero(sizeof(HTMLWindow
));
1286 ret
->lpHTMLWindow2Vtbl
= &HTMLWindow2Vtbl
;
1287 ret
->lpHTMLWindow3Vtbl
= &HTMLWindow3Vtbl
;
1288 ret
->lpIDispatchExVtbl
= &WindowDispExVtbl
;
1292 init_dispex(&ret
->dispex
, (IUnknown
*)HTMLWINDOW2(ret
), &HTMLWindow_dispex
);
1294 if(doc
->nscontainer
) {
1297 nsres
= nsIWebBrowser_GetContentDOMWindow(doc
->nscontainer
->webbrowser
, &ret
->nswindow
);
1298 if(NS_FAILED(nsres
))
1299 ERR("GetContentDOMWindow failed: %08x\n", nsres
);
1302 list_add_head(&window_list
, &ret
->entry
);
1307 HTMLWindow
*nswindow_to_window(const nsIDOMWindow
*nswindow
)
1311 LIST_FOR_EACH_ENTRY(iter
, &window_list
, HTMLWindow
, entry
) {
1312 if(iter
->nswindow
== nswindow
)