not if you parsed that object via `JSON.parse('{"__proto__":[]}')`
in this case is the equivalent of that operation through
`Object.defineProperty({}, '__proto__', {enumerable: true, writable: true,
configurable: true})` so that `obj.__proto__` will result into property
assignment and no setter invoked.
```javascript
var o = JSON.parse('{"__proto__":[]}');
o.__proto__ = Date.prototype;
o instanceof Date; // false
o.getTime === void 0; // true
delete o.__proto__; // true
// once again
o.__proto__ = Date.prototype;
// but this time ...
o instanceof Date; // true
o.getTime; // function[native]
```
Cheers
On Tue, Oct 15, 2013 at 3:19 PM, Dean Landolt <[email protected]> wrote:
>
>
>
> On Tue, Oct 15, 2013 at 5:50 PM, Brendan Eich <[email protected]> wrote:
>
>> Benjamin (Inglor) Gruenbaum wrote:
>>
>>> Not resolving this like o3 (or o6 really) sounds very strange. I think:
>>>
>>> let attr = "__proto__";
>>> let o7 = new Object;
>>> o7[attr] = p; // o7 inherits from p
>>>
>>> Is the correct behavior here (why would it not invoke the setter?)
>>>
>>
>> Allen confirmed, but just to be clear, any world where o["foo"] and do {
>> let key = "foo"; o[key]; } (do-expression syntax from harmony-era strawman)
>> differ is crazytown, and we do not go there.
>>
>
> True, but the __proto__ train left the station bound for crazytown long
> ago...
>
> So just to be clear, the only way to add a __proto__ property to an
> existing object is with Object.defineProperty?
>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss