|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * No matter how control leaves the embedded 'Statement', |
|
6 * the scope chain is always restored to its former state |
|
7 * |
|
8 * @path ch12/12.10/S12.10_A3.12_T1.js |
|
9 * @description Calling a function without "with" statement declared within the statement, leading to normal completion |
|
10 * @noStrict |
|
11 */ |
|
12 |
|
13 this.p1 = 1; |
|
14 var result = "result"; |
|
15 var myObj = {p1: 'a', |
|
16 value: 'myObj_value', |
|
17 valueOf : function(){return 'obj_valueOf';} |
|
18 } |
|
19 |
|
20 with(myObj){ |
|
21 var f = function(){ |
|
22 p1 = 'x1'; |
|
23 } |
|
24 } |
|
25 |
|
26 f(); |
|
27 |
|
28 if(!(p1 === 1)){ |
|
29 $ERROR('#1: p1 === 1. Actual: p1 ==='+ p1 ); |
|
30 } |
|
31 |
|
32 if(!(myObj.p1 === "x1")){ |
|
33 $ERROR('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); |
|
34 } |
|
35 |