Commit 37c2d43e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Allow this_obj to be host object in call_function.

parent f8c2b42d
......@@ -281,21 +281,15 @@ static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDis
HRESULT hres;
if(function->value_proc) {
DispatchEx *jsthis = NULL;
vdisp_t vthis;
if(this_obj) {
jsthis = iface_to_jsdisp((IUnknown*)this_obj);
if(!jsthis)
FIXME("this_obj is not DispatchEx\n");
}
if(this_obj)
set_disp(&vthis, this_obj);
else
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);
vdisp_release(&vthis);
if(jsthis)
jsdisp_release(jsthis);
}else {
hres = invoke_source(ctx, function, this_obj ? this_obj : (IDispatch*)_IDispatchEx_(ctx->script_disp),
args, retv, ei, caller);
......
......@@ -912,6 +912,10 @@ static void run_tests(void)
parse_script_a("ok(String(testObj) === '1', 'wrong 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("api.js");
run_from_res("regexp.js");
......
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