On Wed, Jul 6, 2011 at 2:58 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 7/6/11 5:48 PM, Mark S. Miller wrote:
>
>> Where is this requirement? (I'm not doubting it, just requesting a
>> pointer. Thanks.)
>>
>
> http://dev.w3.org/2006/webapi/**WebIDL/#es-operations<http://dev.w3.org/2006/webapi/WebIDL/#es-operations>(draft as of July 4, 2011) says:
>
> The characteristics of such a corresponding property are as follows:
> ....
> The value of the property is a Function object whose behavior is as
> follows
> ....
> 1) Let O be the result of calling ToObject on the this value.
> 2) If O is not a platform object that implements interface I, throw
> a TypeError.
>
Then
(1,setTimeout)(function(){'use strict'; alert('foo'); }, 0)
should throw a TypeError on all browsers. I think the bug is in this part of
WebIDL, but this something we could argue about. There is definitely a bug
somewhere.
Proposal: I think WebIDL should distinguish between methods sensitive to
their this-binding and functions which are not. I think setTimeout should be
classified as a function not sensitive to its this-binding.
--
Cheers,
--MarkM