preventExtensions trap and its true/false protocol

Tom Van Cutsem at
Tue Apr 2 00:13:50 PDT 2013

2013/4/1 Jeff Walden <jwalden+es at>

> Note that this could also be construed as a feature, in certain cases.
>  The "dead object" proxy Mozilla has, previously mentioned here (can't find
> a link), has all its traps throw an error with a message saying "Dead
> object".  If the trap returns true/false, it's no longer possible for
> preventExtensions to say that the object in question is dead, not just
> can't be made non-extensible.

The true/false return protocol doesn't prevent exceptions to be thrown from
the trap. It's perfectly fine for the dead object proxy's preventExtensions
trap to throw an "object is dead" exception. In fact, that's precisely what
would happen if one would call preventExtensions on a revoked revocable

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

More information about the es-discuss mailing list