This predicate function seems like it would be useful.
private static boolean isBaseObject(Scriptable s) {
// A direct instance of Object is the only Object whose prototype's
// prototype is null.
Scriptable proto = s.getPrototype();
return proto != null && proto.getPrototype() == null;
}
Refs: http://cajadores.com/docs/java/com/google/caja/util/RhinoAsserts.html#isBaseObject(org.mozilla.javascript.Scriptable)