Re: Interesting spec ambiguity: cross-frame "this"

Well, I don't think ES5 has anything to say about this issue because as you know it doesn't include the concept of multiple global contexts.  I actually don't think it is valid to try to interpret the ES5 spec. to try to find guidance on this issue as  anything thing you find that may seem relevant to this situation is probably coincidental.

That said, I'll violate my own advice and point out some possibly relevant things in the ES5 spec.

First, the global object that is in scope to a function is captured when a function instantiated as part of the state captured via the [[Scope]] internal property.  So, that means in canary.html the global object used to resolve 'window' and 'parent'  within the canary function should be the frame's global object.  The value passed as the this value to the call to canary is determined by 10.4.3 (Entering Function Code) but is only identified as the "global object".  There is no hint in 10.4.3 about which global object to use.  However, 10.4.3 is referenced from the specification of the [[Call]] internal method (13.2.1).  Both [[Call]] and [[Scope]] are part of the  internals of a function object so you would expect them to have a consistent view of the "global object". Hence, when [[Call]] refers to 10.4.3 I would assume that it should be done using the same "global object" that [[Scope]] captured.

Thus, the expected answer should be "true,false,[object ???]"

But, like I said above, this is not necessarily intentional.

Does the HTML spec. explicitly covers this case?


On Apr 18, 2011, at 1:09 PM, Mark S. Miller wrote:

> See <>.
> -- 
>     Cheers,
>     --MarkM

Received on Monday, 18 April 2011 21:18:03 UTC