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

Re: Strict mode callbacks and setTimeout

From: Mark S. Miller <erights@google.com>
Date: Wed, 6 Jul 2011 15:17:43 -0700
Message-ID: <CABHxS9hBZ1YueiMEp7rYERe=o3NXbhpMS_q3rnn=RzX_w03y-w@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: Allen Wirfs-Brock <allen@wirfs-brock.com>, Luke Hoban <lukeh@microsoft.com>, "es5-discuss@mozilla.org" <es5-discuss@mozilla.org>, public-script-coord@w3.org
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
Received on Wednesday, 6 July 2011 22:18:08 UTC

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