Making operations on property descriptors more robust against Object.prototype hazards

Brendan Eich brendan at mozilla.org
Sat Sep 13 08:49:29 PDT 2014


It's not nice to lose .toString, though.

Tom, didn't you have an idea for a fix? I can't find it but vaguely 
recall it (or dreamt it!).

/be

Claude Pache wrote:
> Hi,
>
> As noted some time ago, there is an issue with `Object.defineProperty` when it happens that someone has the facetious idea to give some value to `Object.prototype.get` [1].
>
> While it is hardly an issue in day-to-day programming, I think that it is a good idea to make sure that specialized API (Reflect, proxy traps) are robust by design against that bug^H^H^H feature. Concretely, I propose:
>
> (1) proxy.[[DefineOwnProperty]] — When a proxy defines the corresponding trap, it shall receive an object with no prototype as property descriptor.
>
> (2) Reflect.getOwnPropertyDescriptor —That method shall return an object with no prototype, so that it can be readily used elsewhere, e.g. in Reflect.defineProperty.


More information about the es-discuss mailing list