defineProperty invariants

David Bruant bruant.d at
Thu Oct 4 02:19:53 PDT 2012


I think it's the dual of the getOwnPropertyDescriptor invariant I talked
about recently.

  var t = {a:1};

  var p = new Proxy(t, {
    defineProperty: function(target, name, desc){
      return true; // pretend it's always successful

  Object.defineProperty(p, 'a', {configurable: false});

My reading of the current spec is that this doesn't throw, so it means that
Object.defineProperty pretends that 'a' has been successfully made
non-configurable while it's actually not the case.
Programs relying Object.defineProperty output being true can be fooled.
I think the invariant should be:
ToBoolean(definePropertyTrapOutput) === true => (descArgument.configurable
=== targetDesc.configurable)

Basically, it says that if the operation succeeded, the new target
descriptor and the descriptor on the target after the trap call are the

Do we want invariants regarding when ToBoolean(definePropertyTrapOutput) is

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list