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

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Sat Aug 27 12:25:48 PDT 2011


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

> So I have read the section (and the notes associated with it) over
> what a direct call to eval is:
> http://es5.github.com/#x15.1.2.1.1
> http://dev.w3.org/html5/spec/Overview.html#script-s-global-object
>
> > A direct call to the eval function is one that is expressed as a
> CallExpression that meets the following two conditions:
> > The Reference that is the result of evaluating the MemberExpression in
> the CallExpression has an environment record as its base value and its
> reference name is "eval".
> > The result of calling the abstract operation GetValue with that Reference
> as the argument is the standard built-in function defined in 15.1.2.1.
>
> But I am still a little unsure if `window.eval(…)` is a direct call or not.
> I have heard `window.eval()` is an indirect call but wanted to make sure.
>
> I see it as
> <call expression><member expression> window.eval</member expression>
> (…) </call expression>
>
> Wouldn't the result of evaluating the MemberExpression `window.eval`
> have global's environment record as its base and a reference name of
> `eval`?
>

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.


> Is `window.eval(..)` a direct call to eval?
>
>
No, it's indirect.

http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#indirect-eval-call

Dmitry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110827/491eaf19/attachment.html>


More information about the es-discuss mailing list