Commit 90d3569c authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Don't use builtin property for *Error constructors.

parent b7a27333
......@@ -112,71 +112,6 @@ static WCHAR int_to_char(int i)
return 'A'+i-10;
}
static HRESULT constructor_call(jsdisp_t *constr, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
{
if(flags != DISPATCH_PROPERTYGET)
return jsdisp_call_value(constr, NULL, flags, argc, argv, r);
*r = jsval_obj(jsdisp_addref(constr));
return S_OK;
}
static HRESULT JSGlobal_EvalError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->eval_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_RangeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->range_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_RegExpError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->regexp_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_ReferenceError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->reference_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_SyntaxError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->syntax_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_TypeError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->type_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_URIError(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
TRACE("\n");
return constructor_call(ctx->uri_error_constr, flags, argc, argv, r);
}
static HRESULT JSGlobal_Enumerator(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
jsval_t *r)
{
......@@ -1001,18 +936,11 @@ static HRESULT JSGlobal_decodeURIComponent(script_ctx_t *ctx, vdisp_t *jsthis, W
static const builtin_prop_t JSGlobal_props[] = {
{CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD},
{EnumeratorW, JSGlobal_Enumerator, PROPF_METHOD|7},
{EvalErrorW, JSGlobal_EvalError, PROPF_CONSTR|1},
{_GetObjectW, JSGlobal_GetObject, PROPF_METHOD|2},
{RangeErrorW, JSGlobal_RangeError, PROPF_CONSTR|1},
{ReferenceErrorW, JSGlobal_ReferenceError, PROPF_CONSTR|1},
{RegExpErrorW, JSGlobal_RegExpError, PROPF_CONSTR|1},
{ScriptEngineW, JSGlobal_ScriptEngine, PROPF_METHOD},
{ScriptEngineBuildVersionW, JSGlobal_ScriptEngineBuildVersion, PROPF_METHOD},
{ScriptEngineMajorVersionW, JSGlobal_ScriptEngineMajorVersion, PROPF_METHOD},
{ScriptEngineMinorVersionW, JSGlobal_ScriptEngineMinorVersion, PROPF_METHOD},
{SyntaxErrorW, JSGlobal_SyntaxError, PROPF_CONSTR|1},
{TypeErrorW, JSGlobal_TypeError, PROPF_CONSTR|1},
{URIErrorW, JSGlobal_URIError, PROPF_CONSTR|1},
{decodeURIW, JSGlobal_decodeURI, PROPF_METHOD|1},
{decodeURIComponentW, JSGlobal_decodeURIComponent, PROPF_METHOD|1},
{encodeURIW, JSGlobal_encodeURI, PROPF_METHOD|1},
......@@ -1087,6 +1015,34 @@ static HRESULT init_constructors(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, EvalErrorW, jsval_obj(ctx->eval_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, RangeErrorW, jsval_obj(ctx->range_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, ReferenceErrorW, jsval_obj(ctx->reference_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, RegExpErrorW, jsval_obj(ctx->regexp_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, SyntaxErrorW, jsval_obj(ctx->syntax_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, TypeErrorW, jsval_obj(ctx->type_error_constr));
if(FAILED(hres))
return hres;
hres = jsdisp_propput_dontenum(ctx->global, URIErrorW, jsval_obj(ctx->uri_error_constr));
if(FAILED(hres))
return hres;
hres = create_number_constr(ctx, object_prototype, &ctx->number_constr);
if(FAILED(hres))
return hres;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment