On Thu, Feb 2, 2017 at 12:19 PM, Michał Wadas <[email protected]> wrote:
> Right now this code: > > Object.setPrototypeOf(Object.prototype, Object.create(null)) > > throws in both Chrome and Firefox. I couldn't find any mention of special > [[SetPrototypeOf]] of %ObjectPrototype%, did I miss something? > Yes. :-) You missed that `Object.prototype` is an immutable prototype exotic object: * https://tc39.github.io/ecma262/#sec-properties-of-the-object-prototype-object * https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects ...which does indeed have a special [[SetPrototypeOf]] which (indirectly) returns false if you try to change the [[Prototype]. `Object.setPrototypeOf` throws when [[SetPrototypeOf]] returns false: https://tc39.github.io/ecma262/#sec-object.setprototypeof -- T.J.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

