js/src/tests/js1_5/Regress/regress-452742-01.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:fd2ad39e1322
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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 enterFunc ('test');
20 printBugNumber(BUGNUMBER);
21 printStatus (summary);
22
23 expect = actual = 'No Error';
24
25 var obj = { x: -100 };
26
27 function a(x)
28 {
29 var orig_x = x;
30 var orig_obj_x = obj.x;
31
32 with (obj) { eval("x = x + 10"); }
33
34 if (x !== orig_x)
35 throw "Unexpected mutation of x: " + x;
36 if (obj.x !== orig_obj_x + 10)
37 throw "Unexpected mutation of obj.x: " + obj.x;
38 }
39
40 try
41 {
42 a(0);
43 }
44 catch(ex)
45 {
46 actual = ex + '';
47 }
48 reportCompare(expect, actual, summary);
49
50 exitFunc ('test');
51 }

mercurial