diff -ru old_rhino1_7R2/src/org/mozilla/javascript/NativeObject.java rhino1_7R2/src/org/mozilla/javascript/NativeObject.java --- old_rhino1_7R2/src/org/mozilla/javascript/NativeObject.java 2009-03-22 14:32:24.000000000 +1100 +++ rhino1_7R2/src/org/mozilla/javascript/NativeObject.java 2009-04-02 19:24:29.000000000 +1100 @@ -71,6 +71,14 @@ } @Override + protected void fillConstructorProperties(IdFunctionObject ctor) + { + addIdFunctionProperty(ctor, OBJECT_TAG, ConstructorId_getPrototypeOf, + "getPrototypeOf", 1); + super.fillConstructorProperties(ctor); + } + + @Override protected void initPrototypeId(int id) { String s; @@ -256,6 +264,18 @@ } return Undefined.instance; + case ConstructorId_getPrototypeOf: + if (args.length < 1) + return Undefined.instance; + + Object arg = args[0]; + + if ( !(arg instanceof Scriptable) ) + throw ScriptRuntime.undefReadError(arg, "__proto__"); // TODO: create proper error message for this + + Scriptable obj = (Scriptable) arg; + return obj.getPrototype(); + default: throw new IllegalArgumentException(String.valueOf(id)); } @@ -303,6 +323,8 @@ } private static final int + ConstructorId_getPrototypeOf = -1, + Id_constructor = 1, Id_toString = 2, Id_toLocaleString = 3,