jscript: Properly handle constructor property for most builtin constructors.

This commit is contained in:
Jacek Caban 2012-07-16 15:31:10 +02:00 committed by Alexandre Julliard
parent cf8029717c
commit d492650332
8 changed files with 20 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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);

View File

@ -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");

View File

@ -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;