On Dec 29, 2011, at 3:38 AM, Lasse Reichstein wrote:
> There is one side-effect to defining __proto__ using a getter/setter
> property. You can extract the setter and store it for later, allowing
> you to change the prototype of objects after someone else deleted the
> __proto__ property.
Not if the built-in setter function for __proto__ is defined similarly to:
Object.defineProperty(Object.prototype,'__proto__',
{set: function __proto__(value) {
if (Object.getPropertyDescriptor(this,'__proto__').set !==
__proto__) throw new TypeError('invalid use of __proto__');
... //do the work of validating and setting [[Prototype]] of this
}});
(and assuming that Object.getPropertyDescriptor is defined to access inherited
properties)
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss