Catching "eval"

Jason Orendorff jason.orendorff at
Tue Aug 3 11:07:23 PDT 2010

On Wed, Jul 28, 2010 at 1:59 AM, Michael Day <mikeday at> wrote:
> Any comments on this code:
> try
> {
>    throw eval;
> }
> catch (x)
> {
>    alert(x("3"));
> }

ES3 and ES5 require the same behavior for this code. Firefox
implements that. Not much to say.

> It does not appear to throw an EvalError in Firefox 3.6.7, even though many
> other indirect uses of eval will.

What did you have in mind? It should be pretty hard to get us to throw
an EvalError. I think we throw sometimes if you pass two or more
arguments to eval, or if you arrange to have eval called
not-from-script (e.g. using it as an event handler). So, don't do


More information about the es-discuss mailing list