S12.10_A3.1_T1.js (1121B)
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 info: | 6 No matter how control leaves the embedded 'Statement', 7 the scope chain is always restored to its former state 8 es5id: 12.10_A3.1_T1 9 description: Using "with" statement within global context - normal completion 10 flags: [noStrict] 11 ---*/ 12 13 this.p1 = 1; 14 15 var result = "result"; 16 17 var myObj = { 18 p1: 'a', 19 value: 'myObj_value', 20 valueOf : function(){return 'obj_valueOf';} 21 } 22 23 24 with(myObj){ 25 p1 = 'x1'; 26 } 27 28 ////////////////////////////////////////////////////////////////////////////// 29 //CHECK#1 30 if(p1 !== 1){ 31 throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); 32 } 33 // 34 ////////////////////////////////////////////////////////////////////////////// 35 36 ////////////////////////////////////////////////////////////////////////////// 37 //CHECK#2 38 if(myObj.p1 !== "x1"){ 39 throw new Test262Error('#2: myObj.p1 === "x1". Actual: myObj.p1 ==='+ myObj.p1 ); 40 } 41 // 42 ////////////////////////////////////////////////////////////////////////////// 43 44 reportCompare(0, 0);