jscript: Throw type errors in Boolean functions.
This commit is contained in:
parent
bd87f97e2d
commit
77e93ad8c7
|
@ -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;
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -19,4 +19,5 @@
|
|||
#include <windef.h>
|
||||
|
||||
#define IDS_NOT_DATE 0x138E
|
||||
#define IDS_NOT_BOOL 0x1392
|
||||
#define IDS_INVALID_LENGTH 0x13A5
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue