On Mon, Feb 3, 2014 at 4:16 PM, Boris Zbarsky <[email protected]> wrote:

> On 2/3/14 6:45 PM, Allen Wirfs-Brock wrote:
>
>> In ES6 all functions, including built-ins are permanently associated with
>> a Realm when they are created.
>>
>
> Yes.  That plus every global having an origin gives us the concept of
> origin of a function, which is well defined.  And that's useful and used
> for things.  But it doesn't match what postMessage needs to do, because if
> my code does:
>
>   otherWindow.postMessage(args)
>
> then the origin of the message is my code, not otherWindow...


It is an extremely bad idea to have the consequences of a function call
depend on properties of the caller rather than of the function and the
arguments. (Hence the removal of .caller and .callee in strict mode.) Even
if it proves necessary for legacy compatibility, no such behavior should be
specified in new systems.

I think I heard that Firefox already handles this via a membrane
('otherWindow' is not actually the same as that window's 'window' object,
but you can't tell because they're substituted as needed when passed across
origins); can someone confirm this? This removes any dependency on the
calling context — in particular, there is no need to have origin
information in contexts/"stack frames" rather than objects (which naturally
belong to a particular realm and hence origin).
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to