How can eval code not have a calling context?
Mark S. Miller
erights at google.com
Thu Jun 19 20:20:50 PDT 2008
On Thu, Jun 19, 2008 at 6:43 PM, Brendan Eich <brendan at mozilla.org> wrote:
> On Jun 19, 2008, at 4:49 PM, Mark S. Miller wrote:
>> I am baffled by "If there is no calling context,". How could the
>> possibility arise? How would eval get called if no one calls it?
>
>
> A call from native code, the "host" program.
>
> Some browsers support indirect eval, allowing this:
>
> setTimeout(eval, 0, "alert('hi mom')")
>
> The window used is the one in which setTimeout was found along the scope
> chain, so
>
> myFrame.setTimeout(eval, 0, "alert(x)")
>
> should show myFrame.x, not the calling frame or window's x.
>
> This is not something patched Firefox major versions support.
Thanks, this was very clarifying. Which of these cases would ES4
consider to be uses of the eval operator, and which of the eval
function?
--
Cheers,
--MarkM
More information about the Es4-discuss
mailing list