jscript: Added propertyIsEnumerable implementation.

This commit is contained in:
Jacek Caban 2012-11-05 15:04:19 +01:00 committed by Alexandre Julliard
parent ea34e01493
commit 78652f7602
3 changed files with 42 additions and 2 deletions

View File

@ -1444,3 +1444,16 @@ HRESULT jsdisp_is_own_prop(jsdisp_t *obj, const WCHAR *name, BOOL *ret)
*ret = prop && (prop->type == PROP_JSVAL || prop->type == PROP_BUILTIN);
return S_OK;
}
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_ENUM) && prop->type != PROP_PROTREF;
return S_OK;
}

View File

@ -273,6 +273,7 @@ HRESULT jsdisp_get_idx(jsdisp_t*,DWORD,jsval_t*) DECLSPEC_HIDDEN;
HRESULT jsdisp_get_id(jsdisp_t*,const WCHAR*,DWORD,DISPID*) DECLSPEC_HIDDEN;
HRESULT jsdisp_delete_idx(jsdisp_t*,DWORD) DECLSPEC_HIDDEN;
HRESULT jsdisp_is_own_prop(jsdisp_t*,const WCHAR*,BOOL*) 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;

View File

@ -160,8 +160,34 @@ 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)
{
FIXME("\n");
return E_NOTIMPL;
jsstr_t *name;
BOOL ret;
HRESULT hres;
TRACE("\n");
if(argc != 1) {
FIXME("argc %d not supported\n", argc);
return E_NOTIMPL;
}
if(!is_jsdisp(jsthis)) {
FIXME("Host object this\n");
return E_FAIL;
}
hres = to_string(ctx, argv[0], &name);
if(FAILED(hres))
return hres;
hres = jsdisp_is_enumerable(jsthis->u.jsdisp, name->str, &ret);
jsstr_release(name);
if(FAILED(hres))
return hres;
if(r)
*r = jsval_bool(ret);
return S_OK;
}
static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv,