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