jscript: Allow 'this' to be host object in invoke_value_proc.

This commit is contained in:
Jacek Caban 2009-09-23 16:20:27 +02:00 committed by Alexandre Julliard
parent 461180459b
commit 8717c388f8

View File

@ -257,21 +257,19 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function,
static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, WORD flags, DISPPARAMS *dp,
VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller)
{
DispatchEx *this_obj = NULL;
IDispatch *this_disp;
vdisp_t vthis;
HRESULT hres;
this_disp = get_this(dp);
if(this_disp)
this_obj = iface_to_jsdisp((IUnknown*)this_disp);
set_disp(&vthis, this_disp);
else
set_jsdisp(&vthis, ctx->script_disp);
set_jsdisp(&vthis, this_obj ? this_obj : ctx->script_disp);
hres = function->value_proc(ctx, &vthis, flags, dp, retv, ei, caller);
vdisp_release(&vthis);
if(this_obj)
jsdisp_release(this_obj);
vdisp_release(&vthis);
return hres;
}