js/src/tests/test262/ch12/12.10/S12.10_A3.11_T1.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:eda65853f19e
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.11_T1.js
9 * @description Calling a function within "with" statement declared without 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 var f = function(){
21 p1 = 'x1';
22 }
23
24 with(myObj){
25 f();
26 }
27
28 if(!(p1 === "x1")){
29 $ERROR('#1: p1 === "x1". Actual: p1 ==='+ p1 );
30 }
31
32 if(!(myObj.p1 === "a")){
33 $ERROR('#2: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 );
34 }
35

mercurial