jscript: Use prototype for builtin Boolean properties.
This commit is contained in:
parent
6e4f74f71b
commit
5058c1d12d
|
@ -117,6 +117,14 @@ static const builtin_info_t Bool_info = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const builtin_info_t BoolInst_info = {
|
||||||
|
JSCLASS_BOOLEAN,
|
||||||
|
{NULL, Bool_value, 0},
|
||||||
|
0, NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv,
|
static HRESULT BoolConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, VARIANT *argv,
|
||||||
VARIANT *retv, jsexcept_t *ei)
|
VARIANT *retv, jsexcept_t *ei)
|
||||||
{
|
{
|
||||||
|
@ -168,7 +176,7 @@ static HRESULT alloc_bool(script_ctx_t *ctx, jsdisp_t *object_prototype, BoolIns
|
||||||
if(object_prototype)
|
if(object_prototype)
|
||||||
hres = init_dispex(&bool->dispex, ctx, &Bool_info, object_prototype);
|
hres = init_dispex(&bool->dispex, ctx, &Bool_info, object_prototype);
|
||||||
else
|
else
|
||||||
hres = init_dispex_from_constr(&bool->dispex, ctx, &Bool_info, ctx->bool_constr);
|
hres = init_dispex_from_constr(&bool->dispex, ctx, &BoolInst_info, ctx->bool_constr);
|
||||||
|
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
heap_free(bool);
|
heap_free(bool);
|
||||||
|
|
|
@ -217,6 +217,11 @@ ok(Array.prototype.hasOwnProperty('length'), "Array.prototype.hasOwnProperty('le
|
||||||
ok(!obj.hasOwnProperty('sort'), "obj.hasOwnProperty('sort') is true");
|
ok(!obj.hasOwnProperty('sort'), "obj.hasOwnProperty('sort') is true");
|
||||||
ok(obj.hasOwnProperty('length'), "obj.hasOwnProperty('length') is true");
|
ok(obj.hasOwnProperty('length'), "obj.hasOwnProperty('length') is true");
|
||||||
|
|
||||||
|
obj = new Boolean(false);
|
||||||
|
ok(!obj.hasOwnProperty('toString'), "obj.hasOwnProperty('toString') is true");
|
||||||
|
ok(!Boolean.hasOwnProperty('toString'), "Boolean.hasOwnProperty('toString') is true");
|
||||||
|
ok(Boolean.prototype.hasOwnProperty('toString'), "Boolean.prototype.hasOwnProperty('toString') 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