Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread Tom Van Cutsem
[+Allen] 2013/3/13 Nathan Wall nathan.w...@live.com However, as a matter of principle, my argument is that `Object.getOwnPropertyDescriptor` should, at the bare minimum, return a descriptor that can be known to work in `Object.defineProperty`. If `Object.defineProperty` doesn't accept it,

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread Herby Vojčík
Tom Van Cutsem wrote: [+Allen] 2013/3/13 Nathan Wall nathan.w...@live.com mailto:nathan.w...@live.com However, as a matter of principle, my argument is that `Object.getOwnPropertyDescriptor` should, at the bare minimum, return a descriptor that can be known to work in

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread David Bruant
Le 14/03/2013 08:51, Tom Van Cutsem a écrit : [+Allen] 2013/3/13 Nathan Wall nathan.w...@live.com mailto:nathan.w...@live.com However, as a matter of principle, my argument is that `Object.getOwnPropertyDescriptor` should, at the bare minimum, return a descriptor that can be known

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread Brandon Benvie
On 3/14/2013 2:12 AM, David Bruant wrote: Le 14/03/2013 08:51, Tom Van Cutsem a écrit : [+Allen] 2013/3/13 Nathan Wall nathan.w...@live.com mailto:nathan.w...@live.com However, as a matter of principle, my argument is that `Object.getOwnPropertyDescriptor` should, at the bare

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread David Bruant
Le 14/03/2013 17:01, Brandon Benvie a écrit : I also mentioned I thought it was unlikely to be commonly used, since I've never seen it used besides some of my own code (which exists in a couple libraries used by few or just me). Sincere apologies on missing an important part of your quote (I

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-14 Thread Andrea Giammarchi
this is an excellent Point Mark, I wish I mentioned this earlier in redefine.js For already panicing developers sake, the problem addressed by Mark can be easily solved going explicitly over the property definition so that this won't work: Object.freeze(Object.prototype); function Point(x, y) {

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread David Bruant
Le 12/03/2013 16:45, Tom Van Cutsem a écrit : Hi Nathan, 2013/3/10 Nathan Wall nathan.w...@live.com mailto:nathan.w...@live.com Given that `defineProperty` uses properties on the prototype of the descriptor[1] and `getOwnPropertyDescriptor` returns an object which inherits from

RE: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread Nathan Wall
David Bruant wrote: Tom Van Cutsem wrote: To my mind, the blame for the breakage lies with `Object.prototype`  being mutated by the third-party script, not with property descriptors  inheriting from Object.prototype. Thus, a fix for the breakage should  address that directly, rather than

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread Mark S. Miller
The one qualification everyone should be aware of is that if they simply freeze these themselves, rather than using the tamper-proofing abstractions defined by SES[1][2], then they will suffer from the override mistake[3] and conventional code such as the following will break: function Point(x,

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread Mark S. Miller
On Wed, Mar 13, 2013 at 8:26 AM, Nathan Wall nathan.w...@live.com wrote: David Bruant wrote: Tom Van Cutsem wrote: To my mind, the blame for the breakage lies with `Object.prototype` being mutated by the third-party script, not with property descriptors inheriting from

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread David Bruant
Le 13/03/2013 16:26, Nathan Wall a écrit : David Bruant wrote: Tom Van Cutsem wrote: To my mind, the blame for the breakage lies with `Object.prototype` being mutated by the third-party script, not with property descriptors inheriting from Object.prototype. Thus, a fix for the breakage should

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-13 Thread David Bruant
Le 13/03/2013 16:49, Mark S. Miller a écrit : On Wed, Mar 13, 2013 at 8:26 AM, Nathan Wall nathan.w...@live.com mailto:nathan.w...@live.com wrote: David Bruant wrote: Tom Van Cutsem wrote: To my mind, the blame for the breakage lies with `Object.prototype` being

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-12 Thread Tom Van Cutsem
Hi Nathan, 2013/3/10 Nathan Wall nathan.w...@live.com Given that `defineProperty` uses properties on the prototype of the descriptor[1] and `getOwnPropertyDescriptor` returns an object which inherits from `Object.prototype`, the following use-case is volatile: function copy(from, to) {

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-10 Thread Andrea Giammarchi
for safe definition and more, have a look into redefine https://github.com/WebReflection/redefine#redefinejs br On Sat, Mar 9, 2013 at 7:54 PM, Nathan Wall nathan.w...@live.com wrote: Given that `defineProperty` uses properties on the prototype of the descriptor[1] and

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-10 Thread Herby Vojčík
Yes, this was in this list some three-four months ago. There were answers like JS is this way dynamic, playing with Object.prototype hurts. I proposed that return value from Object.getOwnPropertyDescriptor should inherit from well well-known frozen object with all the default set. Back, then

Re: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-10 Thread Andrea Giammarchi
there was another discussion here, is not just getOwnPropertyDescriptor problem: https://mail.mozilla.org/pipermail/es-discuss/2012-November/026705.html On Sun, Mar 10, 2013 at 4:37 AM, Herby Vojčík he...@mailbox.sk wrote: Yes, this was in this list some three-four months ago. There were

Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-09 Thread Nathan Wall
Given that `defineProperty` uses properties on the prototype of the descriptor[1] and `getOwnPropertyDescriptor` returns an object which inherits from `Object.prototype`, the following use-case is volatile:     function copy(from, to) {         for (let name of Object.getOwnPropertyNames(from))

RE: Nuking misleading properties in `Object.getOwnPropertyDescriptor`

2013-03-09 Thread Nathan Wall
(1) Nuke the special properties (`get`, `set`, and `value` when any of them is not defined) on a descriptor returned by `getOwnPropertyDescriptor` which shouldn't be inherited through the descriptor's prototype. By nuke them, I mean specify that they be defined as `undefined`, much like