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

jscript: Properly set Number.prototyp.constructor.

parent c957f8a9
......@@ -639,6 +639,31 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
return S_OK;
}
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
{
jsdisp_t *constr;
VARIANT v;
HRESULT hres;
static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
hres = create_builtin_function(ctx, value_proc, name, builtin_info, flags, prototype, &constr);
if(FAILED(hres))
return hres;
V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = to_disp(constr);
hres = jsdisp_propput_name(prototype, constructorW, &v, NULL);
if(FAILED(hres)) {
jsdisp_release(constr);
return hres;
}
*ret = constr;
return S_OK;
}
HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_code_t *func_code,
scope_chain_t *scope_chain, jsdisp_t **ret)
{
......
......@@ -225,6 +225,8 @@ VARIANT_BOOL jsdisp_is_own_prop(jsdisp_t *obj, BSTR name) DECLSPEC_HIDDEN;
HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD,
jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
HRESULT create_builtin_constructor(script_ctx_t*,builtin_invoke_t,const WCHAR*,const builtin_info_t*,DWORD,
jsdisp_t*,jsdisp_t**) DECLSPEC_HIDDEN;
HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*) DECLSPEC_HIDDEN;
HRESULT Function_invoke(jsdisp_t*,IDispatch*,WORD,unsigned,VARIANT*,VARIANT*,jsexcept_t*);
......
......@@ -625,7 +625,7 @@ HRESULT create_number_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdi
return hres;
number->value = 0;
hres = create_builtin_function(ctx, NumberConstr_value, NumberW, NULL,
hres = create_builtin_constructor(ctx, NumberConstr_value, NumberW, NULL,
PROPF_CONSTR|1, &number->dispex, ret);
jsdisp_release(&number->dispex);
......
......@@ -91,6 +91,8 @@ 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.prototype.test = true;
ok(testFunc1.test === true, "testFunc1.test !== true");
ok(Function.test === true, "Function.test !== true");
......
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