Jacek Caban : jscript: Use prototype for builtin Date properties.
Alexandre Julliard
julliard at winehq.org
Tue Jul 24 14:39:32 CDT 2012
Module: wine
Branch: master
Commit: 175c4ddad5efa19a1cb4d0a12669792adef39e5e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=175c4ddad5efa19a1cb4d0a12669792adef39e5e
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Jul 24 13:17:06 2012 +0200
jscript: Use prototype for builtin Date properties.
---
dlls/jscript/date.c | 10 +++++++++-
dlls/jscript/tests/api.js | 5 +++++
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c
index 465f7b2..f5cf591 100644
--- a/dlls/jscript/date.c
+++ b/dlls/jscript/date.c
@@ -2110,6 +2110,14 @@ static const builtin_info_t Date_info = {
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)
{
DateInstance *date;
@@ -2125,7 +2133,7 @@ static HRESULT create_date(script_ctx_t *ctx, jsdisp_t *object_prototype, DOUBLE
if(object_prototype)
hres = init_dispex(&date->dispex, ctx, &Date_info, object_prototype);
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)) {
heap_free(date);
return hres;
diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
index 3d8d67a..a723f6e 100644
--- a/dlls/jscript/tests/api.js
+++ b/dlls/jscript/tests/api.js
@@ -222,6 +222,11 @@ 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");
+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();
ok(tmp === "[object Object]", "'' + new Object() = " + tmp);
(tmp = new Array).f = Object.prototype.toString;
More information about the wine-cvs
mailing list