Added hasOwnProperty, propertyIsEnumerable, isPrototypeOf to Object.
git-svn-id: svn://10.0.0.236/trunk@66471 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -141,6 +141,48 @@ public class NativeObject extends ScriptableObject {
|
||||
{
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public static Object jsFunction_hasOwnProperty(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
{
|
||||
if (args.length != 0)
|
||||
if (thisObj.has(ScriptRuntime.toString(args[0]), null))
|
||||
return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public static Object jsFunction_propertyIsEnumerable(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
{
|
||||
try {
|
||||
if (args.length != 0) {
|
||||
String name = ScriptRuntime.toString(args[0]);
|
||||
if (thisObj.has(name, null))
|
||||
if ((((ScriptableObject)thisObj).getAttributes(name, null)
|
||||
& ScriptableObject.DONTENUM) == 0)
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
catch (PropertyException x) {
|
||||
}
|
||||
catch (ClassCastException x) {
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public static Object jsFunction_isPrototypeOf(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
{
|
||||
if (args.length != 0)
|
||||
if (args[0] instanceof Scriptable)
|
||||
if (thisObj == (Scriptable)args[0].getPrototype())
|
||||
return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -141,6 +141,48 @@ public class NativeObject extends ScriptableObject {
|
||||
{
|
||||
return thisObj;
|
||||
}
|
||||
|
||||
public static Object jsFunction_hasOwnProperty(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
{
|
||||
if (args.length != 0)
|
||||
if (thisObj.has(ScriptRuntime.toString(args[0]), null))
|
||||
return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public static Object jsFunction_propertyIsEnumerable(Context cx,
|
||||
Scriptable thisObj,
|
||||
Object[] args,
|
||||
Function funObj)
|
||||
{
|
||||
try {
|
||||
if (args.length != 0) {
|
||||
String name = ScriptRuntime.toString(args[0]);
|
||||
if (thisObj.has(name, null))
|
||||
if ((((ScriptableObject)thisObj).getAttributes(name, null)
|
||||
& ScriptableObject.DONTENUM) == 0)
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
catch (PropertyException x) {
|
||||
}
|
||||
catch (ClassCastException x) {
|
||||
}
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
public static Object jsFunction_isPrototypeOf(Context cx, Scriptable thisObj,
|
||||
Object[] args, Function funObj)
|
||||
{
|
||||
if (args.length != 0)
|
||||
if (args[0] instanceof Scriptable)
|
||||
if (thisObj == (Scriptable)args[0].getPrototype())
|
||||
return Boolean.TRUE;
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user