__proto__ can be globally switched off by deleting Object.prototype.__proto__.
I’m assuming that that is useful for security-related applications (Caja et
al.). But I’m wondering: doesn’t that go too far? I’m seeing three ways of
using __proto__:
1. Read the [[Prototype]] of an object. Already possible via
Object.getPrototypeOf().
2. Set the [[Prototype]] of a fresh object created via an object literal (i.e.,
an alternative to the rejected <| operator). Already (kind of) possible via
Object.create().
3. Mutate the [[Prototype]] of an existing object.
Globally, I would only want to switch off #3.
Rationale: the only security-critical operation of the three(?) The use case
for performing this operation goes mostly away by ES6 allowing us to subtype
built-ins. Could #3 be forbidden in strict mode?
#1 and #2 should not be possible if an object does not have Object.prototype in
its prototype chain.
Rationale: objects as dictionaries via Object.create(null) or { __proto__: null
}
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss