Commit 175c4dda authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Use prototype for builtin Date properties.

parent 5058c1d1
...@@ -2110,6 +2110,14 @@ static const builtin_info_t Date_info = { ...@@ -2110,6 +2110,14 @@ static const builtin_info_t Date_info = {
NULL NULL
}; };
static const builtin_info_t DateInst_info = {
JSCLASS_DATE,
{NULL, Date_value, 0},
0, NULL,
NULL,
NULL
};
static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE time, jsdisp_t **ret) static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE time, jsdisp_t **ret)
{ {
DateInstance *date; DateInstance *date;
...@@ -2125,7 +2133,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE ...@@ -2125,7 +2133,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
if(object_prototype) if(object_prototype)
hres = init_dispex(&date->dispex, ctx, &Date_info, object_prototype); hres = init_dispex(&date->dispex, ctx, &Date_info, object_prototype);
else else
hres = init_dispex_from_constr(&date->dispex, ctx, &Date_info, ctx->date_constr); hres = init_dispex_from_constr(&date->dispex, ctx, &DateInst_info, ctx->date_constr);
if(FAILED(hres)) { if(FAILED(hres)) {
heap_free(date); heap_free(date);
return hres; return hres;
......
...@@ -222,6 +222,11 @@ ok(!obj.hasOwnProperty('toString'), "obj.hasOwnProperty('toString') is true"); ...@@ -222,6 +222,11 @@ ok(!obj.hasOwnProperty('toString'), "obj.hasOwnProperty('toString') is true");
ok(!Boolean.hasOwnProperty('toString'), "Boolean.hasOwnProperty('toString') is true"); ok(!Boolean.hasOwnProperty('toString'), "Boolean.hasOwnProperty('toString') is true");
ok(Boolean.prototype.hasOwnProperty('toString'), "Boolean.prototype.hasOwnProperty('toString') is false"); ok(Boolean.prototype.hasOwnProperty('toString'), "Boolean.prototype.hasOwnProperty('toString') is false");
obj = new Date();
ok(!obj.hasOwnProperty('getTime'), "obj.hasOwnProperty('getTime') is true");
ok(!Date.hasOwnProperty('getTime'), "Date.hasOwnProperty('getTime') is true");
ok(Date.prototype.hasOwnProperty('getTime'), "Date.prototype.hasOwnProperty('getTime') 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;
......
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