Module: wine Branch: master Commit: 7f2d50f3445e30453d26fc5a7c21d9fb32f4cf2b URL: http://source.winehq.org/git/wine.git/?a=commit;h=7f2d50f3445e30453d26fc5a7c...
Author: Jacek Caban jacek@codeweavers.com Date: Thu Sep 24 00:45:42 2009 +0200
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 88bf9c3..cbdc08b 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 5b215f5..2e4b0aa 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); }