Jacek Caban : jscript: Use jsdisp_define_property to set function prototypes.
Alexandre Julliard
julliard at winehq.org
Mon May 14 17:20:10 CDT 2018
Module: wine
Branch: master
Commit: 3767d63a1c220e1168c3d4326602fd3db5abd2ba
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3767d63a1c220e1168c3d4326602fd3db5abd2ba
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon May 14 13:33:52 2018 +0200
jscript: Use jsdisp_define_property to set function prototypes.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/function.c | 12 ++++--------
dlls/mshtml/tests/es5.js | 4 ++++
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index 5fff9da..9b51b08 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -641,11 +641,6 @@ static HRESULT create_function(script_ctx_t *ctx, const builtin_info_t *builtin_
return S_OK;
}
-static inline HRESULT set_prototype(script_ctx_t *ctx, jsdisp_t *dispex, jsdisp_t *prototype)
-{
- return jsdisp_propput_dontenum(dispex, prototypeW, jsval_obj(prototype));
-}
-
HRESULT create_builtin_function(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)
{
@@ -660,7 +655,7 @@ HRESULT create_builtin_function(script_ctx_t *ctx, builtin_invoke_t value_proc,
hres = jsdisp_define_data_property(&function->dispex, lengthW, 0,
jsval_number(function->length));
if(SUCCEEDED(hres))
- hres = set_prototype(ctx, &function->dispex, prototype);
+ hres = jsdisp_define_data_property(&function->dispex, prototypeW, 0, jsval_obj(prototype));
if(FAILED(hres)) {
jsdisp_release(&function->dispex);
return hres;
@@ -713,7 +708,8 @@ HRESULT create_source_function(script_ctx_t *ctx, bytecode_t *code, function_cod
hres = create_function(ctx, NULL, PROPF_CONSTR, FALSE, NULL, &function);
if(SUCCEEDED(hres)) {
- hres = set_prototype(ctx, &function->dispex, prototype);
+ hres = jsdisp_define_data_property(&function->dispex, prototypeW, PROPF_WRITABLE,
+ jsval_obj(prototype));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &function->dispex, prototype);
if(FAILED(hres))
@@ -871,7 +867,7 @@ HRESULT init_function_constr(script_ctx_t *ctx, jsdisp_t *object_prototype)
if(SUCCEEDED(hres)) {
constr->value_proc = FunctionConstr_value;
constr->name = FunctionW;
- hres = set_prototype(ctx, &constr->dispex, &prot->dispex);
+ hres = jsdisp_define_data_property(&constr->dispex, prototypeW, 0, jsval_obj(&prot->dispex));
if(SUCCEEDED(hres))
hres = set_constructor_prop(ctx, &constr->dispex, &prot->dispex);
if(FAILED(hres))
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js
index 30b464c..70e9ecb 100644
--- a/dlls/mshtml/tests/es5.js
+++ b/dlls/mshtml/tests/es5.js
@@ -195,6 +195,10 @@ function test_getOwnPropertyDescriptor() {
test_own_data_prop_desc(arguments, "callee", true, false, true);
})();
+ test_own_data_prop_desc(String, "prototype", false, false, false);
+ test_own_data_prop_desc(function(){}, "prototype", true, false, false);
+ test_own_data_prop_desc(Function, "prototype", false, false, false);
+
next_test();
}
More information about the wine-cvs
mailing list