new [[HasProperty]] invariant for non-extensible objects

Oriol _ oriol-bugzilla at hotmail.com
Sun Mar 5 14:46:45 UTC 2017


Yes, but the point is that if the property is removed, then [[HasProperty]] will return false, and thus the invariant can't be enforced, because an exotic object might behave like if the property was deleted under the hood.

Since you say the invariant is enforced for exotic proxy objects, you may prefer a counterexample for these:

```js
var target = Object.preventExtensions({foo: "bar"});
var p = new Proxy(target, {
  has: (target, prop) => !Reflect.deleteProperty(target, prop)
});

// Object is non-extensible
Object.isExtensible(p); // false

// foo is an observable own property
!!Object.getOwnPropertyDescriptor(p, "foo"); // true

// [[HasProperty]] returns false
"foo" in p; // false
```

-Oriol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170305/81aeab3b/attachment.html>


More information about the es-discuss mailing list