super.prop assignment can silently overwrite non-writable properties

Kevin Smith zenparsing at gmail.com
Wed Apr 22 11:44:49 UTC 2015


>
> ```
>> var y = {
>>      __proto__: x,
>>      set prop(v) {
>>          // ...
>>          super.prop = v;
>>      }
>> };
>> y.prop = 42;
>> ```
>>
>
> Assuming `x` here is the object where "prop" is bound to an accessor, can
> you clarify how this would lead to an infinite recursion?
>

Assume let x = {};  (i.e. no property definition for "prop" on x.)

"y" is the receiver, so if you fall back to calling the receiver's accessor
somewhere in 5.e, you get infinite recursion.

Falling back to the receiver's accessor would be a bug in this case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150422/6fa5a615/attachment-0001.html>


More information about the es-discuss mailing list