Re: defineProperty is a blacklist

On 2/13/11 12:57 PM, gaz Heyes wrote:
> I'd like to emphasize my point made at the OWASP summit,
> defineProperty rocks and the ES5 specification was created by the
> hands of js gods but for all it's brilliance defineProperty is still
> a blacklist. We need the ability to somehow create a whitelist of
> allowed properties and the ability to apply a property descriptor to
> any properties that do not conform to this whitelist.

Is Object.preventExtensions what you want?

https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/preventExtensions

Take a look at Object.seal and Object.freeze as well.

-Dan Veditz

Received on Wednesday, 16 February 2011 19:06:10 UTC