File indexing completed on 2024-04-28 15:28:37

0001 shouldBe("eval.length", "1");
0002 shouldBe("eval('this')", "this");
0003 
0004 function MyObject() {
0005   this.x = 99;
0006 }
0007 
0008 eval("b = new MyObject();");
0009 var bx = b.x   // rule out side effects of eval() in shouldBe() test function
0010 shouldBe("bx", "99");
0011 
0012 
0013 eval("var c = new MyObject();"); // the 'var' makes a difference
0014 var cx = c.x;
0015 shouldBe("cx", "99");
0016 
0017 // KDE bug #45679
0018 if (true.eval) {
0019   var o = { str:1 };
0020   shouldBe("o.eval('str')", "1");
0021   shouldBe("o.eval('this')", "this");
0022 } else {
0023   testPassed("Skipping test for deprecated Object.prototype.eval()");
0024 }
0025 
0026 // problem from within khtml
0027 function lotto() {
0028   // j must be accessible to eval()
0029   for (var j = 0; j < 1; j++)
0030     return eval('j');
0031 }
0032 shouldBe("lotto()", "0");