W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2011

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

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Mon, 18 Apr 2011 14:17:27 -0700
Cc: es-discuss <es-discuss@mozilla.org>, public-script-coord@w3.org, es5-discuss@mozilla.org
Message-Id: <F3CAA7CC-F428-4B7F-ABC1-084698C1CE73@wirfs-brock.com>
To: Mark S. Miller <erights@google.com>
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?

Allen

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

> See <http://code.google.com/p/chromium/issues/detail?id=79612>.
> 
> -- 
>     Cheers,
>     --MarkM
Received on Monday, 18 April 2011 21:18:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:03 UTC