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
23 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(jscript);
28 const IActiveScriptVtbl *lpIActiveScriptVtbl;
29 const IActiveScriptParseVtbl *lpIActiveScriptParseVtbl;
30 const IActiveScriptParseProcedure2Vtbl *lpIActiveScriptParseProcedure2Vtbl;
31 const IActiveScriptPropertyVtbl *lpIActiveScriptPropertyVtbl;
32 const IObjectSafetyVtbl *lpIObjectSafetyVtbl;
41 IActiveScriptSite *site;
43 parser_ctx_t *queue_head;
44 parser_ctx_t *queue_tail;
47 #define ACTSCRIPT(x) ((IActiveScript*) &(x)->lpIActiveScriptVtbl)
48 #define ASPARSE(x) ((IActiveScriptParse*) &(x)->lpIActiveScriptParseVtbl)
49 #define ASPARSEPROC(x) ((IActiveScriptParseProcedure2*) &(x)->lpIActiveScriptParseProcedure2Vtbl)
50 #define ACTSCPPROP(x) ((IActiveScriptProperty*) &(x)->lpIActiveScriptPropertyVtbl)
51 #define OBJSAFETY(x) ((IObjectSafety*) &(x)->lpIObjectSafetyVtbl)
53 void script_release(script_ctx_t *ctx)
58 jsheap_free(&ctx->tmp_heap);
62 static void change_state(JScript *This, SCRIPTSTATE state)
64 if(This->ctx->state == state)
67 This->ctx->state = state;
68 IActiveScriptSite_OnStateChange(This->site, state);
71 static inline BOOL is_started(script_ctx_t *ctx)
73 return ctx->state == SCRIPTSTATE_STARTED
74 || ctx->state == SCRIPTSTATE_CONNECTED
75 || ctx->state == SCRIPTSTATE_DISCONNECTED;
78 static HRESULT exec_global_code(JScript *This, parser_ctx_t *parser_ctx)
85 hres = create_exec_ctx((IDispatch*)_IDispatchEx_(This->ctx->script_disp), This->ctx->script_disp, NULL, &exec_ctx);
89 IActiveScriptSite_OnEnterScript(This->site);
91 memset(&jsexcept, 0, sizeof(jsexcept));
92 hres = exec_source(exec_ctx, parser_ctx, parser_ctx->source, &jsexcept, &var);
93 VariantClear(&jsexcept.var);
94 exec_release(exec_ctx);
98 IActiveScriptSite_OnLeaveScript(This->site);
103 static void clear_script_queue(JScript *This)
105 parser_ctx_t *iter, *iter2;
107 if(!This->queue_head)
110 iter = This->queue_head;
114 parser_release(iter);
118 This->queue_head = This->queue_tail = NULL;
121 static void exec_queued_code(JScript *This)
125 for(iter = This->queue_head; iter; iter = iter->next)
126 exec_global_code(This, iter);
128 clear_script_queue(This);
131 static HRESULT set_ctx_site(JScript *This)
135 This->ctx->lcid = This->lcid;
137 if(!This->ctx->script_disp) {
138 hres = create_dispex(This->ctx, NULL, NULL, &This->ctx->script_disp);
143 hres = init_global(This->ctx);
147 change_state(This, SCRIPTSTATE_INITIALIZED);
151 #define ACTSCRIPT_THIS(iface) DEFINE_THIS(JScript, IActiveScript, iface)
153 static HRESULT WINAPI JScript_QueryInterface(IActiveScript *iface, REFIID riid, void **ppv)
155 JScript *This = ACTSCRIPT_THIS(iface);
159 if(IsEqualGUID(riid, &IID_IUnknown)) {
160 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
161 *ppv = ACTSCRIPT(This);
162 }else if(IsEqualGUID(riid, &IID_IActiveScript)) {
163 TRACE("(%p)->(IID_IActiveScript %p)\n", This, ppv);
164 *ppv = ACTSCRIPT(This);
165 }else if(IsEqualGUID(riid, &IID_IActiveScriptParse)) {
166 TRACE("(%p)->(IID_IActiveScriptParse %p)\n", This, ppv);
167 *ppv = ASPARSE(This);
168 }else if(IsEqualGUID(riid, &IID_IActiveScriptParseProcedure)) {
169 TRACE("(%p)->(IID_IActiveScriptParseProcedure %p)\n", This, ppv);
170 *ppv = ASPARSEPROC(This);
171 }else if(IsEqualGUID(riid, &IID_IActiveScriptParseProcedure2)) {
172 TRACE("(%p)->(IID_IActiveScriptParseProcedure2 %p)\n", This, ppv);
173 *ppv = ASPARSEPROC(This);
174 }else if(IsEqualGUID(riid, &IID_IActiveScriptProperty)) {
175 TRACE("(%p)->(IID_IActiveScriptProperty %p)\n", This, ppv);
176 *ppv = ACTSCPPROP(This);
177 }else if(IsEqualGUID(riid, &IID_IObjectSafety)) {
178 TRACE("(%p)->(IID_IObjectSafety %p)\n", This, ppv);
179 *ppv = OBJSAFETY(This);
183 IUnknown_AddRef((IUnknown*)*ppv);
187 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
188 return E_NOINTERFACE;
191 static ULONG WINAPI JScript_AddRef(IActiveScript *iface)
193 JScript *This = ACTSCRIPT_THIS(iface);
194 LONG ref = InterlockedIncrement(&This->ref);
196 TRACE("(%p) ref=%d\n", This, ref);
201 static ULONG WINAPI JScript_Release(IActiveScript *iface)
203 JScript *This = ACTSCRIPT_THIS(iface);
204 LONG ref = InterlockedDecrement(&This->ref);
206 TRACE("(%p) ref=%d\n", iface, ref);
209 if(This->ctx && This->ctx->state != SCRIPTSTATE_CLOSED)
210 IActiveScript_Close(ACTSCRIPT(This));
212 script_release(This->ctx);
220 static HRESULT WINAPI JScript_SetScriptSite(IActiveScript *iface,
221 IActiveScriptSite *pass)
223 JScript *This = ACTSCRIPT_THIS(iface);
227 TRACE("(%p)->(%p)\n", This, pass);
235 if(InterlockedCompareExchange(&This->thread_id, GetCurrentThreadId(), 0))
239 IActiveScriptSite_AddRef(This->site);
241 hres = IActiveScriptSite_GetLCID(This->site, &lcid);
245 return This->ctx ? set_ctx_site(This) : S_OK;
248 static HRESULT WINAPI JScript_GetScriptSite(IActiveScript *iface, REFIID riid,
251 JScript *This = ACTSCRIPT_THIS(iface);
252 FIXME("(%p)->()\n", This);
256 static HRESULT WINAPI JScript_SetScriptState(IActiveScript *iface, SCRIPTSTATE ss)
258 JScript *This = ACTSCRIPT_THIS(iface);
260 TRACE("(%p)->(%d)\n", This, ss);
262 if(!This->ctx || GetCurrentThreadId() != This->thread_id)
266 case SCRIPTSTATE_STARTED:
267 case SCRIPTSTATE_CONNECTED: /* FIXME */
268 if(This->ctx->state == SCRIPTSTATE_CLOSED)
271 exec_queued_code(This);
274 FIXME("unimplemented state %d\n", ss);
278 change_state(This, ss);
282 static HRESULT WINAPI JScript_GetScriptState(IActiveScript *iface, SCRIPTSTATE *pssState)
284 JScript *This = ACTSCRIPT_THIS(iface);
286 TRACE("(%p)->(%p)\n", This, pssState);
291 if(!This->thread_id) {
292 *pssState = SCRIPTSTATE_UNINITIALIZED;
296 if(This->thread_id != GetCurrentThreadId())
299 *pssState = This->ctx ? This->ctx->state : SCRIPTSTATE_UNINITIALIZED;
303 static HRESULT WINAPI JScript_Close(IActiveScript *iface)
305 JScript *This = ACTSCRIPT_THIS(iface);
307 TRACE("(%p)->()\n", This);
309 if(This->thread_id != GetCurrentThreadId())
313 if(This->ctx->state == SCRIPTSTATE_CONNECTED)
314 change_state(This, SCRIPTSTATE_DISCONNECTED);
316 clear_script_queue(This);
318 if(This->ctx->state == SCRIPTSTATE_DISCONNECTED)
319 change_state(This, SCRIPTSTATE_INITIALIZED);
321 if(This->ctx->named_items) {
322 named_item_t *iter, *iter2;
324 iter = This->ctx->named_items;
328 IDispatch_Release(iter->disp);
329 heap_free(iter->name);
334 This->ctx->named_items = NULL;
338 change_state(This, SCRIPTSTATE_CLOSED);
340 if(This->ctx->script_disp) {
341 IDispatchEx_Release(_IDispatchEx_(This->ctx->script_disp));
342 This->ctx->script_disp = NULL;
345 if(This->ctx->global) {
346 IDispatchEx_Release(_IDispatchEx_(This->ctx->global));
347 This->ctx->global = NULL;
352 IActiveScriptSite_Release(This->site);
359 static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface,
360 LPCOLESTR pstrName, DWORD dwFlags)
362 JScript *This = ACTSCRIPT_THIS(iface);
368 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags);
370 if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED)
373 hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL);
375 WARN("GetItemInfo failed: %08x\n", hres);
379 hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp);
380 IUnknown_Release(unk);
382 WARN("object does not implement IDispatch\n");
386 item = heap_alloc(sizeof(*item));
388 IDispatch_Release(disp);
389 return E_OUTOFMEMORY;
393 item->flags = dwFlags;
394 item->name = heap_strdupW(pstrName);
396 IDispatch_Release(disp);
398 return E_OUTOFMEMORY;
401 item->next = This->ctx->named_items;
402 This->ctx->named_items = item;
407 static HRESULT WINAPI JScript_AddTypeLib(IActiveScript *iface, REFGUID rguidTypeLib,
408 DWORD dwMajor, DWORD dwMinor, DWORD dwFlags)
410 JScript *This = ACTSCRIPT_THIS(iface);
411 FIXME("(%p)->()\n", This);
415 static HRESULT WINAPI JScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR pstrItemName,
418 JScript *This = ACTSCRIPT_THIS(iface);
420 TRACE("(%p)->(%p)\n", This, ppdisp);
425 if(This->thread_id != GetCurrentThreadId() || !This->ctx->script_disp) {
430 *ppdisp = (IDispatch*)_IDispatchEx_(This->ctx->script_disp);
431 IDispatch_AddRef(*ppdisp);
435 static HRESULT WINAPI JScript_GetCurrentScriptThreadID(IActiveScript *iface,
436 SCRIPTTHREADID *pstridThread)
438 JScript *This = ACTSCRIPT_THIS(iface);
439 FIXME("(%p)->()\n", This);
443 static HRESULT WINAPI JScript_GetScriptThreadID(IActiveScript *iface,
444 DWORD dwWin32ThreadId, SCRIPTTHREADID *pstidThread)
446 JScript *This = ACTSCRIPT_THIS(iface);
447 FIXME("(%p)->()\n", This);
451 static HRESULT WINAPI JScript_GetScriptThreadState(IActiveScript *iface,
452 SCRIPTTHREADID stidThread, SCRIPTTHREADSTATE *pstsState)
454 JScript *This = ACTSCRIPT_THIS(iface);
455 FIXME("(%p)->()\n", This);
459 static HRESULT WINAPI JScript_InterruptScriptThread(IActiveScript *iface,
460 SCRIPTTHREADID stidThread, const EXCEPINFO *pexcepinfo, DWORD dwFlags)
462 JScript *This = ACTSCRIPT_THIS(iface);
463 FIXME("(%p)->()\n", This);
467 static HRESULT WINAPI JScript_Clone(IActiveScript *iface, IActiveScript **ppscript)
469 JScript *This = ACTSCRIPT_THIS(iface);
470 FIXME("(%p)->()\n", This);
474 #undef ACTSCRIPT_THIS
476 static const IActiveScriptVtbl JScriptVtbl = {
477 JScript_QueryInterface,
480 JScript_SetScriptSite,
481 JScript_GetScriptSite,
482 JScript_SetScriptState,
483 JScript_GetScriptState,
485 JScript_AddNamedItem,
487 JScript_GetScriptDispatch,
488 JScript_GetCurrentScriptThreadID,
489 JScript_GetScriptThreadID,
490 JScript_GetScriptThreadState,
491 JScript_InterruptScriptThread,
495 #define ASPARSE_THIS(iface) DEFINE_THIS(JScript, IActiveScriptParse, iface)
497 static HRESULT WINAPI JScriptParse_QueryInterface(IActiveScriptParse *iface, REFIID riid, void **ppv)
499 JScript *This = ASPARSE_THIS(iface);
500 return IActiveScript_QueryInterface(ACTSCRIPT(This), riid, ppv);
503 static ULONG WINAPI JScriptParse_AddRef(IActiveScriptParse *iface)
505 JScript *This = ASPARSE_THIS(iface);
506 return IActiveScript_AddRef(ACTSCRIPT(This));
509 static ULONG WINAPI JScriptParse_Release(IActiveScriptParse *iface)
511 JScript *This = ASPARSE_THIS(iface);
512 return IActiveScript_Release(ACTSCRIPT(This));
515 static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface)
517 JScript *This = ASPARSE_THIS(iface);
520 TRACE("(%p)\n", This);
525 ctx = heap_alloc_zero(sizeof(script_ctx_t));
527 return E_OUTOFMEMORY;
530 ctx->state = SCRIPTSTATE_UNINITIALIZED;
531 jsheap_init(&ctx->tmp_heap);
533 ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL);
539 return This->site ? set_ctx_site(This) : S_OK;
542 static HRESULT WINAPI JScriptParse_AddScriptlet(IActiveScriptParse *iface,
543 LPCOLESTR pstrDefaultName, LPCOLESTR pstrCode, LPCOLESTR pstrItemName,
544 LPCOLESTR pstrSubItemName, LPCOLESTR pstrEventName, LPCOLESTR pstrDelimiter,
545 DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags,
546 BSTR *pbstrName, EXCEPINFO *pexcepinfo)
548 JScript *This = ASPARSE_THIS(iface);
549 FIXME("(%p)->(%s %s %s %s %s %s %x %u %x %p %p)\n", This, debugstr_w(pstrDefaultName),
550 debugstr_w(pstrCode), debugstr_w(pstrItemName), debugstr_w(pstrSubItemName),
551 debugstr_w(pstrEventName), debugstr_w(pstrDelimiter), dwSourceContextCookie,
552 ulStartingLineNumber, dwFlags, pbstrName, pexcepinfo);
556 static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
557 LPCOLESTR pstrCode, LPCOLESTR pstrItemName, IUnknown *punkContext,
558 LPCOLESTR pstrDelimiter, DWORD dwSourceContextCookie, ULONG ulStartingLine,
559 DWORD dwFlags, VARIANT *pvarResult, EXCEPINFO *pexcepinfo)
561 JScript *This = ASPARSE_THIS(iface);
562 parser_ctx_t *parser_ctx;
565 TRACE("(%p)->(%s %s %p %s %x %u %x %p %p)\n", This, debugstr_w(pstrCode),
566 debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
567 dwSourceContextCookie, ulStartingLine, dwFlags, pvarResult, pexcepinfo);
569 if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
572 hres = script_parse(This->ctx, pstrCode, &parser_ctx);
576 if(!is_started(This->ctx)) {
578 This->queue_tail = This->queue_tail->next = parser_ctx;
580 This->queue_head = This->queue_tail = parser_ctx;
584 hres = exec_global_code(This, parser_ctx);
585 parser_release(parser_ctx);
592 static const IActiveScriptParseVtbl JScriptParseVtbl = {
593 JScriptParse_QueryInterface,
595 JScriptParse_Release,
596 JScriptParse_InitNew,
597 JScriptParse_AddScriptlet,
598 JScriptParse_ParseScriptText
601 #define ASPARSEPROC_THIS(iface) DEFINE_THIS(JScript, IActiveScriptParseProcedure2, iface)
603 static HRESULT WINAPI JScriptParseProcedure_QueryInterface(IActiveScriptParseProcedure2 *iface, REFIID riid, void **ppv)
605 JScript *This = ASPARSEPROC_THIS(iface);
606 return IActiveScript_QueryInterface(ACTSCRIPT(This), riid, ppv);
609 static ULONG WINAPI JScriptParseProcedure_AddRef(IActiveScriptParseProcedure2 *iface)
611 JScript *This = ASPARSEPROC_THIS(iface);
612 return IActiveScript_AddRef(ACTSCRIPT(This));
615 static ULONG WINAPI JScriptParseProcedure_Release(IActiveScriptParseProcedure2 *iface)
617 JScript *This = ASPARSEPROC_THIS(iface);
618 return IActiveScript_Release(ACTSCRIPT(This));
621 static HRESULT WINAPI JScriptParseProcedure_ParseProcedureText(IActiveScriptParseProcedure2 *iface,
622 LPCOLESTR pstrCode, LPCOLESTR pstrFormalParams, LPCOLESTR pstrProcedureName,
623 LPCOLESTR pstrItemName, IUnknown *punkContext, LPCOLESTR pstrDelimiter,
624 DWORD dwSourceContextCookie, ULONG ulStartingLineNumber, DWORD dwFlags, IDispatch **ppdisp)
626 JScript *This = ASPARSEPROC_THIS(iface);
627 parser_ctx_t *parser_ctx;
631 TRACE("(%p)->(%s %s %s %s %p %s %x %u %x %p)\n", This, debugstr_w(pstrCode), debugstr_w(pstrFormalParams),
632 debugstr_w(pstrProcedureName), debugstr_w(pstrItemName), punkContext, debugstr_w(pstrDelimiter),
633 dwSourceContextCookie, ulStartingLineNumber, dwFlags, ppdisp);
635 if(This->thread_id != GetCurrentThreadId() || This->ctx->state == SCRIPTSTATE_CLOSED)
638 hres = script_parse(This->ctx, pstrCode, &parser_ctx);
640 WARN("Parse failed %08x\n", hres);
644 hres = create_source_function(parser_ctx, NULL, parser_ctx->source, NULL, NULL, 0, &dispex);
645 parser_release(parser_ctx);
649 *ppdisp = (IDispatch*)_IDispatchEx_(dispex);
653 #undef ASPARSEPROC_THIS
655 static const IActiveScriptParseProcedure2Vtbl JScriptParseProcedureVtbl = {
656 JScriptParseProcedure_QueryInterface,
657 JScriptParseProcedure_AddRef,
658 JScriptParseProcedure_Release,
659 JScriptParseProcedure_ParseProcedureText,
662 #define ACTSCPPROP_THIS(iface) DEFINE_THIS(JScript, IActiveScriptProperty, iface)
664 static HRESULT WINAPI JScriptProperty_QueryInterface(IActiveScriptProperty *iface, REFIID riid, void **ppv)
666 JScript *This = ACTSCPPROP_THIS(iface);
667 return IActiveScript_QueryInterface(ACTSCRIPT(This), riid, ppv);
670 static ULONG WINAPI JScriptProperty_AddRef(IActiveScriptProperty *iface)
672 JScript *This = ACTSCPPROP_THIS(iface);
673 return IActiveScript_AddRef(ACTSCRIPT(This));
676 static ULONG WINAPI JScriptProperty_Release(IActiveScriptProperty *iface)
678 JScript *This = ACTSCPPROP_THIS(iface);
679 return IActiveScript_Release(ACTSCRIPT(This));
682 static HRESULT WINAPI JScriptProperty_GetProperty(IActiveScriptProperty *iface, DWORD dwProperty,
683 VARIANT *pvarIndex, VARIANT *pvarValue)
685 JScript *This = ACTSCPPROP_THIS(iface);
686 FIXME("(%p)->(%x %p %p)\n", This, dwProperty, pvarIndex, pvarValue);
690 static HRESULT WINAPI JScriptProperty_SetProperty(IActiveScriptProperty *iface, DWORD dwProperty,
691 VARIANT *pvarIndex, VARIANT *pvarValue)
693 JScript *This = ACTSCPPROP_THIS(iface);
694 FIXME("(%p)->(%x %p %p)\n", This, dwProperty, pvarIndex, pvarValue);
698 #undef ACTSCPPROP_THIS
700 static const IActiveScriptPropertyVtbl JScriptPropertyVtbl = {
701 JScriptProperty_QueryInterface,
702 JScriptProperty_AddRef,
703 JScriptProperty_Release,
704 JScriptProperty_GetProperty,
705 JScriptProperty_SetProperty
708 #define OBJSAFETY_THIS(iface) DEFINE_THIS(JScript, IObjectSafety, iface)
710 static HRESULT WINAPI JScriptSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
712 JScript *This = OBJSAFETY_THIS(iface);
713 return IActiveScript_QueryInterface(ACTSCRIPT(This), riid, ppv);
716 static ULONG WINAPI JScriptSafety_AddRef(IObjectSafety *iface)
718 JScript *This = OBJSAFETY_THIS(iface);
719 return IActiveScript_AddRef(ACTSCRIPT(This));
722 static ULONG WINAPI JScriptSafety_Release(IObjectSafety *iface)
724 JScript *This = OBJSAFETY_THIS(iface);
725 return IActiveScript_Release(ACTSCRIPT(This));
728 #define SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)
730 static HRESULT WINAPI JScriptSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
731 DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions)
733 JScript *This = OBJSAFETY_THIS(iface);
735 TRACE("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), pdwSupportedOptions, pdwEnabledOptions);
737 if(!pdwSupportedOptions || !pdwEnabledOptions)
740 *pdwSupportedOptions = SUPPORTED_OPTIONS;
741 *pdwEnabledOptions = This->safeopt;
746 static HRESULT WINAPI JScriptSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid,
747 DWORD dwOptionSetMask, DWORD dwEnabledOptions)
749 JScript *This = OBJSAFETY_THIS(iface);
751 TRACE("(%p)->(%s %x %x)\n", This, debugstr_guid(riid), dwOptionSetMask, dwEnabledOptions);
753 if(dwOptionSetMask & ~SUPPORTED_OPTIONS)
756 This->safeopt = dwEnabledOptions & dwEnabledOptions;
760 #undef OBJSAFETY_THIS
762 static const IObjectSafetyVtbl JScriptSafetyVtbl = {
763 JScriptSafety_QueryInterface,
764 JScriptSafety_AddRef,
765 JScriptSafety_Release,
766 JScriptSafety_GetInterfaceSafetyOptions,
767 JScriptSafety_SetInterfaceSafetyOptions
770 HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter,
771 REFIID riid, void **ppv)
776 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv);
780 ret = heap_alloc_zero(sizeof(*ret));
782 return E_OUTOFMEMORY;
784 ret->lpIActiveScriptVtbl = &JScriptVtbl;
785 ret->lpIActiveScriptParseVtbl = &JScriptParseVtbl;
786 ret->lpIActiveScriptParseProcedure2Vtbl = &JScriptParseProcedureVtbl;
787 ret->lpIActiveScriptPropertyVtbl = &JScriptPropertyVtbl;
788 ret->lpIObjectSafetyVtbl = &JScriptSafetyVtbl;
790 ret->safeopt = INTERFACE_USES_DISPEX;
792 hres = IActiveScript_QueryInterface(ACTSCRIPT(ret), riid, ppv);
793 IActiveScript_Release(ACTSCRIPT(ret));