From 7f2d50f3445e30453d26fc5a7c21d9fb32f4cf2b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 24 Sep 2009 00:45:42 +0200 Subject: [PATCH] jscript: Throw type error from call and apply functions. --- dlls/jscript/function.c | 13 ++++--------- dlls/jscript/tests/api.js | 8 ++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 88bf9c3d9f6..cbdc08b953e 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -416,13 +416,10 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI TRACE("\n"); - if(!(function = function_from_vdisp(jsthis))) { - FIXME("dispex is not a function\n"); - return E_FAIL; - } + if(!(function = function_this(jsthis))) + return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL); argc = arg_cnt(dp); - if(argc) { hres = to_object(ctx, get_arg(dp,0), &this_obj); if(FAILED(hres)) @@ -471,10 +468,8 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS TRACE("\n"); - if(!(function = function_from_vdisp(jsthis))) { - FIXME("dispex is not a function\n"); - return E_FAIL; - } + if(!(function = function_this(jsthis))) + return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL); argc = arg_cnt(dp); if(argc) { diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 5b215f51b8b..2e4b0aaebd1 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1688,6 +1688,14 @@ function testArrayThis(func) { testArrayThis("toString"); +function testFunctionThis(func) { + testThisExcept(Function.prototype[func], -2146823286); +} + +testFunctionThis("toString"); +testFunctionThis("call"); +testFunctionThis("apply"); + function testArrayHostThis(func) { exception_test(function() { Array.prototype[func].call(testObj); }, "TypeError", -2146823274); }