Commit d4926503 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Properly handle constructor property for most builtin constructors.

parent cf802971
...@@ -1183,7 +1183,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis ...@@ -1183,7 +1183,7 @@ HRESULT create_array_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdis
if(FAILED(hres)) if(FAILED(hres))
return 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); jsdisp_release(&array->dispex);
return hres; return hres;
......
...@@ -190,7 +190,7 @@ HRESULT create_bool_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp ...@@ -190,7 +190,7 @@ HRESULT create_bool_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
if(FAILED(hres)) if(FAILED(hres))
return 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); PROPF_CONSTR|1, &bool->dispex, ret);
jsdisp_release(&bool->dispex); jsdisp_release(&bool->dispex);
......
...@@ -2631,7 +2631,7 @@ HRESULT create_date_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp ...@@ -2631,7 +2631,7 @@ HRESULT create_date_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp
if(FAILED(hres)) if(FAILED(hres))
return 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); PROPF_CONSTR|7, date, ret);
jsdisp_release(date); jsdisp_release(date);
......
...@@ -264,7 +264,7 @@ HRESULT create_object_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi ...@@ -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}; 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); object_prototype, ret);
} }
......
...@@ -4143,7 +4143,7 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi ...@@ -4143,7 +4143,7 @@ HRESULT create_regexp_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
if(FAILED(hres)) if(FAILED(hres))
return 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); PROPF_CONSTR|2, &regexp->dispex, ret);
jsdisp_release(&regexp->dispex); jsdisp_release(&regexp->dispex);
......
...@@ -1669,7 +1669,7 @@ HRESULT create_string_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi ...@@ -1669,7 +1669,7 @@ HRESULT create_string_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
if(FAILED(hres)) if(FAILED(hres))
return 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); PROPF_CONSTR|1, &string->dispex, ret);
jsdisp_release(&string->dispex); jsdisp_release(&string->dispex);
......
...@@ -91,7 +91,19 @@ ok(Function.prototype.prototype === undefined, "Function.prototype.prototype is ...@@ -91,7 +91,19 @@ ok(Function.prototype.prototype === undefined, "Function.prototype.prototype is
ok(Date.prototype !== undefined, "Date.prototype is undefined"); ok(Date.prototype !== undefined, "Date.prototype is undefined");
ok(Date.prototype.prototype === undefined, "Date.prototype is not 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; Function.prototype.test = true;
ok(testFunc1.test === true, "testFunc1.test !== true"); ok(testFunc1.test === true, "testFunc1.test !== true");
......
...@@ -326,7 +326,7 @@ HRESULT create_vbarray_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsd ...@@ -326,7 +326,7 @@ HRESULT create_vbarray_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsd
if(FAILED(hres)) if(FAILED(hres))
return 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); jsdisp_release(&vbarray->dispex);
return hres; return hres;
......
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