__proto__ and accessor descriptors

Brendan Eich brendan at mozilla.org
Thu Nov 8 15:30:11 PST 2012


Jeff Walden wrote:
> On 10/26/2012 02:30 PM, David Bruant wrote:>  Le 26/10/2012 22:56, Asen Bozhilov a écrit :
>>> var obj = Object.defineProperty({}, '__proto__', {
>>>      get : function () {return '__proto__ getter'},
>>>      set : function (){return '__proto__ setter'}
>>> });
>>>
>>>
>>> console.log(obj.__proto__); //[object Object]
>>> console.log(obj.__proto__ = {}); //[object Object]
>>>
>> On Firefox Aurora, I find:
>> "__proto__ getter"
>> "[object Object]"
>>
>> According to this strawman, the output should indeed be
>> "__proto__getter" then "__proto__setter".
>
> Given that the result of evaluating |obj.__proto__ = {}| is the right-hand side (the return value of calling the setter is ignored), to the extent there's some determined-correct behavior here, it definitely wouldn't be to log "__proto__ setter".

Score! Good point.

David, if the setter calls console.log you should see the desired results.

/be


More information about the es-discuss mailing list