Jacek Caban : jscript: Use jsdisp_get_own_property in Object.propertyIsEnumerable implementation.

Alexandre Julliard julliard at winehq.org
Thu May 10 18:23:16 CDT 2018


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu May 10 19:20:16 2018 +0200

jscript: Use jsdisp_get_own_property in Object.propertyIsEnumerable implementation.

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

---

 dlls/jscript/dispex.c  | 13 -------------
 dlls/jscript/jscript.h |  1 -
 dlls/jscript/object.c  |  8 ++++----
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c
index 5ec6830..1c9595f 100644
--- a/dlls/jscript/dispex.c
+++ b/dlls/jscript/dispex.c
@@ -1589,19 +1589,6 @@ HRESULT disp_delete_name(script_ctx_t *ctx, IDispatch *disp, jsstr_t *name, BOOL
     return hres;
 }
 
-HRESULT jsdisp_is_enumerable(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
-{
-    dispex_prop_t *prop;
-    HRESULT hres;
-
-    hres = find_prop_name(obj, string_hash(name), name, &prop);
-    if(FAILED(hres))
-        return hres;
-
-    *ret = prop && (prop->flags & PROPF_ENUMERABLE) && prop->type != PROP_PROTREF;
-    return S_OK;
-}
-
 HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_only,
                                 property_desc_t *desc)
 {
diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h
index 9f2220f..4f2acc5 100644
--- a/dlls/jscript/jscript.h
+++ b/dlls/jscript/jscript.h
@@ -294,7 +294,6 @@ HRESULT disp_delete(IDispatch*,DISPID,BOOL*) DECLSPEC_HIDDEN;
 HRESULT disp_delete_name(script_ctx_t*,IDispatch*,jsstr_t*,BOOL*) DECLSPEC_HIDDEN;
 HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
 HRESULT jsdisp_get_own_property(jsdisp_t*,const WCHAR*,BOOL,property_desc_t*) DECLSPEC_HIDDEN;
-HRESULT jsdisp_is_enumerable(jsdisp_t*,const WCHAR*,BOOL*) 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;
diff --git a/dlls/jscript/object.c b/dlls/jscript/object.c
index 56b6e8e..315c846 100644
--- a/dlls/jscript/object.c
+++ b/dlls/jscript/object.c
@@ -178,9 +178,9 @@ static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD fl
 static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,
         jsval_t *r)
 {
+    property_desc_t prop_desc;
     const WCHAR *name;
     jsstr_t *name_str;
-    BOOL ret;
     HRESULT hres;
 
     TRACE("\n");
@@ -199,13 +199,13 @@ static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, W
     if(FAILED(hres))
         return hres;
 
-    hres = jsdisp_is_enumerable(jsthis->u.jsdisp, name, &ret);
+    hres = jsdisp_get_own_property(jsthis->u.jsdisp, name, TRUE, &prop_desc);
     jsstr_release(name_str);
-    if(FAILED(hres))
+    if(FAILED(hres) && hres != DISP_E_UNKNOWNNAME)
         return hres;
 
     if(r)
-        *r = jsval_bool(ret);
+        *r = jsval_bool(hres == S_OK && (prop_desc.flags & PROPF_ENUMERABLE) != 0);
     return S_OK;
 }
 




More information about the wine-cvs mailing list