From 197db9cac973fbe220e50e8b96e5aee7e37bc2e7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 3 May 2018 14:58:44 +0200 Subject: [PATCH] jscript: Use new PROPF_CONFIGURABLE flag instead of PROPF_DONTDELETE. This is closer to how ES5 defines them. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/jscript/dispex.c | 16 ++++++++++------ dlls/jscript/function.c | 2 +- dlls/jscript/jscript.h | 12 ++++++------ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/dlls/jscript/dispex.c b/dlls/jscript/dispex.c index 81df4d02655..63ab21d2fb2 100644 --- a/dlls/jscript/dispex.c +++ b/dlls/jscript/dispex.c @@ -216,7 +216,11 @@ static HRESULT find_prop_name(jsdisp_t *This, unsigned hash, const WCHAR *name, builtin = find_builtin_prop(This, name); if(builtin) { - prop = alloc_prop(This, name, PROP_BUILTIN, builtin->flags); + unsigned flags = builtin->flags; + if(flags & PROPF_METHOD) + flags |= PROPF_CONFIGURABLE; + flags &= PROPF_ENUM | PROPF_CONST | PROPF_CONFIGURABLE; + prop = alloc_prop(This, name, PROP_BUILTIN, flags); if(!prop) return E_OUTOFMEMORY; @@ -485,7 +489,7 @@ static HRESULT prop_put(jsdisp_t *This, dispex_prop_t *prop, jsval_t val) /* fall through */ case PROP_PROTREF: prop->type = PROP_JSVAL; - prop->flags = PROPF_ENUM; + prop->flags = PROPF_ENUM | PROPF_CONFIGURABLE; prop->u.val = jsval_undefined(); break; case PROP_JSVAL: @@ -744,7 +748,7 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc static HRESULT delete_prop(dispex_prop_t *prop, BOOL *ret) { - if(prop->flags & PROPF_DONTDELETE) { + if(!(prop->flags & PROPF_CONFIGURABLE)) { *ret = FALSE; return S_OK; } @@ -1035,7 +1039,7 @@ HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID * HRESULT hres; if(flags & fdexNameEnsure) - hres = ensure_prop_name(jsdisp, name, TRUE, PROPF_ENUM, &prop); + hres = ensure_prop_name(jsdisp, name, TRUE, PROPF_ENUM | PROPF_CONFIGURABLE, &prop); else hres = find_prop_name_prot(jsdisp, string_hash(name), name, &prop); if(FAILED(hres)) @@ -1307,7 +1311,7 @@ HRESULT jsdisp_propput(jsdisp_t *obj, const WCHAR *name, DWORD flags, jsval_t va HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val) { - return jsdisp_propput(obj, name, PROPF_ENUM, val); + return jsdisp_propput(obj, name, PROPF_ENUM | PROPF_CONFIGURABLE, val); } HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, jsval_t val) @@ -1324,7 +1328,7 @@ HRESULT jsdisp_propput_const(jsdisp_t *obj, const WCHAR *name, jsval_t val) HRESULT jsdisp_propput_dontenum(jsdisp_t *obj, const WCHAR *name, jsval_t val) { - return jsdisp_propput(obj, name, 0, val); + return jsdisp_propput(obj, name, PROPF_CONFIGURABLE, val); } HRESULT jsdisp_propput_idx(jsdisp_t *obj, DWORD idx, jsval_t val) diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 8480a3bf1a0..2e905a993b0 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -184,7 +184,7 @@ HRESULT setup_arguments_object(script_ctx_t *ctx, call_frame_t *frame) if(SUCCEEDED(hres)) hres = jsdisp_propput_dontenum(&args->jsdisp, caleeW, jsval_disp(to_disp(&args->function->dispex))); if(SUCCEEDED(hres)) - hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, PROPF_DONTDELETE, jsval_obj(&args->jsdisp)); + hres = jsdisp_propput(frame->base_scope->jsobj, argumentsW, 0, jsval_obj(&args->jsdisp)); if(FAILED(hres)) { jsdisp_release(&args->jsdisp); return hres; diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 86786192489..03a96c3e723 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -87,12 +87,12 @@ typedef struct jsdisp_t jsdisp_t; extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN; -#define PROPF_ARGMASK 0x00ff -#define PROPF_METHOD 0x0100 -#define PROPF_ENUM 0x0200 -#define PROPF_CONSTR 0x0400 -#define PROPF_CONST 0x0800 -#define PROPF_DONTDELETE 0x1000 +#define PROPF_ARGMASK 0x00ff +#define PROPF_METHOD 0x0100 +#define PROPF_ENUM 0x0200 +#define PROPF_CONSTR 0x0400 +#define PROPF_CONST 0x0800 +#define PROPF_CONFIGURABLE 0x1000 #define PROPF_VERSION_MASK 0x01ff0000 #define PROPF_VERSION_SHIFT 16