Jacek Caban : jscript: Properly handle constructor property for most builtin constructors.

Alexandre Julliard julliard at winehq.org
Mon Jul 16 14:14:29 CDT 2012


Module: wine
Branch: master
Commit: d4926503322cce74258bee188e91200b09914d6f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d4926503322cce74258bee188e91200b09914d6f

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Jul 16 15:31:10 2012 +0200

jscript: Properly handle constructor property for most builtin constructors.

---

 dlls/jscript/array.c       |    2 +-
 dlls/jscript/bool.c        |    2 +-
 dlls/jscript/date.c        |    2 +-
 dlls/jscript/object.c      |    2 +-
 dlls/jscript/regexp.c      |    2 +-
 dlls/jscript/string.c      |    2 +-
 dlls/jscript/tests/lang.js |   14 +++++++++++++-
 dlls/jscript/vbarray.c     |    2 +-
 8 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/dlls/jscript/array.c b/dlls/jscript/array.c
index 5004eb5..6881412 100644
--- a/dlls/jscript/array.c
+++ b/dlls/jscript/array.c
@@ -1183,7 +1183,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR|1, &array->dispex, ret);
+    hres = create_builtin_constructor(ctx, ArrayConstr_value, ArrayW, NULL, PROPF_CONSTR|1, &array->dispex, ret);
 
     jsdisp_release(&array->dispex);
     return hres;
diff --git a/dlls/jscript/bool.c b/dlls/jscript/bool.c
index 6ddcf9e..14bb1a3 100644
--- a/dlls/jscript/bool.c
+++ b/dlls/jscript/bool.c
@@ -190,7 +190,7 @@ HRESULT create_bool_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, BoolConstr_value, BooleanW, NULL,
+    hres = create_builtin_constructor(ctx, BoolConstr_value, BooleanW, NULL,
             PROPF_CONSTR|1, &bool->dispex, ret);
 
     jsdisp_release(&bool->dispex);
diff --git a/dlls/jscript/date.c b/dlls/jscript/date.c
index 4dad1e2..465f7b2 100644
--- a/dlls/jscript/date.c
+++ b/dlls/jscript/date.c
@@ -2631,7 +2631,7 @@ HRESULT create_date_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, DateConstr_value, DateW, &DateConstr_info,
+    hres = create_builtin_constructor(ctx, DateConstr_value, DateW, &DateConstr_info,
             PROPF_CONSTR|7, date, ret);
 
     jsdisp_release(date);
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index b1a83de..ce43eb5 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -264,7 +264,7 @@ HRESULT create_object_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
 {
     static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
 
-    return create_builtin_function(ctx, ObjectConstr_value, ObjectW, NULL, PROPF_CONSTR,
+    return create_builtin_constructor(ctx, ObjectConstr_value, ObjectW, NULL, PROPF_CONSTR,
             object_prototype, ret);
 }
 
diff --git a/dlls/jscript/regexp.c b/dlls/jscript/regexp.c
index 8e5445f..996f9f0 100644
--- a/dlls/jscript/regexp.c
+++ b/dlls/jscript/regexp.c
@@ -4143,7 +4143,7 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, RegExpConstr_value, RegExpW, &RegExpConstr_info,
+    hres = create_builtin_constructor(ctx, RegExpConstr_value, RegExpW, &RegExpConstr_info,
             PROPF_CONSTR|2, &regexp->dispex, ret);
 
     jsdisp_release(&regexp->dispex);
diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c
index 46d779a..9b23005 100644
--- a/dlls/jscript/string.c
+++ b/dlls/jscript/string.c
@@ -1669,7 +1669,7 @@ HRESULT create_string_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, StringConstr_value, StringW, &StringConstr_info,
+    hres = create_builtin_constructor(ctx, StringConstr_value, StringW, &StringConstr_info,
             PROPF_CONSTR|1, &string->dispex, ret);
 
     jsdisp_release(&string->dispex);
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index 75306f1..c37b7c7 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -91,7 +91,19 @@ ok(Function.prototype.prototype === undefined, "Function.prototype.prototype is
 ok(Date.prototype !== undefined, "Date.prototype is undefined");
 ok(Date.prototype.prototype === undefined, "Date.prototype is not undefined");
 
-ok(Number.prototype.constructor === Number, "Number.prototype.constructor !== Number");
+function testConstructor(constr, name) {
+    ok(constr.prototype.constructor === constr, name + ".prototype.constructor !== " + name);
+}
+
+testConstructor(Object, "Object");
+testConstructor(String, "String");
+testConstructor(Array, "Array");
+testConstructor(Boolean, "Boolean");
+testConstructor(Number, "Number");
+testConstructor(RegExp, "RegExp");
+//testConstructor(Function, "Function");
+testConstructor(Date, "Date");
+testConstructor(VBArray, "VBArray");
 
 Function.prototype.test = true;
 ok(testFunc1.test === true, "testFunc1.test !== true");
diff --git a/dlls/jscript/vbarray.c b/dlls/jscript/vbarray.c
index 87bdf88..ac0c6de 100644
--- a/dlls/jscript/vbarray.c
+++ b/dlls/jscript/vbarray.c
@@ -326,7 +326,7 @@ HRESULT create_vbarray_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsd
     if(FAILED(hres))
         return hres;
 
-    hres = create_builtin_function(ctx, VBArrayConstr_value, VBArrayW, NULL, PROPF_CONSTR|1, &vbarray->dispex, ret);
+    hres = create_builtin_constructor(ctx, VBArrayConstr_value, VBArrayW, NULL, PROPF_CONSTR|1, &vbarray->dispex, ret);
 
     jsdisp_release(&vbarray->dispex);
     return hres;




More information about the wine-cvs mailing list