Jacek Caban : jscript: Use jsdisp_define_property to set prototype constructors.

Alexandre Julliard julliard at winehq.org
Mon May 14 17:20:10 CDT 2018


Module: wine
Branch: master
Commit: 599769f857dc8cdb94fd8108041a322ac1c8db5b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=599769f857dc8cdb94fd8108041a322ac1c8db5b

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon May 14 13:34:02 2018 +0200

jscript: Use jsdisp_define_property to set prototype constructors.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/dispex.c    | 5 -----
 dlls/jscript/function.c  | 3 ++-
 dlls/jscript/jscript.h   | 1 -
 dlls/mshtml/tests/es5.js | 1 +
 4 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index 17d3f5d..7ba625f 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1316,11 +1316,6 @@ HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
     return jsdisp_propput(obj, name, PROPF_ENUMERABLE | PROPF_CONFIGURABLE | PROPF_WRITABLE, val);
 }
 
-HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, jsval_t val)
-{
-    return jsdisp_propput(obj, name, PROPF_CONFIGURABLE | PROPF_WRITABLE, val);
-}
-
 HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val)
 {
     WCHAR buf[12];
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index 9b51b08..0aae300 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -672,7 +672,8 @@ static HRESULT set_constructor_prop(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_
 {
     static const WCHAR constructorW[] = {'c','o','n','s','t','r','u','c','t','o','r',0};
 
-    return jsdisp_propput_dontenum(prot, constructorW, jsval_obj(constr));
+    return jsdisp_define_data_property(prot, constructorW, PROPF_WRITABLE | PROPF_CONFIGURABLE,
+                                       jsval_obj(constr));
 }
 
 HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name,
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 40e99f3..5a7be8e 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -284,7 +284,6 @@ HRESULT disp_propput(script_ctx_t*,IDispatch*,DISPID,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propget(jsdisp_t*,DISPID,jsval_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput(jsdisp_t*,const WCHAR*,DWORD,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput_name(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN;
-HRESULT jsdisp_propput_dontenum(jsdisp_t*,const WCHAR*,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propput_idx(jsdisp_t*,DWORD,jsval_t) DECLSPEC_HIDDEN;
 HRESULT jsdisp_propget_name(jsdisp_t*,LPCWSTR,jsval_t*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js
index 70e9ecb..5ca8d59 100644
--- a/dlls/mshtml/tests/es5.js
+++ b/dlls/mshtml/tests/es5.js
@@ -198,6 +198,7 @@ function test_getOwnPropertyDescriptor() {
     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);
+    test_own_data_prop_desc(String.prototype, "constructor", true, false, true);
 
     next_test();
 }




More information about the wine-cvs mailing list