Dynamic scoping of Function and indirect eval

18 views
Skip to first unread message

Nicolò Ribaudo

unread,
Jun 29, 2023, 9:26:54 AM6/29/23
to SES-strategy
Hello,

Following up from the discussion we had yesterday, I tested the behavior of `new Function("import(str)")` and `(0, eval)("import(str)")` in the main browsers.

I pushed the test and results to https://github.com/nicolo-ribaudo/function-dynamic-scoping. It's a private repository, but feel free to request access.

- Firefox follows the spec, with dynamic scoping
- Chrome follows the spec, with dynamic scoping, on the first page load. On page reload it behaves weirdly.
- I do not understand what Safari does. It has some form of dynamic scoping, but it does not match the spec. I do not have any explanation for the two different "Polyfilled indirect eval" and "Inline indirect eval in folder/" results.

Cheers,
Nicolò Ribaudo

Reply all
Reply to author
Forward
0 new messages