Re: WindowProxy as the key in ES6 Set/Map/WeakSet/WeakMap

Summing up, using an object as a key, in either a Map or a WeakMap, should
only depend on the same object identity as used by ===. There's no reason
to make an exception for WindowProxy, so don't.


On Wed, Apr 16, 2014 at 3:16 AM, Toon Verwaest <verwaest@chromium.org>wrote:

>
> >> From a use cases perspective, there is one issue: how does one attach
> state to a "web page"?
> >
> >
> > That's a slippery notion because sometimes |w| acts like the container
> and sometimes it acts like the thing contained.  Sounds like a recipe for
> security vulnerabilities when the author and WeakMap disagree about whether
> they're talking about the container or the thing contained...
>
> If you want to associate state with a proxy, use a WeakMap.
>
> If you want to attach state to a specific window with all security checks,
> install a private symbol on the window itself. (Granted, this does not
> exist yet :-)).
>



-- 
    Cheers,
    --MarkM

Received on Wednesday, 16 April 2014 07:37:27 UTC