Re: Strict mode callbacks and setTimeout

On 7/6/11 5:22 PM, Mark S. Miller wrote:
> On all the browsers I just tested,
>
> (1,setTimeout)(function(){'use strict'; alert('foo'); }, 0)
>
> alerts 'foo'.

So I suppose from the webidl point of view setTimeout is just a 
non-strict function?

>     This is true for non-strict-mode code already, right?  Or am I
>     misunderstanding the problem?
>
> I think you are. For the specified HTML5 behavior, when a setTimeout
> from frame X calls a non-strict callback from frame Y passing undefined
> as the thisArg, it is the non-strict callback's [[Call]] method that
> coerces the thisArg to Y's global object. Nothing requires X's
> setTimeout to be able to figure out what Y's global object is.

Ah, ok.

> Yes, this is the important legacy compat issue. We need to take a cross
> browser survey.
>
>       What does the ES5 spec say about that case? (Probably nothing,
>     since it assumes a unique global.)
>
>
> Correct. But our intent moving forward is clearly towards a lexical
> understanding of "which global".

Understood.

-Boris

Received on Wednesday, 6 July 2011 21:33:54 UTC