2 * Copyright 2008 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 #include "wine/debug.h"
35 #include "mshtml_private.h"
36 #include "htmlscript.h"
37 #include "pluginhost.h"
38 #include "htmlevent.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
45 #define CTXARG_T DWORDLONG
46 #define IActiveScriptSiteDebugVtbl IActiveScriptSiteDebug64Vtbl
48 #define IActiveScriptParse_Release IActiveScriptParse64_Release
49 #define IActiveScriptParse_InitNew IActiveScriptParse64_InitNew
50 #define IActiveScriptParse_ParseScriptText IActiveScriptParse64_ParseScriptText
51 #define IActiveScriptParseProcedure2_Release IActiveScriptParseProcedure2_64_Release
52 #define IActiveScriptParseProcedure2_ParseProcedureText IActiveScriptParseProcedure2_64_ParseProcedureText
56 #define CTXARG_T DWORD
57 #define IActiveScriptSiteDebugVtbl IActiveScriptSiteDebug32Vtbl
59 #define IActiveScriptParse_Release IActiveScriptParse32_Release
60 #define IActiveScriptParse_InitNew IActiveScriptParse32_InitNew
61 #define IActiveScriptParse_ParseScriptText IActiveScriptParse32_ParseScriptText
62 #define IActiveScriptParseProcedure2_Release IActiveScriptParseProcedure2_32_Release
63 #define IActiveScriptParseProcedure2_ParseProcedureText IActiveScriptParseProcedure2_32_ParseProcedureText
67 static const WCHAR documentW
[] = {'d','o','c','u','m','e','n','t',0};
68 static const WCHAR windowW
[] = {'w','i','n','d','o','w',0};
69 static const WCHAR script_endW
[] = {'<','/','S','C','R','I','P','T','>',0};
70 static const WCHAR emptyW
[] = {0};
73 IActiveScriptSite IActiveScriptSite_iface
;
74 IActiveScriptSiteInterruptPoll IActiveScriptSiteInterruptPoll_iface
;
75 IActiveScriptSiteWindow IActiveScriptSiteWindow_iface
;
76 IActiveScriptSiteUIControl IActiveScriptSiteUIControl_iface
;
77 IActiveScriptSiteDebug IActiveScriptSiteDebug_iface
;
78 IServiceProvider IServiceProvider_iface
;
82 IActiveScript
*script
;
83 IActiveScriptParse
*parse
;
84 IActiveScriptParseProcedure2
*parse_proc
;
86 SCRIPTSTATE script_state
;
88 HTMLInnerWindow
*window
;
94 static void set_script_prop(ScriptHost
*script_host
, DWORD property
, VARIANT
*val
)
96 IActiveScriptProperty
*script_prop
;
99 hres
= IActiveScript_QueryInterface(script_host
->script
, &IID_IActiveScriptProperty
,
100 (void**)&script_prop
);
102 WARN("Could not get IActiveScriptProperty iface: %08x\n", hres
);
106 hres
= IActiveScriptProperty_SetProperty(script_prop
, property
, NULL
, val
);
107 IActiveScriptProperty_Release(script_prop
);
109 WARN("SetProperty(%x) failed: %08x\n", property
, hres
);
112 static BOOL
init_script_engine(ScriptHost
*script_host
)
114 IObjectSafety
*safety
;
116 DWORD supported_opts
=0, enabled_opts
=0;
120 hres
= IActiveScript_QueryInterface(script_host
->script
, &IID_IActiveScriptParse
, (void**)&script_host
->parse
);
122 WARN("Could not get IActiveScriptHost: %08x\n", hres
);
126 hres
= IActiveScript_QueryInterface(script_host
->script
, &IID_IObjectSafety
, (void**)&safety
);
128 FIXME("Could not get IObjectSafety: %08x\n", hres
);
132 hres
= IObjectSafety_GetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
, &supported_opts
, &enabled_opts
);
134 FIXME("GetInterfaceSafetyOptions failed: %08x\n", hres
);
135 }else if(!(supported_opts
& INTERFACE_USES_DISPEX
)) {
136 FIXME("INTERFACE_USES_DISPEX is not supported\n");
138 hres
= IObjectSafety_SetInterfaceSafetyOptions(safety
, &IID_IActiveScriptParse
,
139 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
,
140 INTERFACESAFE_FOR_UNTRUSTED_DATA
|INTERFACE_USES_DISPEX
|INTERFACE_USES_SECURITY_MANAGER
);
142 FIXME("SetInterfaceSafetyOptions failed: %08x\n", hres
);
145 IObjectSafety_Release(safety
);
151 set_script_prop(script_host
, SCRIPTPROP_INVOKEVERSIONING
, &var
);
153 V_VT(&var
) = VT_BOOL
;
154 V_BOOL(&var
) = VARIANT_TRUE
;
155 set_script_prop(script_host
, SCRIPTPROP_HACK_TRIDENTEVENTSINK
, &var
);
157 hres
= IActiveScriptParse_InitNew(script_host
->parse
);
159 WARN("InitNew failed: %08x\n", hres
);
163 hres
= IActiveScript_SetScriptSite(script_host
->script
, &script_host
->IActiveScriptSite_iface
);
165 WARN("SetScriptSite failed: %08x\n", hres
);
166 IActiveScript_Close(script_host
->script
);
170 hres
= IActiveScript_GetScriptState(script_host
->script
, &state
);
172 WARN("GetScriptState failed: %08x\n", hres
);
173 else if(state
!= SCRIPTSTATE_INITIALIZED
)
174 FIXME("state = %x\n", state
);
176 hres
= IActiveScript_SetScriptState(script_host
->script
, SCRIPTSTATE_STARTED
);
178 WARN("Starting script failed: %08x\n", hres
);
182 hres
= IActiveScript_AddNamedItem(script_host
->script
, windowW
,
183 SCRIPTITEM_ISVISIBLE
|SCRIPTITEM_ISSOURCE
|SCRIPTITEM_GLOBALMEMBERS
);
184 if(SUCCEEDED(hres
)) {
185 V_VT(&var
) = VT_BOOL
;
186 V_BOOL(&var
) = VARIANT_TRUE
;
187 set_script_prop(script_host
, SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION
, &var
);
189 WARN("AddNamedItem failed: %08x\n", hres
);
192 hres
= IActiveScript_QueryInterface(script_host
->script
, &IID_IActiveScriptParseProcedure2
,
193 (void**)&script_host
->parse_proc
);
195 /* FIXME: QI for IActiveScriptParseProcedure */
196 WARN("Could not get IActiveScriptParseProcedure iface: %08x\n", hres
);
202 static void release_script_engine(ScriptHost
*This
)
207 switch(This
->script_state
) {
208 case SCRIPTSTATE_CONNECTED
:
209 IActiveScript_SetScriptState(This
->script
, SCRIPTSTATE_DISCONNECTED
);
211 case SCRIPTSTATE_STARTED
:
212 case SCRIPTSTATE_DISCONNECTED
:
213 case SCRIPTSTATE_INITIALIZED
:
214 IActiveScript_Close(This
->script
);
217 if(This
->parse_proc
) {
218 IActiveScriptParseProcedure2_Release(This
->parse_proc
);
219 This
->parse_proc
= NULL
;
223 IActiveScriptParse_Release(This
->parse
);
228 IActiveScript_Release(This
->script
);
230 This
->script_state
= SCRIPTSTATE_UNINITIALIZED
;
233 void connect_scripts(HTMLInnerWindow
*window
)
237 LIST_FOR_EACH_ENTRY(iter
, &window
->script_hosts
, ScriptHost
, entry
) {
238 if(iter
->script_state
== SCRIPTSTATE_STARTED
)
239 IActiveScript_SetScriptState(iter
->script
, SCRIPTSTATE_CONNECTED
);
243 static inline ScriptHost
*impl_from_IActiveScriptSite(IActiveScriptSite
*iface
)
245 return CONTAINING_RECORD(iface
, ScriptHost
, IActiveScriptSite_iface
);
248 static HRESULT WINAPI
ActiveScriptSite_QueryInterface(IActiveScriptSite
*iface
, REFIID riid
, void **ppv
)
250 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
254 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
255 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
256 *ppv
= &This
->IActiveScriptSite_iface
;
257 }else if(IsEqualGUID(&IID_IActiveScriptSite
, riid
)) {
258 TRACE("(%p)->(IID_IActiveScriptSite %p)\n", This
, ppv
);
259 *ppv
= &This
->IActiveScriptSite_iface
;
260 }else if(IsEqualGUID(&IID_IActiveScriptSiteInterruptPoll
, riid
)) {
261 TRACE("(%p)->(IID_IActiveScriptSiteInterruprtPoll %p)\n", This
, ppv
);
262 *ppv
= &This
->IActiveScriptSiteInterruptPoll_iface
;
263 }else if(IsEqualGUID(&IID_IActiveScriptSiteWindow
, riid
)) {
264 TRACE("(%p)->(IID_IActiveScriptSiteWindow %p)\n", This
, ppv
);
265 *ppv
= &This
->IActiveScriptSiteWindow_iface
;
266 }else if(IsEqualGUID(&IID_IActiveScriptSiteUIControl
, riid
)) {
267 TRACE("(%p)->(IID_IActiveScriptSiteUIControl %p)\n", This
, ppv
);
268 *ppv
= &This
->IActiveScriptSiteUIControl_iface
;
269 }else if(IsEqualGUID(&IID_IActiveScriptSiteDebug
, riid
)) {
270 TRACE("(%p)->(IID_IActiveScriptSiteDebug %p)\n", This
, ppv
);
271 *ppv
= &This
->IActiveScriptSiteDebug_iface
;
272 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
273 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
274 *ppv
= &This
->IServiceProvider_iface
;
275 }else if(IsEqualGUID(&IID_ICanHandleException
, riid
)) {
276 TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This
, ppv
);
277 return E_NOINTERFACE
;
279 FIXME("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
280 return E_NOINTERFACE
;
283 IUnknown_AddRef((IUnknown
*)*ppv
);
287 static ULONG WINAPI
ActiveScriptSite_AddRef(IActiveScriptSite
*iface
)
289 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
290 LONG ref
= InterlockedIncrement(&This
->ref
);
292 TRACE("(%p) ref=%d\n", This
, ref
);
297 static ULONG WINAPI
ActiveScriptSite_Release(IActiveScriptSite
*iface
)
299 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
300 LONG ref
= InterlockedDecrement(&This
->ref
);
302 TRACE("(%p) ref=%d\n", This
, ref
);
305 release_script_engine(This
);
307 list_remove(&This
->entry
);
314 static HRESULT WINAPI
ActiveScriptSite_GetLCID(IActiveScriptSite
*iface
, LCID
*plcid
)
316 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
318 TRACE("(%p)->(%p)\n", This
, plcid
);
320 *plcid
= GetUserDefaultLCID();
324 static HRESULT WINAPI
ActiveScriptSite_GetItemInfo(IActiveScriptSite
*iface
, LPCOLESTR pstrName
,
325 DWORD dwReturnMask
, IUnknown
**ppiunkItem
, ITypeInfo
**ppti
)
327 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
329 TRACE("(%p)->(%s %x %p %p)\n", This
, debugstr_w(pstrName
), dwReturnMask
, ppiunkItem
, ppti
);
331 if(dwReturnMask
!= SCRIPTINFO_IUNKNOWN
) {
332 FIXME("Unsupported mask %x\n", dwReturnMask
);
338 if(strcmpW(pstrName
, windowW
))
339 return DISP_E_MEMBERNOTFOUND
;
344 /* FIXME: Return proxy object */
345 *ppiunkItem
= (IUnknown
*)&This
->window
->base
.IHTMLWindow2_iface
;
346 IUnknown_AddRef(*ppiunkItem
);
351 static HRESULT WINAPI
ActiveScriptSite_GetDocVersionString(IActiveScriptSite
*iface
, BSTR
*pbstrVersion
)
353 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
354 FIXME("(%p)->(%p)\n", This
, pbstrVersion
);
358 static HRESULT WINAPI
ActiveScriptSite_OnScriptTerminate(IActiveScriptSite
*iface
,
359 const VARIANT
*pvarResult
, const EXCEPINFO
*pexcepinfo
)
361 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
362 FIXME("(%p)->(%p %p)\n", This
, pvarResult
, pexcepinfo
);
366 static HRESULT WINAPI
ActiveScriptSite_OnStateChange(IActiveScriptSite
*iface
, SCRIPTSTATE ssScriptState
)
368 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
370 TRACE("(%p)->(%x)\n", This
, ssScriptState
);
372 This
->script_state
= ssScriptState
;
376 static HRESULT WINAPI
ActiveScriptSite_OnScriptError(IActiveScriptSite
*iface
, IActiveScriptError
*pscripterror
)
378 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
379 FIXME("(%p)->(%p)\n", This
, pscripterror
);
383 static HRESULT WINAPI
ActiveScriptSite_OnEnterScript(IActiveScriptSite
*iface
)
385 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
387 TRACE("(%p)->()\n", This
);
392 static HRESULT WINAPI
ActiveScriptSite_OnLeaveScript(IActiveScriptSite
*iface
)
394 ScriptHost
*This
= impl_from_IActiveScriptSite(iface
);
396 TRACE("(%p)->()\n", This
);
401 static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl
= {
402 ActiveScriptSite_QueryInterface
,
403 ActiveScriptSite_AddRef
,
404 ActiveScriptSite_Release
,
405 ActiveScriptSite_GetLCID
,
406 ActiveScriptSite_GetItemInfo
,
407 ActiveScriptSite_GetDocVersionString
,
408 ActiveScriptSite_OnScriptTerminate
,
409 ActiveScriptSite_OnStateChange
,
410 ActiveScriptSite_OnScriptError
,
411 ActiveScriptSite_OnEnterScript
,
412 ActiveScriptSite_OnLeaveScript
415 static inline ScriptHost
*impl_from_IActiveScriptSiteInterruptPoll(IActiveScriptSiteInterruptPoll
*iface
)
417 return CONTAINING_RECORD(iface
, ScriptHost
, IActiveScriptSiteInterruptPoll_iface
);
420 static HRESULT WINAPI
ActiveScriptSiteInterruptPoll_QueryInterface(IActiveScriptSiteInterruptPoll
*iface
,
421 REFIID riid
, void **ppv
)
423 ScriptHost
*This
= impl_from_IActiveScriptSiteInterruptPoll(iface
);
424 return IActiveScriptSite_QueryInterface(&This
->IActiveScriptSite_iface
, riid
, ppv
);
427 static ULONG WINAPI
ActiveScriptSiteInterruptPoll_AddRef(IActiveScriptSiteInterruptPoll
*iface
)
429 ScriptHost
*This
= impl_from_IActiveScriptSiteInterruptPoll(iface
);
430 return IActiveScriptSite_AddRef(&This
->IActiveScriptSite_iface
);
433 static ULONG WINAPI
ActiveScriptSiteInterruptPoll_Release(IActiveScriptSiteInterruptPoll
*iface
)
435 ScriptHost
*This
= impl_from_IActiveScriptSiteInterruptPoll(iface
);
436 return IActiveScriptSite_Release(&This
->IActiveScriptSite_iface
);
439 static HRESULT WINAPI
ActiveScriptSiteInterruptPoll_QueryContinue(IActiveScriptSiteInterruptPoll
*iface
)
441 ScriptHost
*This
= impl_from_IActiveScriptSiteInterruptPoll(iface
);
443 TRACE("(%p)\n", This
);
448 static const IActiveScriptSiteInterruptPollVtbl ActiveScriptSiteInterruptPollVtbl
= {
449 ActiveScriptSiteInterruptPoll_QueryInterface
,
450 ActiveScriptSiteInterruptPoll_AddRef
,
451 ActiveScriptSiteInterruptPoll_Release
,
452 ActiveScriptSiteInterruptPoll_QueryContinue
455 static inline ScriptHost
*impl_from_IActiveScriptSiteWindow(IActiveScriptSiteWindow
*iface
)
457 return CONTAINING_RECORD(iface
, ScriptHost
, IActiveScriptSiteWindow_iface
);
460 static HRESULT WINAPI
ActiveScriptSiteWindow_QueryInterface(IActiveScriptSiteWindow
*iface
,
461 REFIID riid
, void **ppv
)
463 ScriptHost
*This
= impl_from_IActiveScriptSiteWindow(iface
);
464 return IActiveScriptSite_QueryInterface(&This
->IActiveScriptSite_iface
, riid
, ppv
);
467 static ULONG WINAPI
ActiveScriptSiteWindow_AddRef(IActiveScriptSiteWindow
*iface
)
469 ScriptHost
*This
= impl_from_IActiveScriptSiteWindow(iface
);
470 return IActiveScriptSite_AddRef(&This
->IActiveScriptSite_iface
);
473 static ULONG WINAPI
ActiveScriptSiteWindow_Release(IActiveScriptSiteWindow
*iface
)
475 ScriptHost
*This
= impl_from_IActiveScriptSiteWindow(iface
);
476 return IActiveScriptSite_Release(&This
->IActiveScriptSite_iface
);
479 static HRESULT WINAPI
ActiveScriptSiteWindow_GetWindow(IActiveScriptSiteWindow
*iface
, HWND
*phwnd
)
481 ScriptHost
*This
= impl_from_IActiveScriptSiteWindow(iface
);
483 TRACE("(%p)->(%p)\n", This
, phwnd
);
485 if(!This
->window
|| !This
->window
->base
.outer_window
|| !This
->window
->base
.outer_window
->doc_obj
)
488 *phwnd
= This
->window
->base
.outer_window
->doc_obj
->hwnd
;
492 static HRESULT WINAPI
ActiveScriptSiteWindow_EnableModeless(IActiveScriptSiteWindow
*iface
, BOOL fEnable
)
494 ScriptHost
*This
= impl_from_IActiveScriptSiteWindow(iface
);
495 FIXME("(%p)->(%x)\n", This
, fEnable
);
499 static const IActiveScriptSiteWindowVtbl ActiveScriptSiteWindowVtbl
= {
500 ActiveScriptSiteWindow_QueryInterface
,
501 ActiveScriptSiteWindow_AddRef
,
502 ActiveScriptSiteWindow_Release
,
503 ActiveScriptSiteWindow_GetWindow
,
504 ActiveScriptSiteWindow_EnableModeless
507 static inline ScriptHost
*impl_from_IActiveScriptSiteUIControl(IActiveScriptSiteUIControl
*iface
)
509 return CONTAINING_RECORD(iface
, ScriptHost
, IActiveScriptSiteUIControl_iface
);
512 static HRESULT WINAPI
ActiveScriptSiteUIControl_QueryInterface(IActiveScriptSiteUIControl
*iface
, REFIID riid
, void **ppv
)
514 ScriptHost
*This
= impl_from_IActiveScriptSiteUIControl(iface
);
515 return IActiveScriptSite_QueryInterface(&This
->IActiveScriptSite_iface
, riid
, ppv
);
518 static ULONG WINAPI
ActiveScriptSiteUIControl_AddRef(IActiveScriptSiteUIControl
*iface
)
520 ScriptHost
*This
= impl_from_IActiveScriptSiteUIControl(iface
);
521 return IActiveScriptSite_AddRef(&This
->IActiveScriptSite_iface
);
524 static ULONG WINAPI
ActiveScriptSiteUIControl_Release(IActiveScriptSiteUIControl
*iface
)
526 ScriptHost
*This
= impl_from_IActiveScriptSiteUIControl(iface
);
527 return IActiveScriptSite_Release(&This
->IActiveScriptSite_iface
);
530 static HRESULT WINAPI
ActiveScriptSiteUIControl_GetUIBehavior(IActiveScriptSiteUIControl
*iface
, SCRIPTUICITEM UicItem
,
531 SCRIPTUICHANDLING
*pUicHandling
)
533 ScriptHost
*This
= impl_from_IActiveScriptSiteUIControl(iface
);
535 WARN("(%p)->(%d %p) semi-stub\n", This
, UicItem
, pUicHandling
);
537 *pUicHandling
= SCRIPTUICHANDLING_ALLOW
;
541 static const IActiveScriptSiteUIControlVtbl ActiveScriptSiteUIControlVtbl
= {
542 ActiveScriptSiteUIControl_QueryInterface
,
543 ActiveScriptSiteUIControl_AddRef
,
544 ActiveScriptSiteUIControl_Release
,
545 ActiveScriptSiteUIControl_GetUIBehavior
548 static inline ScriptHost
*impl_from_IActiveScriptSiteDebug(IActiveScriptSiteDebug
*iface
)
550 return CONTAINING_RECORD(iface
, ScriptHost
, IActiveScriptSiteDebug_iface
);
553 static HRESULT WINAPI
ActiveScriptSiteDebug_QueryInterface(IActiveScriptSiteDebug
*iface
,
554 REFIID riid
, void **ppv
)
556 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
557 return IActiveScriptSite_QueryInterface(&This
->IActiveScriptSite_iface
, riid
, ppv
);
560 static ULONG WINAPI
ActiveScriptSiteDebug_AddRef(IActiveScriptSiteDebug
*iface
)
562 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
563 return IActiveScriptSite_AddRef(&This
->IActiveScriptSite_iface
);
566 static ULONG WINAPI
ActiveScriptSiteDebug_Release(IActiveScriptSiteDebug
*iface
)
568 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
569 return IActiveScriptSite_Release(&This
->IActiveScriptSite_iface
);
572 static HRESULT WINAPI
ActiveScriptSiteDebug_GetDocumentContextFromPosition(IActiveScriptSiteDebug
*iface
,
573 CTXARG_T dwSourceContext
, ULONG uCharacterOffset
, ULONG uNumChars
, IDebugDocumentContext
**ppsc
)
575 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
576 FIXME("(%p)->(%s %u %u %p)\n", This
, wine_dbgstr_longlong(dwSourceContext
), uCharacterOffset
,
581 static HRESULT WINAPI
ActiveScriptSiteDebug_GetApplication(IActiveScriptSiteDebug
*iface
, IDebugApplication
**ppda
)
583 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
584 FIXME("(%p)->(%p)\n", This
, ppda
);
588 static HRESULT WINAPI
ActiveScriptSiteDebug_GetRootApplicationNode(IActiveScriptSiteDebug
*iface
,
589 IDebugApplicationNode
**ppdanRoot
)
591 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
592 FIXME("(%p)->(%p)\n", This
, ppdanRoot
);
596 static HRESULT WINAPI
ActiveScriptSiteDebug_OnScriptErrorDebug(IActiveScriptSiteDebug
*iface
,
597 IActiveScriptErrorDebug
*pErrorDebug
, BOOL
*pfEnterDebugger
, BOOL
*pfCallOnScriptErrorWhenContinuing
)
599 ScriptHost
*This
= impl_from_IActiveScriptSiteDebug(iface
);
600 FIXME("(%p)->(%p %p %p)\n", This
, pErrorDebug
, pfEnterDebugger
, pfCallOnScriptErrorWhenContinuing
);
604 static const IActiveScriptSiteDebugVtbl ActiveScriptSiteDebugVtbl
= {
605 ActiveScriptSiteDebug_QueryInterface
,
606 ActiveScriptSiteDebug_AddRef
,
607 ActiveScriptSiteDebug_Release
,
608 ActiveScriptSiteDebug_GetDocumentContextFromPosition
,
609 ActiveScriptSiteDebug_GetApplication
,
610 ActiveScriptSiteDebug_GetRootApplicationNode
,
611 ActiveScriptSiteDebug_OnScriptErrorDebug
614 static inline ScriptHost
*impl_from_IServiceProvider(IServiceProvider
*iface
)
616 return CONTAINING_RECORD(iface
, ScriptHost
, IServiceProvider_iface
);
619 static HRESULT WINAPI
ASServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
621 ScriptHost
*This
= impl_from_IServiceProvider(iface
);
622 return IActiveScriptSite_QueryInterface(&This
->IActiveScriptSite_iface
, riid
, ppv
);
625 static ULONG WINAPI
ASServiceProvider_AddRef(IServiceProvider
*iface
)
627 ScriptHost
*This
= impl_from_IServiceProvider(iface
);
628 return IActiveScriptSite_AddRef(&This
->IActiveScriptSite_iface
);
631 static ULONG WINAPI
ASServiceProvider_Release(IServiceProvider
*iface
)
633 ScriptHost
*This
= impl_from_IServiceProvider(iface
);
634 return IActiveScriptSite_Release(&This
->IActiveScriptSite_iface
);
637 static HRESULT WINAPI
ASServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
,
638 REFIID riid
, void **ppv
)
640 ScriptHost
*This
= impl_from_IServiceProvider(iface
);
642 if(IsEqualGUID(&SID_SInternetHostSecurityManager
, guidService
)) {
643 TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This
);
645 if(!This
->window
|| !This
->window
->doc
)
646 return E_NOINTERFACE
;
648 return IInternetHostSecurityManager_QueryInterface(&This
->window
->doc
->IInternetHostSecurityManager_iface
,
652 if(IsEqualGUID(&SID_SContainerDispatch
, guidService
)) {
653 TRACE("(%p)->(SID_SContainerDispatch)\n", This
);
655 if(!This
->window
|| !This
->window
->doc
)
656 return E_NOINTERFACE
;
658 return IHTMLDocument2_QueryInterface(&This
->window
->doc
->basedoc
.IHTMLDocument2_iface
, riid
, ppv
);
661 FIXME("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
662 return E_NOINTERFACE
;
665 static const IServiceProviderVtbl ASServiceProviderVtbl
= {
666 ASServiceProvider_QueryInterface
,
667 ASServiceProvider_AddRef
,
668 ASServiceProvider_Release
,
669 ASServiceProvider_QueryService
672 static ScriptHost
*create_script_host(HTMLInnerWindow
*window
, const GUID
*guid
)
677 ret
= heap_alloc_zero(sizeof(*ret
));
681 ret
->IActiveScriptSite_iface
.lpVtbl
= &ActiveScriptSiteVtbl
;
682 ret
->IActiveScriptSiteInterruptPoll_iface
.lpVtbl
= &ActiveScriptSiteInterruptPollVtbl
;
683 ret
->IActiveScriptSiteWindow_iface
.lpVtbl
= &ActiveScriptSiteWindowVtbl
;
684 ret
->IActiveScriptSiteUIControl_iface
.lpVtbl
= &ActiveScriptSiteUIControlVtbl
;
685 ret
->IActiveScriptSiteDebug_iface
.lpVtbl
= &ActiveScriptSiteDebugVtbl
;
686 ret
->IServiceProvider_iface
.lpVtbl
= &ASServiceProviderVtbl
;
688 ret
->window
= window
;
689 ret
->script_state
= SCRIPTSTATE_UNINITIALIZED
;
692 list_add_tail(&window
->script_hosts
, &ret
->entry
);
694 hres
= CoCreateInstance(&ret
->guid
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
695 &IID_IActiveScript
, (void**)&ret
->script
);
697 WARN("Could not load script engine: %08x\n", hres
);
698 else if(!init_script_engine(ret
))
699 release_script_engine(ret
);
704 static void parse_text(ScriptHost
*script_host
, LPCWSTR text
)
710 TRACE("%s\n", debugstr_w(text
));
713 memset(&excepinfo
, 0, sizeof(excepinfo
));
715 hres
= IActiveScriptParse_ParseScriptText(script_host
->parse
, text
, windowW
, NULL
, script_endW
,
716 0, 0, SCRIPTTEXT_ISVISIBLE
|SCRIPTTEXT_HOSTMANAGESSOURCE
,
721 WARN("<<< %08x\n", hres
);
725 static void parse_extern_script(ScriptHost
*script_host
, LPCWSTR src
)
731 static const WCHAR wine_schemaW
[] = {'w','i','n','e',':'};
733 if(strlenW(src
) > sizeof(wine_schemaW
)/sizeof(WCHAR
) && !memcmp(src
, wine_schemaW
, sizeof(wine_schemaW
)))
734 src
+= sizeof(wine_schemaW
)/sizeof(WCHAR
);
736 hres
= CreateURLMoniker(NULL
, src
, &mon
);
740 hres
= bind_mon_to_wstr(script_host
->window
, mon
, &text
);
741 IMoniker_Release(mon
);
745 parse_text(script_host
, text
);
750 static void parse_inline_script(ScriptHost
*script_host
, HTMLScriptElement
*script_elem
)
752 const PRUnichar
*text
;
756 nsAString_Init(&text_str
, NULL
);
757 nsres
= nsIDOMHTMLScriptElement_GetText(script_elem
->nsscript
, &text_str
);
758 nsAString_GetData(&text_str
, &text
);
760 if(NS_FAILED(nsres
)) {
761 ERR("GetText failed: %08x\n", nsres
);
763 parse_text(script_host
, text
);
766 nsAString_Finish(&text_str
);
769 static void parse_script_elem(ScriptHost
*script_host
, HTMLScriptElement
*script_elem
)
771 nsAString src_str
, event_str
;
772 const PRUnichar
*src
;
775 nsAString_Init(&event_str
, NULL
);
776 nsres
= nsIDOMHTMLScriptElement_GetEvent(script_elem
->nsscript
, &event_str
);
777 if(NS_SUCCEEDED(nsres
)) {
778 const PRUnichar
*event
;
780 nsAString_GetData(&event_str
, &event
);
782 TRACE("deferring event %s script evaluation\n", debugstr_w(event
));
783 nsAString_Finish(&event_str
);
787 ERR("GetAttribute(event) failed: %08x\n", nsres
);
789 nsAString_Finish(&event_str
);
791 nsAString_Init(&src_str
, NULL
);
792 nsres
= nsIDOMHTMLScriptElement_GetSrc(script_elem
->nsscript
, &src_str
);
793 nsAString_GetData(&src_str
, &src
);
795 if(NS_FAILED(nsres
)) {
796 ERR("GetSrc failed: %08x\n", nsres
);
798 script_elem
->parsed
= TRUE
;
799 parse_extern_script(script_host
, src
);
801 parse_inline_script(script_host
, script_elem
);
804 nsAString_Finish(&src_str
);
807 static GUID
get_default_script_guid(HTMLInnerWindow
*window
)
809 /* If not specified, we should use very first script host that was created for the page (or JScript if none) */
810 return list_empty(&window
->script_hosts
)
812 : LIST_ENTRY(list_head(&window
->script_hosts
), ScriptHost
, entry
)->guid
;
815 static BOOL
get_guid_from_type(LPCWSTR type
, GUID
*guid
)
817 const WCHAR text_javascriptW
[] =
818 {'t','e','x','t','/','j','a','v','a','s','c','r','i','p','t',0};
819 const WCHAR text_jscriptW
[] =
820 {'t','e','x','t','/','j','s','c','r','i','p','t',0};
821 const WCHAR text_vbscriptW
[] =
822 {'t','e','x','t','/','v','b','s','c','r','i','p','t',0};
824 /* FIXME: Handle more types */
825 if(!strcmpiW(type
, text_javascriptW
) || !strcmpiW(type
, text_jscriptW
)) {
826 *guid
= CLSID_JScript
;
827 }else if(!strcmpiW(type
, text_vbscriptW
)) {
828 *guid
= CLSID_VBScript
;
830 FIXME("Unknown type %s\n", debugstr_w(type
));
837 static BOOL
get_guid_from_language(LPCWSTR type
, GUID
*guid
)
841 hres
= CLSIDFromProgID(type
, guid
);
845 /* FIXME: Check CATID_ActiveScriptParse */
850 static BOOL
get_script_guid(HTMLInnerWindow
*window
, nsIDOMHTMLScriptElement
*nsscript
, GUID
*guid
)
852 nsAString attr_str
, val_str
;
856 static const PRUnichar languageW
[] = {'l','a','n','g','u','a','g','e',0};
858 nsAString_Init(&val_str
, NULL
);
860 nsres
= nsIDOMHTMLScriptElement_GetType(nsscript
, &val_str
);
861 if(NS_SUCCEEDED(nsres
)) {
862 const PRUnichar
*type
;
864 nsAString_GetData(&val_str
, &type
);
866 ret
= get_guid_from_type(type
, guid
);
867 nsAString_Finish(&val_str
);
871 ERR("GetType failed: %08x\n", nsres
);
874 nsAString_InitDepend(&attr_str
, languageW
);
875 nsres
= nsIDOMHTMLScriptElement_GetAttribute(nsscript
, &attr_str
, &val_str
);
876 nsAString_Finish(&attr_str
);
877 if(NS_SUCCEEDED(nsres
)) {
878 const PRUnichar
*language
;
880 nsAString_GetData(&val_str
, &language
);
883 ret
= get_guid_from_language(language
, guid
);
885 *guid
= get_default_script_guid(window
);
889 ERR("GetAttribute(language) failed: %08x\n", nsres
);
892 nsAString_Finish(&val_str
);
897 static ScriptHost
*get_script_host(HTMLInnerWindow
*window
, const GUID
*guid
)
901 LIST_FOR_EACH_ENTRY(iter
, &window
->script_hosts
, ScriptHost
, entry
) {
902 if(IsEqualGUID(guid
, &iter
->guid
))
906 return create_script_host(window
, guid
);
909 static ScriptHost
*get_elem_script_host(HTMLInnerWindow
*window
, HTMLScriptElement
*script_elem
)
913 if(!get_script_guid(window
, script_elem
->nsscript
, &guid
)) {
914 WARN("Could not find script GUID\n");
918 if(IsEqualGUID(&CLSID_JScript
, &guid
)
919 && (!window
->base
.outer_window
|| window
->base
.outer_window
->scriptmode
!= SCRIPTMODE_ACTIVESCRIPT
)) {
920 TRACE("Ignoring JScript\n");
924 return get_script_host(window
, &guid
);
927 void doc_insert_script(HTMLInnerWindow
*window
, HTMLScriptElement
*script_elem
)
929 ScriptHost
*script_host
;
931 script_host
= get_elem_script_host(window
, script_elem
);
935 if(script_host
->parse
)
936 parse_script_elem(script_host
, script_elem
);
939 IDispatch
*script_parse_event(HTMLInnerWindow
*window
, LPCWSTR text
)
941 ScriptHost
*script_host
;
947 static const WCHAR delimiterW
[] = {'\"',0};
949 TRACE("%s\n", debugstr_w(text
));
951 for(ptr
= text
; isalnumW(*ptr
); ptr
++);
956 language
= heap_alloc((ptr
-text
+1)*sizeof(WCHAR
));
960 memcpy(language
, text
, (ptr
-text
)*sizeof(WCHAR
));
961 language
[ptr
-text
] = 0;
963 b
= get_guid_from_language(language
, &guid
);
968 WARN("Could not find language\n");
975 guid
= get_default_script_guid(window
);
978 if(IsEqualGUID(&CLSID_JScript
, &guid
)
979 && (!window
->base
.outer_window
|| window
->base
.outer_window
->scriptmode
!= SCRIPTMODE_ACTIVESCRIPT
)) {
980 TRACE("Ignoring JScript\n");
984 script_host
= get_script_host(window
, &guid
);
985 if(!script_host
|| !script_host
->parse_proc
)
988 hres
= IActiveScriptParseProcedure2_ParseProcedureText(script_host
->parse_proc
, ptr
, NULL
, emptyW
,
989 NULL
, NULL
, delimiterW
, 0 /* FIXME */, 0,
990 SCRIPTPROC_HOSTMANAGESSOURCE
|SCRIPTPROC_IMPLICIT_THIS
|SCRIPTPROC_IMPLICIT_PARENTS
, &disp
);
992 WARN("ParseProcedureText failed: %08x\n", hres
);
996 TRACE("ret %p\n", disp
);
1000 HRESULT
exec_script(HTMLInnerWindow
*window
, const WCHAR
*code
, const WCHAR
*lang
, VARIANT
*ret
)
1002 ScriptHost
*script_host
;
1007 static const WCHAR delimW
[] = {'"',0};
1009 if(!get_guid_from_language(lang
, &guid
)) {
1010 WARN("Could not find script GUID\n");
1011 return CO_E_CLASSSTRING
;
1014 script_host
= get_script_host(window
, &guid
);
1016 FIXME("No script host\n");
1020 if(!script_host
->parse
) {
1021 FIXME("script_host->parse == NULL\n");
1025 memset(&ei
, 0, sizeof(ei
));
1027 hres
= IActiveScriptParse_ParseScriptText(script_host
->parse
, code
, NULL
, NULL
, delimW
, 0, 0, SCRIPTTEXT_ISVISIBLE
, ret
, &ei
);
1031 WARN("<<< %08x\n", hres
);
1036 IDispatch
*get_script_disp(ScriptHost
*script_host
)
1041 if(!script_host
->script
)
1044 hres
= IActiveScript_GetScriptDispatch(script_host
->script
, windowW
, &disp
);
1051 static event_target_t
**find_event_target(HTMLDocumentNode
*doc
, HTMLScriptElement
*script_elem
, HTMLDOMNode
**ret_target_node
)
1053 HTMLDOMNode
*target_node
= NULL
;
1054 event_target_t
**target
= NULL
;
1055 const PRUnichar
*target_id
;
1056 nsAString target_id_str
;
1060 nsAString_Init(&target_id_str
, NULL
);
1061 nsres
= nsIDOMHTMLScriptElement_GetHtmlFor(script_elem
->nsscript
, &target_id_str
);
1062 if(NS_FAILED(nsres
)) {
1063 ERR("GetScriptFor failed: %08x\n", nsres
);
1064 nsAString_Finish(&target_id_str
);
1068 nsAString_GetData(&target_id_str
, &target_id
);
1070 FIXME("Empty for attribute\n");
1071 }else if(!strcmpW(target_id
, documentW
)) {
1072 target
= &doc
->node
.event_target
;
1073 target_node
= &doc
->node
;
1074 IHTMLDOMNode_AddRef(&target_node
->IHTMLDOMNode_iface
);
1075 }else if(!strcmpW(target_id
, windowW
)) {
1076 target
= &doc
->body_event_target
;
1078 HTMLElement
*target_elem
;
1080 hres
= get_doc_elem_by_id(doc
, target_id
, &target_elem
);
1081 if(SUCCEEDED(hres
) && target_elem
) {
1082 target_node
= &target_elem
->node
;
1083 target
= &target_elem
->node
.event_target
;
1086 nsAString_Finish(&target_id_str
);
1088 *ret_target_node
= target_node
;
1092 static BOOL
parse_event_str(WCHAR
*event
, const WCHAR
**args
)
1096 TRACE("%s\n", debugstr_w(event
));
1098 for(ptr
= event
; isalnumW(*ptr
); ptr
++);
1109 while(isalnumW(*ptr
) || isspaceW(*ptr
) || *ptr
== ',')
1119 static IDispatch
*parse_event_elem(HTMLDocumentNode
*doc
, HTMLScriptElement
*script_elem
, WCHAR
**ret_event
)
1121 ScriptHost
*script_host
;
1122 WCHAR
*event
= NULL
;
1129 if(script_elem
->parsed
)
1132 script_host
= get_elem_script_host(doc
->window
, script_elem
);
1133 if(!script_host
|| !script_host
->parse_proc
)
1136 nsAString_Init(&nsstr
, NULL
);
1137 nsres
= nsIDOMHTMLScriptElement_GetEvent(script_elem
->nsscript
, &nsstr
);
1138 if(NS_SUCCEEDED(nsres
)) {
1139 const PRUnichar
*event_val
;
1141 nsAString_GetData(&nsstr
, &event_val
);
1142 event
= heap_strdupW(event_val
);
1144 nsAString_Finish(&nsstr
);
1148 if(!parse_event_str(event
, &args
)) {
1149 WARN("parsing %s failed\n", debugstr_w(event
));
1154 nsAString_Init(&nsstr
, NULL
);
1155 nsres
= nsIDOMHTMLScriptElement_GetText(script_elem
->nsscript
, &nsstr
);
1156 if(NS_SUCCEEDED(nsres
)) {
1157 const PRUnichar
*text
;
1159 nsAString_GetData(&nsstr
, &text
);
1160 hres
= IActiveScriptParseProcedure2_ParseProcedureText(script_host
->parse_proc
, text
, args
,
1161 emptyW
, NULL
, NULL
, script_endW
, 0, 0,
1162 SCRIPTPROC_HOSTMANAGESSOURCE
|SCRIPTPROC_IMPLICIT_THIS
|SCRIPTPROC_IMPLICIT_PARENTS
, &disp
);
1166 ERR("GetText failed: %08x\n", nsres
);
1169 nsAString_Finish(&nsstr
);
1179 void bind_event_scripts(HTMLDocumentNode
*doc
)
1181 HTMLPluginContainer
*plugin_container
;
1182 nsIDOMHTMLScriptElement
*nsscript
;
1183 HTMLScriptElement
*script_elem
;
1184 event_target_t
**event_target
;
1185 nsIDOMNodeList
*node_list
;
1186 HTMLDOMNode
*target_node
;
1187 nsIDOMNode
*script_node
;
1188 nsAString selector_str
;
1189 IDispatch
*event_disp
;
1195 static const PRUnichar selectorW
[] = {'s','c','r','i','p','t','[','e','v','e','n','t',']',0};
1202 nsAString_InitDepend(&selector_str
, selectorW
);
1203 nsres
= nsIDOMNodeSelector_QuerySelectorAll(doc
->nsnode_selector
, &selector_str
, &node_list
);
1204 nsAString_Finish(&selector_str
);
1205 if(NS_FAILED(nsres
)) {
1206 ERR("QuerySelectorAll failed: %08x\n", nsres
);
1213 nsres
= nsIDOMNodeList_GetLength(node_list
, &length
);
1214 assert(nsres
== NS_OK
);
1216 for(i
=0; i
< length
; i
++) {
1217 nsres
= nsIDOMNodeList_Item(node_list
, i
, &script_node
);
1218 if(NS_FAILED(nsres
) || !script_node
) {
1219 ERR("Item(%d) failed: %08x\n", i
, nsres
);
1223 nsres
= nsIDOMNode_QueryInterface(script_node
, &IID_nsIDOMHTMLScriptElement
, (void**)&nsscript
);
1224 assert(nsres
== NS_OK
);
1225 nsIDOMNode_Release(script_node
);
1227 hres
= script_elem_from_nsscript(doc
, nsscript
, &script_elem
);
1231 event_disp
= parse_event_elem(doc
, script_elem
, &event
);
1233 event_target
= find_event_target(doc
, script_elem
, &target_node
);
1236 hres
= IHTMLDOMNode_QueryInterface(&target_node
->IHTMLDOMNode_iface
, &IID_HTMLPluginContainer
,
1237 (void**)&plugin_container
);
1239 hres
= E_NOINTERFACE
;
1242 bind_activex_event(doc
, plugin_container
, event
, event_disp
);
1244 bind_node_event(doc
, event_target
, target_node
, event
, event_disp
);
1247 IHTMLDOMNode_Release(&target_node
->IHTMLDOMNode_iface
);
1251 IDispatch_Release(event_disp
);
1254 IHTMLScriptElement_Release(&script_elem
->IHTMLScriptElement_iface
);
1257 nsIDOMNodeList_Release(node_list
);
1260 BOOL
find_global_prop(HTMLInnerWindow
*window
, BSTR name
, DWORD flags
, ScriptHost
**ret_host
, DISPID
*ret_id
)
1262 IDispatchEx
*dispex
;
1267 LIST_FOR_EACH_ENTRY(iter
, &window
->script_hosts
, ScriptHost
, entry
) {
1268 disp
= get_script_disp(iter
);
1272 hres
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&dispex
);
1273 if(SUCCEEDED(hres
)) {
1274 hres
= IDispatchEx_GetDispID(dispex
, name
, flags
& (~fdexNameEnsure
), ret_id
);
1275 IDispatchEx_Release(dispex
);
1277 FIXME("No IDispatchEx\n");
1281 IDispatch_Release(disp
);
1282 if(SUCCEEDED(hres
)) {
1291 static BOOL
is_jscript_available(void)
1293 static BOOL available
, checked
;
1297 HRESULT hres
= CoGetClassObject(&CLSID_JScript
, CLSCTX_INPROC_SERVER
, NULL
, &IID_IUnknown
, (void**)&unk
);
1299 if(SUCCEEDED(hres
)) {
1301 IUnknown_Release(unk
);
1311 void set_script_mode(HTMLOuterWindow
*window
, SCRIPTMODE mode
)
1313 nsIWebBrowserSetup
*setup
;
1316 if(mode
== SCRIPTMODE_ACTIVESCRIPT
&& !is_jscript_available()) {
1317 TRACE("jscript.dll not available\n");
1318 window
->scriptmode
= SCRIPTMODE_GECKO
;
1322 window
->scriptmode
= mode
;
1324 if(!window
->doc_obj
->nscontainer
|| !window
->doc_obj
->nscontainer
->webbrowser
)
1327 nsres
= nsIWebBrowser_QueryInterface(window
->doc_obj
->nscontainer
->webbrowser
,
1328 &IID_nsIWebBrowserSetup
, (void**)&setup
);
1329 if(NS_SUCCEEDED(nsres
)) {
1330 nsres
= nsIWebBrowserSetup_SetProperty(setup
, SETUP_ALLOW_JAVASCRIPT
,
1331 window
->scriptmode
== SCRIPTMODE_GECKO
);
1333 if(NS_SUCCEEDED(nsres
))
1334 nsres
= nsIWebBrowserSetup_SetProperty(setup
, SETUP_DISABLE_NOSCRIPT
, TRUE
);
1336 nsIWebBrowserSetup_Release(setup
);
1339 if(NS_FAILED(nsres
))
1340 ERR("JavaScript setup failed: %08x\n", nsres
);
1343 void release_script_hosts(HTMLInnerWindow
*window
)
1345 script_queue_entry_t
*queue_iter
;
1348 while(!list_empty(&window
->script_queue
)) {
1349 queue_iter
= LIST_ENTRY(list_head(&window
->script_queue
), script_queue_entry_t
, entry
);
1351 list_remove(&queue_iter
->entry
);
1352 IHTMLScriptElement_Release(&queue_iter
->script
->IHTMLScriptElement_iface
);
1353 heap_free(queue_iter
);
1356 while(!list_empty(&window
->script_hosts
)) {
1357 iter
= LIST_ENTRY(list_head(&window
->script_hosts
), ScriptHost
, entry
);
1359 release_script_engine(iter
);
1360 list_remove(&iter
->entry
);
1361 iter
->window
= NULL
;
1362 IActiveScriptSite_Release(&iter
->IActiveScriptSite_iface
);