private object SetupDefaultPrototype()
{
lock (this)
{
if (prototypeProperty != null)
{
return prototypeProperty;
}
NativeObject obj = new NativeObject();
int attr = ScriptableObject.DONTENUM;
obj.DefineProperty("constructor", this, attr);
// put the prototype property into the object now, then in the
// wacky case of a user defining a function Object(), we don't
// get an infinite loop trying to find the prototype.
prototypeProperty = obj;
Scriptable proto = GetObjectPrototype(this);
if (proto != obj)
{
// not the one we just made, it must remain grounded
obj.SetPrototype(proto);
}
return obj;
}
}