Jacek Caban : jscript: Properly set Function constructor' s constructor property.
Alexandre Julliard
julliard at winehq.org
Mon Jul 16 14:14:29 CDT 2012
Module: wine
Branch: master
Commit: bf7b7272ee130e7c6d793c3b87cbf932be8aff48
URL: http://source.winehq.org/git/wine.git/?a=commit;h=bf7b7272ee130e7c6d793c3b87cbf932be8aff48
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Jul 16 15:31:24 2012 +0200
jscript: Properly set Function constructor's constructor property.
---
dlls/jscript/function.c | 20 ++++++++++++++------
dlls/jscript/tests/lang.js | 2 +-
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index 765efcc..1d188e7 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -639,22 +639,28 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
return S_OK;
}
+static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t *prot)
+{
+ VARIANT v;
+
+ static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
+
+ V_VT(&v) = VT_DISPATCH;
+ V_DISPATCH(&v) = to_disp(constr);
+ return jsdisp_propput_name(prot, constructorW, &v, NULL);
+}
+
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);
+ hres = set_constructor_prop(ctx, constr, prototype);
if(FAILED(hres)) {
jsdisp_release(constr);
return hres;
@@ -839,6 +845,8 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
constr->value_proc = FunctionConstr_value;
constr->name = FunctionW;
hres = set_prototype(ctx, &constr->dispex, &prot->dispex);
+ if(SUCCEEDED(hres))
+ hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex);
if(FAILED(hres))
jsdisp_release(&constr->dispex);
}
diff --git a/dlls/jscript/tests/lang.js b/dlls/jscript/tests/lang.js
index c37b7c7..a0eae4a 100644
--- a/dlls/jscript/tests/lang.js
+++ b/dlls/jscript/tests/lang.js
@@ -101,7 +101,7 @@ testConstructor(Array, "Array");
testConstructor(Boolean, "Boolean");
testConstructor(Number, "Number");
testConstructor(RegExp, "RegExp");
-//testConstructor(Function, "Function");
+testConstructor(Function, "Function");
testConstructor(Date, "Date");
testConstructor(VBArray, "VBArray");
More information about the wine-cvs
mailing list