Re: double checking if window.eval(…) is an indirect call to eval().

Dmitry Soshnikov dmitry.soshnikov at
Sat Aug 27 14:42:51 PDT 2011

On Sat, Aug 27, 2011 at 11:53 PM, John-David Dalton <
john.david.dalton at> wrote:

> > No. It's the global object what is the base (more precisely, its DOM's
> proxy wrapper -- `window` or either the global itself), but not an
> environment record.
> So basically the only kind of MemberExpression allowed is a
> PrimaryExpression?

If it will be easier for you to remember (and what is actually is written in
the reference I gave), _only_ `eval` call written in the following syntactic
form is direct:


Only. _All_ the other cases are indirect.

> So writing it out is like:
>  `window.eval`  -> GetValue(`window.eval`) -> `window` is seen as the
> base so it
>  goes to step 4 of 8.7.1 and not step 5 (which is for environment records).

> ES3 makes it a bit more clear:
> "If value of the eval property is used in any way other than a direct
> call (that is, other than by the
> explicit use of its name as an Identifier which is the
> MemberExpression in a CallExpression), or if the
> eval property is assigned to, an EvalError exception may be thrown."
Yes, perhaps.

> Though older browsers w/ their older implementations will barf on `(1,
> eval)(…)` but not `window.eval(..)` for some reason.
I think the main word is "may" why it is so. If it would "should", then
maybe implementations would throw SyntaxError in both cases.

> > No, it's indirect.
> >
> >
> I knew you would chime in with a link to your post, which is why I
> wrote I read the notes associated with the link I posted (your post
> was one of the notes) :P
Is there something unclear in my explanation? Want to propose to improve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list