Commit e050ff5e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

vbscript: Move OnEnterScript/OnLeaveScript calls to exec_script.

parent 1de8e293
......@@ -588,7 +588,7 @@ static HRESULT do_icall(exec_ctx_t *ctx, VARIANT *res)
break;
case REF_FUNC:
vbstack_to_dp(ctx, arg_cnt, FALSE, &dp);
hres = exec_script(ctx->script, ref.u.f, NULL, &dp, res);
hres = exec_script(ctx->script, FALSE, ref.u.f, NULL, &dp, res);
if(FAILED(hres))
return hres;
break;
......@@ -2086,7 +2086,7 @@ static void release_exec(exec_ctx_t *ctx)
heap_free(ctx->stack);
}
HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
HRESULT exec_script(script_ctx_t *ctx, BOOL extern_caller, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res)
{
exec_ctx_t exec = {func->code_ctx};
vbsop_t op;
......@@ -2148,6 +2148,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
return E_OUTOFMEMORY;
}
if(extern_caller)
IActiveScriptSite_OnEnterScript(ctx->site);
if(vbthis) {
exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface;
exec.vbthis = vbthis;
......@@ -2220,6 +2223,9 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPP
assert(!exec.top);
if(extern_caller)
IActiveScriptSite_OnLeaveScript(ctx->site);
if(SUCCEEDED(hres) && res) {
*res = exec.ret_val;
V_VT(&exec.ret_val) = VT_EMPTY;
......
......@@ -260,7 +260,7 @@ static BOOL run_terminator(vbdisp_t *This)
return TRUE;
This->ref++;
exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
exec_script(This->desc->ctx, FALSE, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET],
This, &dp, NULL);
return !--This->ref;
}
......@@ -426,7 +426,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
return exec_script(This->desc->ctx, func, This, pdp, pvarRes);
return exec_script(This->desc->ctx, FALSE, func, This, pdp, pvarRes);
case DISPATCH_METHOD:
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
......@@ -436,7 +436,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
return exec_script(This->desc->ctx, func, This, pdp, pvarRes);
return exec_script(This->desc->ctx, FALSE, func, This, pdp, pvarRes);
case DISPATCH_PROPERTYPUT:
case DISPATCH_PROPERTYPUTREF:
case DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF: {
......@@ -461,7 +461,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
return DISP_E_MEMBERNOTFOUND;
}
hres = exec_script(This->desc->ctx, func, This, &dp, NULL);
hres = exec_script(This->desc->ctx, FALSE, func, This, &dp, NULL);
if(needs_release)
VariantClear(&put_val);
return hres;
......@@ -605,7 +605,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
if(SUCCEEDED(hres) && desc->class_initialize_id) {
DISPPARAMS dp = {0};
hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET],
hres = exec_script(desc->ctx, FALSE, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET],
vbdisp, &dp, NULL);
}
......@@ -621,15 +621,8 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret)
static HRESULT Procedure_invoke(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res)
{
script_ctx_t *ctx = This->desc->ctx;
HRESULT hres;
TRACE("\n");
IActiveScriptSite_OnEnterScript(ctx->site);
hres = exec_script(ctx, This->desc->value_func, NULL, NULL, res);
IActiveScriptSite_OnLeaveScript(ctx->site);
return hres;
return exec_script(ctx, TRUE, This->desc->value_func, NULL, NULL, res);
}
static const builtin_prop_t procedure_props[] = {
......@@ -884,9 +877,7 @@ static HRESULT WINAPI ScriptDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc
switch(wFlags) {
case DISPATCH_METHOD:
case DISPATCH_METHOD|DISPATCH_PROPERTYGET:
IActiveScriptSite_OnEnterScript(This->ctx->site);
hres = exec_script(This->ctx, ident->u.func, NULL, pdp, pvarRes);
IActiveScriptSite_OnLeaveScript(This->ctx->site);
hres = exec_script(This->ctx, TRUE, ident->u.func, NULL, pdp, pvarRes);
break;
default:
FIXME("Unsupported flags %x\n", wFlags);
......
......@@ -78,15 +78,8 @@ static inline BOOL is_started(VBScript *This)
static HRESULT exec_global_code(script_ctx_t *ctx, vbscode_t *code, VARIANT *res)
{
HRESULT hres;
code->pending_exec = FALSE;
IActiveScriptSite_OnEnterScript(ctx->site);
hres = exec_script(ctx, &code->main_code, NULL, NULL, res);
IActiveScriptSite_OnLeaveScript(ctx->site);
return hres;
return exec_script(ctx, TRUE, &code->main_code, NULL, NULL, res);
}
static void exec_queued_code(script_ctx_t *ctx)
......
......@@ -356,7 +356,7 @@ struct _vbscode_t {
void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN;
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,DWORD,vbscode_t**) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
HRESULT exec_script(script_ctx_t*,BOOL,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN;
void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN;
IDispatch *lookup_named_item(script_ctx_t*,const WCHAR*,unsigned) DECLSPEC_HIDDEN;
void clear_ei(EXCEPINFO*) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment