Re: Open Source Cross-Browser setImmediate in JavaScript

On Fri, Jul 1, 2011 at 9:43 PM, Donavon West <dwest@book.com> wrote:
> * please remove the case for a string eval'ed handler argument. Stop the
> madness! Stop it now!

Agreed!

Not only does setImmediate with a string argument come with security
implications (for example for frameworks like Caja, and for policy
languages like CSP), it also encourages people to write less efficient
code, which is contrary to the goals of the setImmediate
specification.

I'm also not sure what the use case for being able to cancel callbacks
are? Most likely we'll need to start returning opaque objects rather
than integers (see feedback to the requestAnimationFrame
specification). This means that implementations will have to create an
extra object every time setImmediate is called, even in the likely far
most common use case of the return value being destroyed.

It seems to me that if the use case for setImmediate is to allow
spreading out a calculation over multiple tasks, there isn't much need
to be able to cancel a request.

/ Jonas

Received on Tuesday, 5 July 2011 09:38:14 UTC