mirror of
https://github.com/reactos/wine.git
synced 2024-11-30 07:00:30 +00:00
jscript: Allow this_obj to be host object in call_function.
This commit is contained in:
parent
f8c2b42de4
commit
37c2d43e28
@ -281,21 +281,15 @@ static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDis
|
|||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
if(function->value_proc) {
|
if(function->value_proc) {
|
||||||
DispatchEx *jsthis = NULL;
|
|
||||||
vdisp_t vthis;
|
vdisp_t vthis;
|
||||||
|
|
||||||
if(this_obj) {
|
if(this_obj)
|
||||||
jsthis = iface_to_jsdisp((IUnknown*)this_obj);
|
set_disp(&vthis, this_obj);
|
||||||
if(!jsthis)
|
else
|
||||||
FIXME("this_obj is not DispatchEx\n");
|
set_jsdisp(&vthis, ctx->script_disp);
|
||||||
}
|
|
||||||
|
|
||||||
set_jsdisp(&vthis, jsthis ? jsthis : ctx->script_disp);
|
|
||||||
hres = function->value_proc(ctx, &vthis, DISPATCH_METHOD, args, retv, ei, caller);
|
hres = function->value_proc(ctx, &vthis, DISPATCH_METHOD, args, retv, ei, caller);
|
||||||
vdisp_release(&vthis);
|
vdisp_release(&vthis);
|
||||||
|
|
||||||
if(jsthis)
|
|
||||||
jsdisp_release(jsthis);
|
|
||||||
}else {
|
}else {
|
||||||
hres = invoke_source(ctx, function, this_obj ? this_obj : (IDispatch*)_IDispatchEx_(ctx->script_disp),
|
hres = invoke_source(ctx, function, this_obj ? this_obj : (IDispatch*)_IDispatchEx_(ctx->script_disp),
|
||||||
args, retv, ei, caller);
|
args, retv, ei, caller);
|
||||||
|
@ -912,6 +912,10 @@ static void run_tests(void)
|
|||||||
parse_script_a("ok(String(testObj) === '1', 'wrong testObj value');");
|
parse_script_a("ok(String(testObj) === '1', 'wrong testObj value');");
|
||||||
CHECK_CALLED(testobj_value);
|
CHECK_CALLED(testobj_value);
|
||||||
|
|
||||||
|
SET_EXPECT(testobj_value);
|
||||||
|
parse_script_a("ok(String.prototype.concat.call(testObj, ' OK') === '1 OK', 'wrong concat result');");
|
||||||
|
CHECK_CALLED(testobj_value);
|
||||||
|
|
||||||
run_from_res("lang.js");
|
run_from_res("lang.js");
|
||||||
run_from_res("api.js");
|
run_from_res("api.js");
|
||||||
run_from_res("regexp.js");
|
run_from_res("regexp.js");
|
||||||
|
Loading…
Reference in New Issue
Block a user