jscript: Pass HRESULTs instead of IDSs to throw_* functions.

This commit is contained in:
Jacek Caban 2010-12-28 15:04:59 +01:00 committed by Alexandre Julliard
parent aab8a1ba3a
commit 7774a0a4c1
17 changed files with 170 additions and 135 deletions

View File

@ -172,7 +172,7 @@ static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
obj = create_activex_object(ctx, progid);
SysFreeString(progid);
if(!obj)
return throw_generic_error(ctx, ei, IDS_CREATE_OBJ_ERROR, NULL);
return throw_generic_error(ctx, ei, JS_E_CANNOT_CREATE_OBJ, NULL);
hres = IUnknown_QueryInterface(obj, &IID_IDispatch, (void**)&disp);
IUnknown_Release(obj);

View File

@ -70,7 +70,7 @@ static HRESULT get_length(script_ctx_t *ctx, vdisp_t *vdisp, jsexcept_t *ei, jsd
}
if(!is_jsdisp(vdisp))
return throw_type_error(ctx, ei, IDS_JSCRIPT_EXPECTED, NULL);
return throw_type_error(ctx, ei, JS_E_JSCRIPT_EXPECTED, NULL);
hres = jsdisp_propget_name(vdisp->u.jsdisp, lengthW, &var, ei, NULL/*FIXME*/);
if(FAILED(hres))
@ -139,7 +139,7 @@ static HRESULT Array_length(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
len = floor(V_R8(&num));
if(len!=(DWORD)len)
return throw_range_error(ctx, ei, IDS_INVALID_LENGTH, NULL);
return throw_range_error(ctx, ei, JS_E_INVALID_LENGTH, NULL);
for(i=len; i<This->length; i++) {
hres = jsdisp_delete_idx(&This->dispex, i);
@ -975,7 +975,7 @@ static HRESULT Array_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
array = array_this(jsthis);
if(!array)
return throw_type_error(ctx, ei, IDS_ARRAY_EXPECTED, NULL);
return throw_type_error(ctx, ei, JS_E_ARRAY_EXPECTED, NULL);
return array_join(ctx, &array->dispex, array->length, default_separatorW, retv, ei, sp);
}
@ -1061,7 +1061,7 @@ static HRESULT Array_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
case INVOKE_PROPERTYGET:
return array_join(ctx, jsthis->u.jsdisp, array_from_vdisp(jsthis)->length, default_separatorW, retv, ei, sp);
default:
@ -1138,7 +1138,7 @@ static HRESULT ArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
case DISPATCH_CONSTRUCT: {
if(arg_cnt(dp) == 1 && V_VT((arg_var = get_arg(dp, 0))) == VT_I4) {
if(V_I4(arg_var) < 0)
return throw_range_error(ctx, ei, IDS_INVALID_LENGTH, NULL);
return throw_range_error(ctx, ei, JS_E_INVALID_LENGTH, NULL);
hres = create_array(ctx, V_I4(arg_var), &obj);
if(FAILED(hres))

View File

@ -49,7 +49,7 @@ static HRESULT Bool_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(bool = bool_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
return throw_type_error(ctx, ei, JS_E_BOOLEAN_EXPECTED, NULL);
if(retv) {
BSTR val;
@ -76,7 +76,7 @@ static HRESULT Bool_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(bool = bool_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_BOOL, NULL);
return throw_type_error(ctx, ei, JS_E_BOOLEAN_EXPECTED, NULL);
if(retv) {
V_VT(retv) = VT_BOOL;
@ -93,7 +93,7 @@ static HRESULT Bool_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;

View File

@ -610,7 +610,7 @@ static HRESULT Date_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
return dateobj_to_string(date, retv);
}
@ -628,7 +628,7 @@ static HRESULT Date_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(isnan(date->time)) {
if(retv) {
@ -669,7 +669,7 @@ static HRESULT Date_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, date->time);
@ -703,7 +703,7 @@ static inline HRESULT create_utc_string(script_ctx_t *ctx, vdisp_t *jsthis,
DWORD lcid_en, week_id, month_id;
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(isnan(date->time)) {
if(retv) {
@ -898,7 +898,7 @@ static HRESULT Date_toDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
DateInstance *date;
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
return dateobj_to_date_string(date, retv);
}
@ -921,7 +921,7 @@ static HRESULT Date_toTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(isnan(date->time)) {
if(retv) {
@ -976,7 +976,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(isnan(date->time)) {
if(retv) {
@ -1019,7 +1019,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(isnan(date->time)) {
if(retv) {
@ -1058,7 +1058,7 @@ static HRESULT Date_getTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, date->time);
@ -1074,7 +1074,7 @@ static HRESULT Date_getFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1093,7 +1093,7 @@ static HRESULT Date_getUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, year_from_time(date->time));
@ -1109,7 +1109,7 @@ static HRESULT Date_getMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1128,7 +1128,7 @@ static HRESULT Date_getUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, month_from_time(date->time));
@ -1144,7 +1144,7 @@ static HRESULT Date_getDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1163,7 +1163,7 @@ static HRESULT Date_getUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, date_from_time(date->time));
@ -1179,7 +1179,7 @@ static HRESULT Date_getDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1198,7 +1198,7 @@ static HRESULT Date_getUTCDay(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, week_day(date->time));
@ -1214,7 +1214,7 @@ static HRESULT Date_getHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1233,7 +1233,7 @@ static HRESULT Date_getUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, hour_from_time(date->time));
@ -1249,7 +1249,7 @@ static HRESULT Date_getMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1268,7 +1268,7 @@ static HRESULT Date_getUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, min_from_time(date->time));
@ -1284,7 +1284,7 @@ static HRESULT Date_getSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1303,7 +1303,7 @@ static HRESULT Date_getUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, sec_from_time(date->time));
@ -1319,7 +1319,7 @@ static HRESULT Date_getMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv) {
DOUBLE time = local_time(date->time, date);
@ -1338,7 +1338,7 @@ static HRESULT Date_getUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, ms_from_time(date->time));
@ -1354,7 +1354,7 @@ static HRESULT Date_getTimezoneOffset(script_ctx_t *ctx, vdisp_t *jsthis, WORD f
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(retv)
num_set_val(retv, floor(
@ -1373,10 +1373,10 @@ static HRESULT Date_setTime(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
@ -1402,10 +1402,10 @@ static HRESULT Date_setMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD fla
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
@ -1434,10 +1434,10 @@ static HRESULT Date_setUTCMilliseconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
@ -1466,10 +1466,10 @@ static HRESULT Date_setSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -1508,10 +1508,10 @@ static HRESULT Date_setUTCSeconds(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = date->time;
@ -1550,10 +1550,10 @@ static HRESULT Date_setMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -1600,10 +1600,10 @@ static HRESULT Date_setUTCMinutes(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = date->time;
@ -1650,10 +1650,10 @@ static HRESULT Date_setHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -1707,10 +1707,10 @@ static HRESULT Date_setUTCHours(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = date->time;
@ -1764,10 +1764,10 @@ static HRESULT Date_setDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
@ -1796,10 +1796,10 @@ static HRESULT Date_setUTCDate(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
hres = to_number(ctx, get_arg(dp, 0), ei, &v);
if(FAILED(hres))
@ -1828,10 +1828,10 @@ static HRESULT Date_setMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -1870,10 +1870,10 @@ static HRESULT Date_setUTCMonth(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = date->time;
@ -1912,10 +1912,10 @@ static HRESULT Date_setFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -1961,10 +1961,10 @@ static HRESULT Date_setUTCFullYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flag
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = date->time;
@ -2008,7 +2008,7 @@ static HRESULT Date_getYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
t = local_time(date->time, date);
if(isnan(t)) {
@ -2036,10 +2036,10 @@ static HRESULT Date_setYear(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
TRACE("\n");
if(!(date = date_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_DATE, NULL);
return throw_type_error(ctx, ei, JS_E_DATE_EXPECTED, NULL);
if(!arg_cnt(dp))
return throw_type_error(ctx, ei, IDS_ARG_NOT_OPT, NULL);
return throw_type_error(ctx, ei, JS_E_MISSING_ARG, NULL);
t = local_time(date->time, date);
@ -2073,7 +2073,7 @@ static HRESULT Date_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPA
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;

View File

@ -81,7 +81,7 @@ static HRESULT exprval_value(script_ctx_t *ctx, exprval_t *val, jsexcept_t *ei,
case EXPRVAL_NAMEREF:
break;
case EXPRVAL_INVALID:
return throw_type_error(ctx, ei, IDS_UNDEFINED, val->u.identifier);
return throw_type_error(ctx, ei, JS_E_UNDEFINED_VARIABLE, val->u.identifier);
}
ERR("type %d\n", val->type);
@ -247,7 +247,7 @@ static HRESULT disp_get_id(script_ctx_t *ctx, IDispatch *disp, BSTR name, DWORD
static HRESULT put_value(script_ctx_t *ctx, exprval_t *ref, VARIANT *v, jsexcept_t *ei)
{
if(ref->type != EXPRVAL_IDREF)
return throw_reference_error(ctx, ei, IDS_ILLEGAL_ASSIGN, NULL);
return throw_reference_error(ctx, ei, JS_E_ILLEGAL_ASSIGN, NULL);
return disp_propput(ctx, ref->u.idref.disp, ref->u.idref.id, v, ei, NULL/*FIXME*/);
}
@ -1560,13 +1560,13 @@ HRESULT new_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags,
if(V_VT(&constr) == VT_NULL) {
VariantClear(&constr);
return throw_type_error(ctx, ei, IDS_OBJECT_EXPECTED, NULL);
return throw_type_error(ctx, ei, JS_E_OBJECT_EXPECTED, NULL);
} else if(V_VT(&constr) != VT_DISPATCH) {
VariantClear(&constr);
return throw_type_error(ctx, ei, IDS_UNSUPPORTED_ACTION, NULL);
return throw_type_error(ctx, ei, JS_E_INVALID_ACTION, NULL);
} else if(!V_DISPATCH(&constr)) {
VariantClear(&constr);
return throw_type_error(ctx, ei, IDS_NO_PROPERTY, NULL);
return throw_type_error(ctx, ei, JS_E_INVALID_PROPERTY, NULL);
}
hres = disp_call(ctx, V_DISPATCH(&constr), DISPID_VALUE,
@ -1604,14 +1604,14 @@ HRESULT call_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags
hres = disp_call(ctx, V_DISPATCH(&exprval.u.var), DISPID_VALUE,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
else
hres = throw_type_error(ctx, ei, IDS_NO_PROPERTY, NULL);
hres = throw_type_error(ctx, ei, JS_E_INVALID_PROPERTY, NULL);
break;
case EXPRVAL_IDREF:
hres = disp_call(ctx, exprval.u.idref.disp, exprval.u.idref.id,
DISPATCH_METHOD, &dp, flags & EXPR_NOVAL ? NULL : &var, ei, NULL/*FIXME*/);
break;
case EXPRVAL_INVALID:
hres = throw_type_error(ctx, ei, IDS_OBJECT_EXPECTED, NULL);
hres = throw_type_error(ctx, ei, JS_E_OBJECT_EXPECTED, NULL);
break;
default:
FIXME("unimplemented type %d\n", exprval.type);
@ -1996,7 +1996,7 @@ static HRESULT instanceof_eval(script_ctx_t *ctx, VARIANT *inst, VARIANT *objv,
static const WCHAR prototypeW[] = {'p','r','o','t','o','t', 'y', 'p','e',0};
if(V_VT(objv) != VT_DISPATCH || !V_DISPATCH(objv))
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
obj = iface_to_jsdisp((IUnknown*)V_DISPATCH(objv));
if(!obj) {
@ -2062,7 +2062,7 @@ static HRESULT in_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *obj, jsexcept_
HRESULT hres;
if(V_VT(obj) != VT_DISPATCH || !V_DISPATCH(obj))
return throw_type_error(ctx, ei, IDS_OBJECT_EXPECTED, NULL);
return throw_type_error(ctx, ei, JS_E_OBJECT_EXPECTED, NULL);
hres = to_string(ctx, lval, ei, &str);
if(FAILED(hres))

View File

@ -132,7 +132,7 @@ static HRESULT Error_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
@ -384,14 +384,17 @@ HRESULT init_error_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
return S_OK;
}
static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str, jsdisp_t *constr)
static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str, jsdisp_t *constr)
{
WCHAR buf[1024], *pos = NULL;
jsdisp_t *err;
HRESULT hres;
if(!is_jscript_error(error))
return error;
buf[0] = '\0';
LoadStringW(jscript_hinstance, id&0xFFFF, buf, sizeof(buf)/sizeof(WCHAR));
LoadStringW(jscript_hinstance, HRESULT_CODE(error), buf, sizeof(buf)/sizeof(WCHAR));
if(str) pos = strchrW(buf, '|');
if(pos) {
@ -402,47 +405,46 @@ static HRESULT throw_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCH
WARN("%s\n", debugstr_w(buf));
id |= JSCRIPT_ERROR;
hres = create_error(ctx, constr, id, buf, &err);
hres = create_error(ctx, constr, error, buf, &err);
if(FAILED(hres))
return hres;
if(ei)
var_set_jsdisp(&ei->var, err);
return id;
return error;
}
HRESULT throw_generic_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_generic_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->error_constr);
return throw_error(ctx, ei, error, str, ctx->error_constr);
}
HRESULT throw_range_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_range_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->range_error_constr);
return throw_error(ctx, ei, error, str, ctx->range_error_constr);
}
HRESULT throw_reference_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_reference_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->reference_error_constr);
return throw_error(ctx, ei, error, str, ctx->reference_error_constr);
}
HRESULT throw_regexp_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_regexp_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->regexp_error_constr);
return throw_error(ctx, ei, error, str, ctx->regexp_error_constr);
}
HRESULT throw_syntax_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_syntax_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->syntax_error_constr);
return throw_error(ctx, ei, error, str, ctx->syntax_error_constr);
}
HRESULT throw_type_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_type_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->type_error_constr);
return throw_error(ctx, ei, error, str, ctx->type_error_constr);
}
HRESULT throw_uri_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str)
HRESULT throw_uri_error(script_ctx_t *ctx, jsexcept_t *ei, HRESULT error, const WCHAR *str)
{
return throw_error(ctx, ei, id, str, ctx->uri_error_constr);
return throw_error(ctx, ei, error, str, ctx->uri_error_constr);
}

View File

@ -343,7 +343,7 @@ static HRESULT Function_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags,
TRACE("\n");
if(!(function = function_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
hres = function_to_string(function, &str);
if(FAILED(hres))
@ -407,7 +407,7 @@ static HRESULT Function_apply(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
TRACE("\n");
if(!(function = function_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
argc = arg_cnt(dp);
if(argc) {
@ -463,7 +463,7 @@ static HRESULT Function_call(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DIS
TRACE("\n");
if(!(function = function_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
argc = arg_cnt(dp);
if(argc) {

View File

@ -803,7 +803,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
i = WideCharToMultiByte(CP_UTF8, 0, ptr, 1, NULL, 0, NULL, NULL)*3;
if(!i) {
SysFreeString(str);
return throw_uri_error(ctx, ei, IDS_URI_INVALID_CHAR, NULL);
return throw_uri_error(ctx, ei, JS_E_INVALID_URI_CHAR, NULL);
}
len += i;

View File

@ -33,8 +33,6 @@
#include "wine/unicode.h"
#include "wine/list.h"
#define JSCRIPT_ERROR 0x800A0000
typedef struct _script_ctx_t script_ctx_t;
typedef struct _exec_ctx_t exec_ctx_t;
typedef struct _dispex_prop_t dispex_prop_t;
@ -226,14 +224,14 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons
jsdisp_t*,jsdisp_t**);
HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*);
HRESULT throw_eval_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_generic_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_range_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_reference_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_regexp_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_syntax_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_type_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_uri_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*);
HRESULT throw_eval_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_generic_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_range_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_reference_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_regexp_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_syntax_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_type_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT throw_uri_error(script_ctx_t*,jsexcept_t*,HRESULT,const WCHAR*);
HRESULT create_object(script_ctx_t*,jsdisp_t*,jsdisp_t**);
HRESULT create_math(script_ctx_t*,jsdisp_t**);
@ -434,6 +432,41 @@ static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
return (ctx->version << 28) | flags;
}
#define FACILITY_JSCRIPT 10
#define MAKE_JSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_JSCRIPT, code)
#define JS_E_TO_PRIMITIVE MAKE_JSERROR(IDS_TO_PRIMITIVE)
#define JS_E_INVALIDARG MAKE_JSERROR(IDS_INVALID_CALL_ARG)
#define JS_E_SUBSCRIPT_OUT_OF_RANGE MAKE_JSERROR(IDS_SUBSCRIPT_OUT_OF_RANGE)
#define JS_E_CANNOT_CREATE_OBJ MAKE_JSERROR(IDS_CREATE_OBJ_ERROR)
#define JS_E_INVALID_PROPERTY MAKE_JSERROR(IDS_NO_PROPERTY)
#define JS_E_INVALID_ACTION MAKE_JSERROR(IDS_UNSUPPORTED_ACTION)
#define JS_E_MISSING_ARG MAKE_JSERROR(IDS_ARG_NOT_OPT)
#define JS_E_SYNTAX MAKE_JSERROR(IDS_SYNTAX_ERROR)
#define JS_E_MISSING_SEMICOLON MAKE_JSERROR(IDS_SEMICOLON)
#define JS_E_MISSING_LBRACKET MAKE_JSERROR(IDS_LBRACKET)
#define JS_E_MISSING_RBRACKET MAKE_JSERROR(IDS_RBRACKET)
#define JS_E_UNTERMINATED_STRING MAKE_JSERROR(IDS_UNTERMINATED_STR)
#define JS_E_FUNCTION_EXPECTED MAKE_JSERROR(IDS_NOT_FUNC)
#define JS_E_DATE_EXPECTED MAKE_JSERROR(IDS_NOT_DATE)
#define JS_E_NUMBER_EXPECTED MAKE_JSERROR(IDS_NOT_NUM)
#define JS_E_OBJECT_EXPECTED MAKE_JSERROR(IDS_OBJECT_EXPECTED)
#define JS_E_ILLEGAL_ASSIGN MAKE_JSERROR(IDS_ILLEGAL_ASSIGN)
#define JS_E_UNDEFINED_VARIABLE MAKE_JSERROR(IDS_UNDEFINED)
#define JS_E_BOOLEAN_EXPECTED MAKE_JSERROR(IDS_NOT_BOOL)
#define JS_E_VBARRAY_EXPECTED MAKE_JSERROR(IDS_NOT_VBARRAY)
#define JS_E_JSCRIPT_EXPECTED MAKE_JSERROR(IDS_JSCRIPT_EXPECTED)
#define JS_E_REGEXP_SYNTAX MAKE_JSERROR(IDS_REGEXP_SYNTAX_ERROR)
#define JS_E_INVALID_URI_CHAR MAKE_JSERROR(IDS_URI_INVALID_CHAR)
#define JS_E_INVALID_LENGTH MAKE_JSERROR(IDS_INVALID_LENGTH)
#define JS_E_ARRAY_EXPECTED MAKE_JSERROR(IDS_ARRAY_EXPECTED)
static inline BOOL is_jscript_error(HRESULT hres)
{
return HRESULT_FACILITY(hres) == FACILITY_JSCRIPT;
}
const char *debugstr_variant(const VARIANT*);
HRESULT WINAPI JScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**);

View File

@ -252,7 +252,7 @@ HRESULT to_primitive(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, VARIANT *ret
jsdisp_release(jsdisp);
WARN("failed\n");
return throw_type_error(ctx, ei, IDS_TO_PRIMITIVE, NULL);
return throw_type_error(ctx, ei, JS_E_TO_PRIMITIVE, NULL);
}
default:
FIXME("Unimplemented for vt %d\n", V_VT(v));

View File

@ -99,7 +99,7 @@ static const struct {
static int lex_error(parser_ctx_t *ctx, HRESULT hres)
{
ctx->hres = JSCRIPT_ERROR|hres;
ctx->hres = MAKE_JSERROR(hres);
ctx->lexer_error = TRUE;
return -1;
}

View File

@ -65,7 +65,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
TRACE("\n");
if(!(number = number_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL);
if(arg_cnt(dp)) {
hres = to_int32(ctx, get_arg(dp, 0), ei, &radix);
@ -73,7 +73,7 @@ static HRESULT Number_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D
return hres;
if(radix<2 || radix>36)
return throw_type_error(ctx, ei, IDS_INVALID_CALL_ARG, NULL);
return throw_type_error(ctx, ei, JS_E_INVALIDARG, NULL);
}
if(V_VT(&number->num) == VT_I4)
@ -215,7 +215,7 @@ static HRESULT Number_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DI
TRACE("\n");
if(!(number = number_this(jsthis)))
return throw_type_error(ctx, ei, IDS_NOT_NUM, NULL);
return throw_type_error(ctx, ei, JS_E_NUMBER_EXPECTED, NULL);
if(retv)
*retv = number->num;
@ -229,7 +229,7 @@ static HRESULT Number_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET:
*retv = number->num;
break;

View File

@ -136,7 +136,7 @@ static HRESULT Object_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET:
V_VT(retv) = VT_BSTR;
V_BSTR(retv) = SysAllocString(default_valueW);

View File

@ -1459,7 +1459,7 @@ static int parser_error(const char *str)
static void set_error(parser_ctx_t *ctx, UINT error)
{
ctx->hres = JSCRIPT_ERROR|error;
ctx->hres = MAKE_JSERROR(error);
}
static BOOL explicit_error(parser_ctx_t *ctx, void *obj, WCHAR next)
@ -1603,7 +1603,7 @@ HRESULT script_parse(script_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
return E_OUTOFMEMORY;
parser_ctx->ref = 1;
parser_ctx->hres = JSCRIPT_ERROR|IDS_SYNTAX_ERROR;
parser_ctx->hres = JS_E_SYNTAX;
parser_ctx->is_html = delimiter && !strcmpiW(delimiter, html_tagW);
parser_ctx->begin = heap_strdupW(code);

View File

@ -3778,7 +3778,7 @@ static HRESULT RegExp_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
default:
FIXME("unimplemented flags %x\n", flags);
return E_NOTIMPL;
@ -4089,7 +4089,7 @@ static HRESULT RegExpConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags
if(is_class(jsdisp, JSCLASS_REGEXP)) {
if(arg_cnt(dp) > 1 && V_VT(get_arg(dp,1)) != VT_EMPTY) {
jsdisp_release(jsdisp);
return throw_regexp_error(ctx, ei, IDS_REGEXP_SYNTAX_ERROR, NULL);
return throw_regexp_error(ctx, ei, JS_E_REGEXP_SYNTAX, NULL);
}
if(retv)

View File

@ -1526,7 +1526,7 @@ static HRESULT String_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
switch(flags) {
case INVOKE_FUNC:
return throw_type_error(ctx, ei, IDS_NOT_FUNC, NULL);
return throw_type_error(ctx, ei, JS_E_FUNCTION_EXPECTED, NULL);
case DISPATCH_PROPERTYGET: {
BSTR str = SysAllocString(This->str);
if(!str)

View File

@ -53,7 +53,7 @@ static HRESULT VBArray_dimensions(script_ctx_t *ctx, vdisp_t *vthis, WORD flags,
vbarray = vbarray_this(vthis);
if(!vbarray)
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
if(retv)
num_set_int(retv, SafeArrayGetDim(vbarray->safearray));
@ -72,11 +72,11 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DI
vbarray = vbarray_this(vthis);
if(!vbarray)
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
size = arg_cnt(dp);
if(size < SafeArrayGetDim(vbarray->safearray))
return throw_range_error(ctx, ei, IDS_SUBSCRIPT_OUT_OF_RANGE, NULL);
return throw_range_error(ctx, ei, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
indexes = heap_alloc(sizeof(int)*size);
if(!indexes)
@ -93,7 +93,7 @@ static HRESULT VBArray_getItem(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DI
hres = SafeArrayGetElement(vbarray->safearray, indexes, (void*)&out);
heap_free(indexes);
if(hres == DISP_E_BADINDEX)
return throw_range_error(ctx, ei, IDS_SUBSCRIPT_OUT_OF_RANGE, NULL);
return throw_range_error(ctx, ei, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
else if(FAILED(hres))
return hres;
@ -114,7 +114,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
vbarray = vbarray_this(vthis);
if(!vbarray)
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
if(arg_cnt(dp)) {
hres = to_int32(ctx, get_arg(dp, 0), ei, &dim);
@ -125,7 +125,7 @@ static HRESULT VBArray_lbound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
hres = SafeArrayGetLBound(vbarray->safearray, dim, &dim);
if(hres == DISP_E_BADINDEX)
return throw_range_error(ctx, ei, IDS_SUBSCRIPT_OUT_OF_RANGE, NULL);
return throw_range_error(ctx, ei, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
else if(FAILED(hres))
return hres;
@ -147,7 +147,7 @@ static HRESULT VBArray_toArray(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DI
vbarray = vbarray_this(vthis);
if(!vbarray)
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
for(i=1; i<=SafeArrayGetDim(vbarray->safearray); i++) {
SafeArrayGetLBound(vbarray->safearray, i, &lbound);
@ -193,7 +193,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
vbarray = vbarray_this(vthis);
if(!vbarray)
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
if(arg_cnt(dp)) {
hres = to_int32(ctx, get_arg(dp, 0), ei, &dim);
@ -204,7 +204,7 @@ static HRESULT VBArray_ubound(script_ctx_t *ctx, vdisp_t *vthis, WORD flags, DIS
hres = SafeArrayGetUBound(vbarray->safearray, dim, &dim);
if(hres == DISP_E_BADINDEX)
return throw_range_error(ctx, ei, IDS_SUBSCRIPT_OUT_OF_RANGE, NULL);
return throw_range_error(ctx, ei, JS_E_SUBSCRIPT_OUT_OF_RANGE, NULL);
else if(FAILED(hres))
return hres;
@ -287,14 +287,14 @@ static HRESULT VBArrayConstr_value(script_ctx_t *ctx, vdisp_t *vthis, WORD flags
switch(flags) {
case DISPATCH_METHOD:
if(arg_cnt(dp)<1 || V_VT((arg = get_arg(dp, 0)))!=(VT_ARRAY|VT_VARIANT))
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
hres = VariantCopy(retv, arg);
return hres;
case DISPATCH_CONSTRUCT:
if(arg_cnt(dp)<1 || V_VT((arg = get_arg(dp, 0)))!=(VT_ARRAY|VT_VARIANT))
return throw_type_error(ctx, ei, IDS_NOT_VBARRAY, NULL);
return throw_type_error(ctx, ei, JS_E_VBARRAY_EXPECTED, NULL);
hres = alloc_vbarray(ctx, NULL, &vbarray);
if(FAILED(hres))