jscript: Throw type errors in Date functions.

This commit is contained in:
Piotr Caban 2009-07-20 18:18:07 +02:00 committed by Alexandre Julliard
parent 77e93ad8c7
commit 5b21893abf
1 changed files with 82 additions and 164 deletions

View File

@ -613,10 +613,8 @@ static HRESULT Date_toLocaleString(DispatchEx *dispex, LCID lcid, WORD flags, DI
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -677,10 +675,8 @@ static HRESULT Date_valueOf(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -718,10 +714,8 @@ static HRESULT Date_toUTCString(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -827,10 +821,8 @@ static HRESULT Date_toDateString(DispatchEx *dispex, LCID lcid, WORD flags, DISP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -925,10 +917,8 @@ static HRESULT Date_toTimeString(DispatchEx *dispex, LCID lcid, WORD flags, DISP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -984,10 +974,8 @@ static HRESULT Date_toLocaleDateString(DispatchEx *dispex, LCID lcid, WORD flags
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -1031,10 +1019,8 @@ static HRESULT Date_toLocaleTimeString(DispatchEx *dispex, LCID lcid, WORD flags
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
@ -1072,10 +1058,8 @@ static HRESULT Date_getTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1090,10 +1074,8 @@ static HRESULT Date_getFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1110,10 +1092,8 @@ static HRESULT Date_getUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DI
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1128,10 +1108,8 @@ static HRESULT Date_getMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1148,10 +1126,8 @@ static HRESULT Date_getUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1166,10 +1142,8 @@ static HRESULT Date_getDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1186,10 +1160,8 @@ static HRESULT Date_getUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1204,10 +1176,8 @@ static HRESULT Date_getDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAMS
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1224,10 +1194,8 @@ static HRESULT Date_getUTCDay(DispatchEx *dispex, LCID lcid, WORD flags, DISPPAR
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1242,10 +1210,8 @@ static HRESULT Date_getHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1262,10 +1228,8 @@ static HRESULT Date_getUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1280,10 +1244,8 @@ static HRESULT Date_getMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1300,10 +1262,8 @@ static HRESULT Date_getUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DIS
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1318,10 +1278,8 @@ static HRESULT Date_getSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1338,10 +1296,8 @@ static HRESULT Date_getUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DIS
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1356,10 +1312,8 @@ static HRESULT Date_getMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1376,10 +1330,8 @@ static HRESULT Date_getUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1394,10 +1346,8 @@ static HRESULT Date_getTimezoneOffset(DispatchEx *dispex, LCID lcid, WORD flags,
{
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(retv) {
DateInstance *date = (DateInstance*)dispex;
@ -1417,10 +1367,8 @@ static HRESULT Date_setTime(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1452,10 +1400,8 @@ static HRESULT Date_setMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags, D
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1490,10 +1436,8 @@ static HRESULT Date_setUTCMilliseconds(DispatchEx *dispex, LCID lcid, WORD flags
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1528,10 +1472,8 @@ static HRESULT Date_setSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1576,10 +1518,8 @@ static HRESULT Date_setUTCSeconds(DispatchEx *dispex, LCID lcid, WORD flags, DIS
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1624,10 +1564,8 @@ static HRESULT Date_setMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1680,10 +1618,8 @@ static HRESULT Date_setUTCMinutes(DispatchEx *dispex, LCID lcid, WORD flags, DIS
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1736,10 +1672,8 @@ static HRESULT Date_setHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1799,10 +1733,8 @@ static HRESULT Date_setUTCHours(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1862,10 +1794,8 @@ static HRESULT Date_setDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1900,10 +1830,8 @@ static HRESULT Date_setUTCDate(DispatchEx *dispex, LCID lcid, WORD flags, DISPPA
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1938,10 +1866,8 @@ static HRESULT Date_setMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARA
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -1986,10 +1912,8 @@ static HRESULT Date_setUTCMonth(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -2034,10 +1958,8 @@ static HRESULT Date_setFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPP
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -2089,10 +2011,8 @@ static HRESULT Date_setUTCFullYear(DispatchEx *dispex, LCID lcid, WORD flags, DI
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
if(!arg_cnt(dp)) {
FIXME("throw ArgumentNotOptional\n");
@ -2142,10 +2062,8 @@ static HRESULT Date_getYear(DispatchEx *dispex, LCID lcid, WORD flags, DISPPARAM
TRACE("\n");
if(!is_class(dispex, JSCLASS_DATE)) {
FIXME("throw TypeError\n");
return E_FAIL;
}
if(!is_class(dispex, JSCLASS_DATE))
return throw_type_error(dispex->ctx, ei, IDS_NOT_DATE, NULL);
date = (DateInstance*)dispex;
t = local_time(date->time, date);