Commit da842966 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

jscript: Pass a jsval as the 'this' to disp_call_value.

parent 9d4e93cf
...@@ -1026,9 +1026,10 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, jsval_t vthis, WORD flags ...@@ -1026,9 +1026,10 @@ static HRESULT Array_toLocaleString(script_ctx_t *ctx, jsval_t vthis, WORD flags
static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
IDispatch *context_obj = NULL, *callback; jsval_t context_this = jsval_undefined();
jsval_t value, args[3], res; jsval_t value, args[3], res;
BOOL boolval, ret = TRUE; BOOL boolval, ret = TRUE;
IDispatch *callback;
unsigned length, i; unsigned length, i;
jsdisp_t *jsthis; jsdisp_t *jsthis;
HRESULT hres; HRESULT hres;
...@@ -1053,7 +1054,7 @@ static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne ...@@ -1053,7 +1054,7 @@ static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne
hres = E_NOTIMPL; hres = E_NOTIMPL;
goto done; goto done;
} }
context_obj = get_object(argv[1]); context_this = argv[1];
} }
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
...@@ -1066,7 +1067,7 @@ static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne ...@@ -1066,7 +1067,7 @@ static HRESULT Array_every(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigne
args[0] = value; args[0] = value;
args[1] = jsval_number(i); args[1] = jsval_number(i);
args[2] = jsval_obj(jsthis); args[2] = jsval_obj(jsthis);
hres = disp_call_value(ctx, callback, context_obj, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res);
jsval_release(value); jsval_release(value);
if(FAILED(hres)) if(FAILED(hres))
goto done; goto done;
...@@ -1092,10 +1093,11 @@ done: ...@@ -1092,10 +1093,11 @@ done:
static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
IDispatch *context_obj = NULL, *callback; jsval_t context_this = jsval_undefined();
jsval_t value, args[3], res; jsval_t value, args[3], res;
unsigned length, i, j = 0; unsigned length, i, j = 0;
jsdisp_t *jsthis, *arr; jsdisp_t *jsthis, *arr;
IDispatch *callback;
HRESULT hres; HRESULT hres;
BOOL boolval; BOOL boolval;
...@@ -1119,7 +1121,7 @@ static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign ...@@ -1119,7 +1121,7 @@ static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign
hres = E_NOTIMPL; hres = E_NOTIMPL;
goto done; goto done;
} }
context_obj = get_object(argv[1]); context_this = argv[1];
} }
hres = create_array(ctx, 0, &arr); hres = create_array(ctx, 0, &arr);
...@@ -1138,7 +1140,7 @@ static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign ...@@ -1138,7 +1140,7 @@ static HRESULT Array_filter(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign
args[0] = value; args[0] = value;
args[1] = jsval_number(i); args[1] = jsval_number(i);
args[2] = jsval_obj(jsthis); args[2] = jsval_obj(jsthis);
hres = disp_call_value(ctx, callback, context_obj, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
hres = to_boolean(res, &boolval); hres = to_boolean(res, &boolval);
jsval_release(res); jsval_release(res);
...@@ -1166,8 +1168,9 @@ done: ...@@ -1166,8 +1168,9 @@ done:
static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
IDispatch *context_obj = NULL, *callback; jsval_t context_this = jsval_undefined();
jsval_t value, args[3], res; jsval_t value, args[3], res;
IDispatch *callback;
jsdisp_t *jsthis; jsdisp_t *jsthis;
unsigned length, i; unsigned length, i;
HRESULT hres; HRESULT hres;
...@@ -1192,7 +1195,7 @@ static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig ...@@ -1192,7 +1195,7 @@ static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
hres = E_NOTIMPL; hres = E_NOTIMPL;
goto done; goto done;
} }
context_obj = get_object(argv[1]); context_this = argv[1];
} }
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
...@@ -1205,7 +1208,7 @@ static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig ...@@ -1205,7 +1208,7 @@ static HRESULT Array_forEach(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsig
args[0] = value; args[0] = value;
args[1] = jsval_number(i); args[1] = jsval_number(i);
args[2] = jsval_obj(jsthis); args[2] = jsval_obj(jsthis);
hres = disp_call_value(ctx, callback, context_obj, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res);
jsval_release(value); jsval_release(value);
if(FAILED(hres)) if(FAILED(hres))
goto done; goto done;
...@@ -1341,9 +1344,10 @@ done: ...@@ -1341,9 +1344,10 @@ done:
static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{ {
IDispatch *context_this = NULL, *callback; jsval_t context_this = jsval_undefined();
jsval_t callback_args[3], mapped_value; jsval_t callback_args[3], mapped_value;
jsdisp_t *jsthis, *array; jsdisp_t *jsthis, *array;
IDispatch *callback;
UINT32 length, k; UINT32 length, k;
HRESULT hres; HRESULT hres;
...@@ -1365,7 +1369,7 @@ static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned ...@@ -1365,7 +1369,7 @@ static HRESULT Array_map(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
if(argc > 1) { if(argc > 1) {
if(is_object_instance(argv[1])) { if(is_object_instance(argv[1])) {
context_this = get_object(argv[1]); context_this = argv[1];
}else if(!is_undefined(argv[1])) { }else if(!is_undefined(argv[1])) {
FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1])); FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1]));
hres = E_NOTIMPL; hres = E_NOTIMPL;
...@@ -1407,9 +1411,9 @@ done: ...@@ -1407,9 +1411,9 @@ done:
static HRESULT Array_reduce(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r) static HRESULT Array_reduce(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{ {
IDispatch *context_this = NULL, *callback;
jsval_t callback_args[4], acc, new_acc; jsval_t callback_args[4], acc, new_acc;
BOOL have_value = FALSE; BOOL have_value = FALSE;
IDispatch *callback;
jsdisp_t *jsthis; jsdisp_t *jsthis;
UINT32 length, k; UINT32 length, k;
HRESULT hres; HRESULT hres;
...@@ -1453,7 +1457,7 @@ static HRESULT Array_reduce(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign ...@@ -1453,7 +1457,7 @@ static HRESULT Array_reduce(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsign
callback_args[0] = acc; callback_args[0] = acc;
callback_args[2] = jsval_number(k); callback_args[2] = jsval_number(k);
callback_args[3] = jsval_obj(jsthis); callback_args[3] = jsval_obj(jsthis);
hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, ARRAY_SIZE(callback_args), callback_args, &new_acc); hres = disp_call_value(ctx, callback, jsval_undefined(), DISPATCH_METHOD, ARRAY_SIZE(callback_args), callback_args, &new_acc);
jsval_release(callback_args[1]); jsval_release(callback_args[1]);
if(FAILED(hres)) if(FAILED(hres))
break; break;
...@@ -1479,9 +1483,10 @@ done: ...@@ -1479,9 +1483,10 @@ done:
static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv, static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
IDispatch *context_obj = NULL, *callback; jsval_t context_this = jsval_undefined();
jsval_t value, args[3], res; jsval_t value, args[3], res;
BOOL boolval, ret = FALSE; BOOL boolval, ret = FALSE;
IDispatch *callback;
unsigned length, i; unsigned length, i;
jsdisp_t *jsthis; jsdisp_t *jsthis;
HRESULT hres; HRESULT hres;
...@@ -1506,7 +1511,7 @@ static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned ...@@ -1506,7 +1511,7 @@ static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
hres = E_NOTIMPL; hres = E_NOTIMPL;
goto done; goto done;
} }
context_obj = get_object(argv[1]); context_this = argv[1];
} }
for(i = 0; i < length; i++) { for(i = 0; i < length; i++) {
...@@ -1519,7 +1524,7 @@ static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned ...@@ -1519,7 +1524,7 @@ static HRESULT Array_some(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsigned
args[0] = value; args[0] = value;
args[1] = jsval_number(i); args[1] = jsval_number(i);
args[2] = jsval_obj(jsthis); args[2] = jsval_obj(jsthis);
hres = disp_call_value(ctx, callback, context_obj, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); hres = disp_call_value(ctx, callback, context_this, DISPATCH_METHOD, ARRAY_SIZE(args), args, &res);
jsval_release(value); jsval_release(value);
if(FAILED(hres)) if(FAILED(hres))
goto done; goto done;
......
...@@ -573,7 +573,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t ...@@ -573,7 +573,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
TRACE("call %s %p\n", debugstr_w(prop->name), get_object(prop->u.val)); TRACE("call %s %p\n", debugstr_w(prop->name), get_object(prop->u.val));
return disp_call_value(This->ctx, get_object(prop->u.val), return disp_call_value(This->ctx, get_object(prop->u.val),
jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface, jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface),
flags, argc, argv, r); flags, argc, argv, r);
} }
case PROP_ACCESSOR: case PROP_ACCESSOR:
...@@ -586,7 +586,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t ...@@ -586,7 +586,7 @@ static HRESULT invoke_prop_func(jsdisp_t *This, IDispatch *jsthis, dispex_prop_t
if(is_object_instance(val)) { if(is_object_instance(val)) {
hres = disp_call_value(This->ctx, get_object(val), hres = disp_call_value(This->ctx, get_object(val),
jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface, jsval_disp(jsthis ? jsthis : (IDispatch*)&This->IDispatchEx_iface),
flags, argc, argv, r); flags, argc, argv, r);
}else { }else {
FIXME("invoke %s\n", debugstr_jsval(val)); FIXME("invoke %s\n", debugstr_jsval(val));
...@@ -2189,10 +2189,11 @@ HRESULT disp_call_name(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, WO ...@@ -2189,10 +2189,11 @@ HRESULT disp_call_name(script_ctx_t *ctx, IDispatch *disp, const WCHAR *name, WO
return disp_call(ctx, disp, id, flags, argc, argv, ret); return disp_call(ctx, disp, id, flags, argc, argv, ret);
} }
HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, WORD flags, unsigned argc, jsval_t *argv, HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, jsval_t vthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r) jsval_t *r)
{ {
VARIANT buf[6], retv, *args = buf; VARIANT buf[6], retv, *args = buf;
IDispatch *jsthis;
jsdisp_t *jsdisp; jsdisp_t *jsdisp;
DISPPARAMS dp; DISPPARAMS dp;
unsigned i; unsigned i;
...@@ -2204,13 +2205,22 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W ...@@ -2204,13 +2205,22 @@ HRESULT disp_call_value(script_ctx_t *ctx, IDispatch *disp, IDispatch *jsthis, W
jsdisp = iface_to_jsdisp(disp); jsdisp = iface_to_jsdisp(disp);
if(jsdisp && jsdisp->ctx == ctx) { if(jsdisp && jsdisp->ctx == ctx) {
hres = jsdisp_call_value(jsdisp, jsthis ? jsval_disp(jsthis) : jsval_undefined(), flags, argc, argv, r); hres = jsdisp_call_value(jsdisp, vthis, flags, argc, argv, r);
jsdisp_release(jsdisp); jsdisp_release(jsdisp);
return hres; return hres;
} }
if(jsdisp) if(jsdisp)
jsdisp_release(jsdisp); jsdisp_release(jsdisp);
if(is_undefined(vthis))
jsthis = NULL;
else if(is_object_instance(vthis))
jsthis = get_object(vthis);
else {
FIXME("Unimplemented 'this' passed to host object: %s\n", debugstr_jsval(vthis));
return E_NOTIMPL;
}
flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK; flags &= ~DISPATCH_JSCRIPT_INTERNAL_MASK;
if(r && argc && flags == DISPATCH_METHOD) if(r && argc && flags == DISPATCH_METHOD)
flags |= DISPATCH_PROPERTYGET; flags |= DISPATCH_PROPERTYGET;
......
...@@ -327,7 +327,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig ...@@ -327,7 +327,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig
return E_FAIL; return E_FAIL;
} }
return disp_call_value(ctx, get_object(v), NULL, flags, argc, argv, r); return disp_call_value(ctx, get_object(v), jsval_undefined(), flags, argc, argv, r);
} }
case EXPRVAL_IDREF: case EXPRVAL_IDREF:
/* ECMA-262 3rd Edition 11.2.3.7 / ECMA-262 5.1 Edition 11.2.3.6 * /* ECMA-262 3rd Edition 11.2.3.7 / ECMA-262 5.1 Edition 11.2.3.6 *
...@@ -340,7 +340,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig ...@@ -340,7 +340,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig
FIXME("invoke %s\n", debugstr_jsval(v)); FIXME("invoke %s\n", debugstr_jsval(v));
hres = E_FAIL; hres = E_FAIL;
}else { }else {
hres = disp_call_value(ctx, get_object(v), NULL, flags, argc, argv, r); hres = disp_call_value(ctx, get_object(v), jsval_undefined(), flags, argc, argv, r);
} }
jsval_release(v); jsval_release(v);
return hres; return hres;
...@@ -351,7 +351,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig ...@@ -351,7 +351,7 @@ static HRESULT exprval_call(script_ctx_t *ctx, exprval_t *ref, WORD flags, unsig
hres = to_object(ctx, ref->u.val, &obj); hres = to_object(ctx, ref->u.val, &obj);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
hres = disp_call_value(ctx, obj, NULL, flags, argc, argv, r); hres = disp_call_value(ctx, obj, jsval_undefined(), flags, argc, argv, r);
IDispatch_Release(obj); IDispatch_Release(obj);
} }
return hres; return hres;
...@@ -1380,7 +1380,7 @@ static HRESULT interp_new(script_ctx_t *ctx) ...@@ -1380,7 +1380,7 @@ static HRESULT interp_new(script_ctx_t *ctx)
return JS_E_INVALID_ACTION; return JS_E_INVALID_ACTION;
clear_acc(ctx); clear_acc(ctx);
return disp_call_value(ctx, get_object(constr), NULL, DISPATCH_CONSTRUCT | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, return disp_call_value(ctx, get_object(constr), jsval_undefined(), DISPATCH_CONSTRUCT | DISPATCH_JSCRIPT_CALLEREXECSSOURCE,
argc, stack_args(ctx, argc), &ctx->acc); argc, stack_args(ctx, argc), &ctx->acc);
} }
...@@ -1398,7 +1398,7 @@ static HRESULT interp_call(script_ctx_t *ctx) ...@@ -1398,7 +1398,7 @@ static HRESULT interp_call(script_ctx_t *ctx)
return JS_E_INVALID_PROPERTY; return JS_E_INVALID_PROPERTY;
clear_acc(ctx); clear_acc(ctx);
return disp_call_value(ctx, get_object(obj), NULL, DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE, return disp_call_value(ctx, get_object(obj), jsval_undefined(), DISPATCH_METHOD | DISPATCH_JSCRIPT_CALLEREXECSSOURCE,
argn, stack_args(ctx, argn), do_ret ? &ctx->acc : NULL); argn, stack_args(ctx, argn), do_ret ? &ctx->acc : NULL);
} }
......
...@@ -386,8 +386,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi ...@@ -386,8 +386,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, jsval_t vthis, WORD flags, unsi
hres = function->vtbl->call(ctx, function, this_val, flags, cnt, args, r); hres = function->vtbl->call(ctx, function, this_val, flags, cnt, args, r);
}else { }else {
jsval_t res; jsval_t res;
hres = disp_call_value(ctx, get_object(vthis), is_object_instance(this_val) ? get_object(this_val) : NULL, hres = disp_call_value(ctx, get_object(vthis), this_val, DISPATCH_METHOD, cnt, args, &res);
DISPATCH_METHOD, cnt, args, &res);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
if(r) if(r)
*r = res; *r = res;
......
...@@ -225,7 +225,7 @@ HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,js ...@@ -225,7 +225,7 @@ HRESULT init_dispex_from_constr(jsdisp_t*,script_ctx_t*,const builtin_info_t*,js
HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT disp_call(script_ctx_t*,IDispatch*,DISPID,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT disp_call_name(script_ctx_t*,IDispatch*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT disp_call_name(script_ctx_t*,IDispatch*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT disp_call_value(script_ctx_t*,IDispatch*,IDispatch*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT disp_call_value(script_ctx_t*,IDispatch*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_call_value(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_call_value(jsdisp_t*,jsval_t,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_call(jsdisp_t*,DISPID,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_call(jsdisp_t*,DISPID,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_call_name(jsdisp_t*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN; HRESULT jsdisp_call_name(jsdisp_t*,const WCHAR*,WORD,unsigned,jsval_t*,jsval_t*) DECLSPEC_HIDDEN;
......
...@@ -350,7 +350,7 @@ static jsval_t transform_json_object(struct transform_json_object_ctx *proc_ctx, ...@@ -350,7 +350,7 @@ static jsval_t transform_json_object(struct transform_json_object_ctx *proc_ctx,
} }
args[0] = jsval_string(name); args[0] = jsval_string(name);
proc_ctx->hres = disp_call_value(proc_ctx->ctx, proc_ctx->reviver, (IDispatch*)&holder->IDispatchEx_iface, proc_ctx->hres = disp_call_value(proc_ctx->ctx, proc_ctx->reviver, jsval_obj(holder),
DISPATCH_METHOD, ARRAY_SIZE(args), args, &res); DISPATCH_METHOD, ARRAY_SIZE(args), args, &res);
return FAILED(proc_ctx->hres) ? jsval_undefined() : res; return FAILED(proc_ctx->hres) ? jsval_undefined() : res;
} }
......
...@@ -184,7 +184,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval ...@@ -184,7 +184,7 @@ static HRESULT set_map_entry(MapInstance *map, jsval_t key, jsval_t value, jsval
static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, jsval_t *argv, jsval_t *r) static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, jsval_t *argv, jsval_t *r)
{ {
struct list *iter = list_head(&map->entries); struct list *iter = list_head(&map->entries);
IDispatch *context_obj = NULL; jsval_t context_this = jsval_undefined();
HRESULT hres; HRESULT hres;
if(!argc || !is_object_instance(argv[0])) { if(!argc || !is_object_instance(argv[0])) {
...@@ -197,7 +197,7 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j ...@@ -197,7 +197,7 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j
FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1])); FIXME("Unsupported context this %s\n", debugstr_jsval(argv[1]));
return E_NOTIMPL; return E_NOTIMPL;
} }
context_obj = get_object(argv[1]); context_this = argv[1];
} }
while(iter) { while(iter) {
...@@ -213,8 +213,7 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j ...@@ -213,8 +213,7 @@ static HRESULT iterate_map(MapInstance *map, script_ctx_t *ctx, unsigned argc, j
args[1] = entry->key; args[1] = entry->key;
args[2] = jsval_obj(&map->dispex); args[2] = jsval_obj(&map->dispex);
grab_map_entry(entry); grab_map_entry(entry);
hres = disp_call_value(ctx, get_object(argv[0]), context_obj, hres = disp_call_value(ctx, get_object(argv[0]), context_this, DISPATCH_METHOD, ARRAY_SIZE(args), args, &v);
DISPATCH_METHOD, ARRAY_SIZE(args), args, &v);
iter = list_next(&map->entries, iter); iter = list_next(&map->entries, iter);
release_map_entry(entry); release_map_entry(entry);
if(FAILED(hres)) if(FAILED(hres))
......
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