Debian Codegraph @

js/src/tests/non262/regress/regress-452742-02.js

raw
1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = 452742;
8 var summary = 'Do not do overzealous eval inside function optimization in BindNameToSlot';
9 var actual = '';
10 var expect = '';
11
12
13 //-----------------------------------------------------------------------------
14 test();
15 //-----------------------------------------------------------------------------
16
17 function test()
18 {
19 printBugNumber(BUGNUMBER);
20 printStatus (summary);
21
22 expect = '';
23
24 var obj = { arguments: [-100] };
25
26 function a()
27 {
28 with (obj) { return eval("arguments[0]"); }
29 }
30
31 function b()
32 {
33 var result;
34 eval('with (obj) { result = eval("arguments[0]"); };');
35 return result;
36 }
37
38 try
39 {
40 var result = a();
41 if (result !== -100)
42 throw "Bad result " + result;
43
44 var result = b();
45 if (result !== -100)
46 throw "Bad result " + result;
47 }
48 catch(ex)
49 {
50 actual = ex + '';
51 }
52 reportCompare(expect, actual, summary);
53 }