Object.getOwnPropertyDescriptor can return just about anything
allen at wirfs-brock.com
Tue Apr 29 18:29:01 PDT 2014
On Apr 30, 2014, at 11:08 AM, Mark S. Miller <erights at google.com> wrote:
> I'm surprised and alarmed by this, and it seems wrong. It is also not what I think I remember. What about, for example, the invariant that an object cannot both claim that a property is non-configurable but then later change its alleged configuration? The issue isn't just the internal perception by other internal procedures,but obviously also the observations by user code.
Don’t read too much into quick email responses. This has been hashed over before, and we should dig out the old discussions and nothing has really changed with this part of the spec. for a long time. Unfortunately I’m traveling this week and can’t spend much time on it.
Note that invariants such as you describe (for Proxies, which is what this is all about) apply only to non-configurable properties (which, by definition must exist on the target). It is possible that there needs to be an additional check in that case requiring that for such properties that the descriptor object returned from the handler must only use data properties for the attribures.
> What I think I remember is that a proxy can add other fields to a property descriptor object, but that it cannot change the behavior of any of the ES6-defined fields (the usual .value, .writable, .set, .get, .enumerable, .configurable), not even to censor them.
For configurable properties, it can do anything it wants. How would we prevent?
> Am I misunderstanding something? If not, this seems like a huge disconnect for which we need to stop the train.\
Again, there is nothing new here. At the very least you should look at the old discussion about this.
More information about the es-discuss