permanently-screwed-by-eval.js 345 B

12345678910111213
  1. test("basic that non-strict direct eval() prevents non-local access caching", () => {
  2. function foo(do_eval) {
  3. var c = 1;
  4. function bar(do_eval) {
  5. if (do_eval) eval("var c = 2;");
  6. return c;
  7. }
  8. return bar(do_eval);
  9. }
  10. expect(foo(false)).toBe(1);
  11. expect(foo(true)).toBe(2);
  12. });