1
0
forked from mirrors/0ad

Expose JS_HasProperty

This was SVN commit r7449.
This commit is contained in:
Ykkrosh
2010-04-09 18:45:28 +00:00
parent 1fa8052cbe
commit cf48ff0588
2 changed files with 14 additions and 0 deletions
@@ -370,6 +370,18 @@ bool ScriptInterface::GetProperty_(jsval obj, const char* name, jsval& out)
return true;
}
bool ScriptInterface::HasProperty(jsval obj, const char* name)
{
if (! JSVAL_IS_OBJECT(obj))
return false;
JSObject* object = JSVAL_TO_OBJECT(obj);
JSBool found;
if (!JS_HasProperty(m->m_cx, object, name, &found))
return false;
return (found != JS_FALSE);
}
bool ScriptInterface::EnumeratePropertyNamesWithPrefix(jsval obj, const char* prefix, std::vector<std::string>& out)
{
LOCAL_ROOT_SCOPE;