diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c index ab9ef435a2c..2b5152ad3f7 100644 --- a/dlls/jscript/bool.c +++ b/dlls/jscript/bool.c @@ -46,10 +46,8 @@ static HRESULT Bool_toString(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA TRACE("\n"); - if(!is_class(dispex, JSCLASS_BOOLEAN)) { - FIXME("throw TypeError\n"); - return E_FAIL; - } + if(!is_class(dispex, JSCLASS_BOOLEAN)) + return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL); if(retv) { BoolInstance *bool = (BoolInstance*)dispex; @@ -81,10 +79,8 @@ static HRESULT Bool_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM { TRACE("\n"); - if(!is_class(dispex, JSCLASS_BOOLEAN)) { - FIXME("throw TypeError\n"); - return E_FAIL; - } + if(!is_class(dispex, JSCLASS_BOOLEAN)) + return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL); if(retv) { BoolInstance *bool = (BoolInstance*)dispex; diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc index 161b761c419..3a5f9d2f979 100644 --- a/dlls/jscript/jscript_En.rc +++ b/dlls/jscript/jscript_En.rc @@ -23,5 +23,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE { IDS_NOT_DATE "'[object]' is not a date object" + IDS_NOT_BOOL "Boolean object expected" IDS_INVALID_LENGTH "Array length must be a finite positive integer" } diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index 5041e2792d4..6c5f8b09c4d 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -19,4 +19,5 @@ #include #define IDS_NOT_DATE 0x138E +#define IDS_NOT_BOOL 0x1392 #define IDS_INVALID_LENGTH 0x13A5 diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index f36ec80901e..cae853b9c3f 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1299,5 +1299,6 @@ function exception_test(func, type) { } exception_test(function() {arr.toString = Date.prototype.toString; arr.toString();}, "TypeError"); exception_test(function() {Array(-3);}, "RangeError"); +exception_test(function() {arr.toString = Boolean.prototype.toString; arr.toString();}, "TypeError"); reportSuccess();