diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index dac8d3e23b0..6ac668cf80a 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -272,10 +272,8 @@ static HRESULT Function_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISP TRACE("\n"); - if(!is_class(dispex, JSCLASS_FUNCTION)) { - FIXME("throw TypeError\n"); - return E_FAIL; - } + if(!is_class(dispex, JSCLASS_FUNCTION)) + return throw_type_error(dispex->ctx, ei, IDS_NOT_FUNC, NULL); function = (FunctionInstance*)dispex; diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc index e0825e94d40..5e53f6d245a 100644 --- a/dlls/jscript/jscript_En.rc +++ b/dlls/jscript/jscript_En.rc @@ -25,6 +25,7 @@ STRINGTABLE DISCARDABLE IDS_INVALID_CALL_ARG "Invalid procedure call or argument" IDS_NO_PROPERTY "Object doesn't support this property or method" IDS_ARG_NOT_OPT "Argument not optional" + IDS_NOT_FUNC "Function expected" IDS_NOT_DATE "'[object]' is not a date object" IDS_NOT_NUM "Number expected" IDS_UNDEFINED "'|' is undefined" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 3aa014e538a..91d14d36d70 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -21,6 +21,7 @@ #define IDS_INVALID_CALL_ARG 0x0005 #define IDS_NO_PROPERTY 0x01B6 #define IDS_ARG_NOT_OPT 0x01c1 +#define IDS_NOT_FUNC 0x138A #define IDS_NOT_DATE 0x138E #define IDS_NOT_NUM 0x1389 #define IDS_UNDEFINED 0x1391 diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index b663dad0d3c..2ed8bda2209 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1314,5 +1314,6 @@ exception_test(function() {arr.test();}, "TypeError", -2146827850); exception_test(function() {arr.toString = Number.prototype.toString; arr.toString();}, "TypeError", -2146823287); exception_test(function() {(new Number(3)).toString(1);}, "TypeError", -2146828283); exception_test(function() {not_existing_variable.something();}, "TypeError", -2146823279); +exception_test(function() {arr.toString = Function.prototype.toString; arr.toString();}, "TypeError", -2146823286); reportSuccess();