diff --git a/mozilla/js/rhino/org/mozilla/javascript/NativeObject.java b/mozilla/js/rhino/org/mozilla/javascript/NativeObject.java index 76510eaae56..56dc36ab781 100644 --- a/mozilla/js/rhino/org/mozilla/javascript/NativeObject.java +++ b/mozilla/js/rhino/org/mozilla/javascript/NativeObject.java @@ -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; + } } diff --git a/mozilla/js/rhino/src/org/mozilla/javascript/NativeObject.java b/mozilla/js/rhino/src/org/mozilla/javascript/NativeObject.java index 76510eaae56..56dc36ab781 100644 --- a/mozilla/js/rhino/src/org/mozilla/javascript/NativeObject.java +++ b/mozilla/js/rhino/src/org/mozilla/javascript/NativeObject.java @@ -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; + } }