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");
|
TRACE("\n");
|
||||||
|
|
||||||
if(!is_class(dispex, JSCLASS_BOOLEAN)) {
|
if(!is_class(dispex, JSCLASS_BOOLEAN))
|
||||||
FIXME("throw TypeError\n");
|
return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL);
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(retv) {
|
if(retv) {
|
||||||
BoolInstance *bool = (BoolInstance*)dispex;
|
BoolInstance *bool = (BoolInstance*)dispex;
|
||||||
|
@ -81,10 +79,8 @@ static HRESULT Bool_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
|
||||||
{
|
{
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
if(!is_class(dispex, JSCLASS_BOOLEAN)) {
|
if(!is_class(dispex, JSCLASS_BOOLEAN))
|
||||||
FIXME("throw TypeError\n");
|
return throw_type_error(dispex->ctx, ei, IDS_NOT_BOOL, NULL);
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(retv) {
|
if(retv) {
|
||||||
BoolInstance *bool = (BoolInstance*)dispex;
|
BoolInstance *bool = (BoolInstance*)dispex;
|
||||||
|
|
|
@ -23,5 +23,6 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||||
STRINGTABLE DISCARDABLE
|
STRINGTABLE DISCARDABLE
|
||||||
{
|
{
|
||||||
IDS_NOT_DATE "'[object]' is not a date object"
|
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"
|
IDS_INVALID_LENGTH "Array length must be a finite positive integer"
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,5 @@
|
||||||
#include <windef.h>
|
#include <windef.h>
|
||||||
|
|
||||||
#define IDS_NOT_DATE 0x138E
|
#define IDS_NOT_DATE 0x138E
|
||||||
|
#define IDS_NOT_BOOL 0x1392
|
||||||
#define IDS_INVALID_LENGTH 0x13A5
|
#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() {arr.toString = Date.prototype.toString; arr.toString();}, "TypeError");
|
||||||
exception_test(function() {Array(-3);}, "RangeError");
|
exception_test(function() {Array(-3);}, "RangeError");
|
||||||
|
exception_test(function() {arr.toString = Boolean.prototype.toString; arr.toString();}, "TypeError");
|
||||||
|
|
||||||
reportSuccess();
|
reportSuccess();
|
||||||
|
|
Loading…
Reference in New Issue