jscript: Use prototype for builtin Number properties.
This commit is contained in:
parent
175c4ddad5
commit
3b80361a70
|
@ -543,6 +543,14 @@ static const builtin_info_t Number_info = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const builtin_info_t NumberInst_info = {
|
||||||
|
JSCLASS_NUMBER,
|
||||||
|
{NULL, Number_value, 0},
|
||||||
|
0, NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv,
|
static HRESULT NumberConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv,
|
||||||
VARIANT *retv, jsexcept_t *ei)
|
VARIANT *retv, jsexcept_t *ei)
|
||||||
{
|
{
|
||||||
|
@ -605,7 +613,7 @@ static HRESULT alloc_number(script_ctx_t *ctx, jsdisp_t *object_prototype, Numbe
|
||||||
if(object_prototype)
|
if(object_prototype)
|
||||||
hres = init_dispex(&number->dispex, ctx, &Number_info, object_prototype);
|
hres = init_dispex(&number->dispex, ctx, &Number_info, object_prototype);
|
||||||
else
|
else
|
||||||
hres = init_dispex_from_constr(&number->dispex, ctx, &Number_info, ctx->number_constr);
|
hres = init_dispex_from_constr(&number->dispex, ctx, &NumberInst_info, ctx->number_constr);
|
||||||
if(FAILED(hres))
|
if(FAILED(hres))
|
||||||
return hres;
|
return hres;
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,11 @@ ok(!obj.hasOwnProperty('getTime'), "obj.hasOwnProperty('getTime') is true");
|
||||||
ok(!Date.hasOwnProperty('getTime'), "Date.hasOwnProperty('getTime') is true");
|
ok(!Date.hasOwnProperty('getTime'), "Date.hasOwnProperty('getTime') is true");
|
||||||
ok(Date.prototype.hasOwnProperty('getTime'), "Date.prototype.hasOwnProperty('getTime') is false");
|
ok(Date.prototype.hasOwnProperty('getTime'), "Date.prototype.hasOwnProperty('getTime') is false");
|
||||||
|
|
||||||
|
obj = new Number();
|
||||||
|
ok(!obj.hasOwnProperty('toFixed'), "obj.hasOwnProperty('toFixed') is true");
|
||||||
|
ok(!Number.hasOwnProperty('toFixed'), "Number.hasOwnProperty('toFixed') is true");
|
||||||
|
ok(Number.prototype.hasOwnProperty('toFixed'), "Number.prototype.hasOwnProperty('toFixed') is false");
|
||||||
|
|
||||||
tmp = "" + new Object();
|
tmp = "" + new Object();
|
||||||
ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
|
ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
|
||||||
(tmp = new Array).f = Object.prototype.toString;
|
(tmp = new Array).f = Object.prototype.toString;
|
||||||
|
|
Loading…
Reference in New Issue