Is a proxy a valid proxy target? If that's the case, then the indirection
should allow you to do what you're doing. The outer proxy could freeze and
let the inner proxy know it shouldn't extend anything anymore, without
actually freezing it. The inner proxy can handle the rest of the actual
logic in the membrane.

On Sun, Sep 4, 2016, 17:06 Oriol Bugzilla <[email protected]>
wrote:

> > Could there be a Proxy.hasBeenRevoked(proxy) method?
>
> The Proxy constructor only accepts targets and handlers when they are
> objects and are not revoked proxies.
>
> I wonder what's the point of not allowing revoked proxies but allow
> revocable proxies which may be revoked later.
>
>
> Anyways, this allows you to check if a value is a revoked proxy: you only
> need to ensure that it's an object but makes Proxy throw.
>
> I think something like this should work:
>
>
> ```javascript
>
> Proxy.hasBeenRevoked = function(value) {
>
>   if(Object(value) !== value) {
>
>     return false; // Primitive value
>
>   }
>
>   try {
>
>     new Proxy(value, value);
>
>     return false; // Either non-proxy object or non-revoked proxy
>
>   } catch(err) {
>
>     return true; // Revoked proxy
>
>   }
>
> };
>
> ```
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to