jscript: Allow this_obj to be host object in call_function.

This commit is contained in:
Jacek Caban 2009-09-23 16:19:29 +02:00 committed by Alexandre Julliard
parent f8c2b42de4
commit 37c2d43e28
2 changed files with 8 additions and 10 deletions

View File

@ -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);

View File

@ -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");