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

On Tue, Apr 15, 2014 at 7:06 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:

> On 4/15/14 9:58 PM, Mark S. Miller wrote:
>
>> Why should the Map or WeakMap care about the Window?
>>
>
> I'm not saying it should.  Just answering the technical question.  ;)
>

Honestly, I'd be in favor of just throwing an exception here.

>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...

I guess one could just key it on the Document involved....


Assuming you're in the same origin and can see the Document.  Are you even
allowed to know always when an iframe navigates to another page?

Adam

Received on Wednesday, 16 April 2014 13:03:01 UTC