S12.10_A1.10_T3.js (4176B)
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 The with statement adds a computed object to the front of the 7 scope chain of the current execution context 8 es5id: 12.10_A1.10_T3 9 description: > 10 Using iteration statment withing "with" statement leading to 11 completion by exception iteration statement inside with statement 12 - exception completion 13 flags: [noStrict] 14 ---*/ 15 16 this.p1 = 1; 17 this.p2 = 2; 18 this.p3 = 3; 19 var result = "result"; 20 var myObj = {p1: 'a', 21 p2: 'b', 22 p3: 'c', 23 value: 'myObj_value', 24 valueOf : function(){return 'obj_valueOf';}, 25 parseInt : function(){return 'obj_parseInt';}, 26 NaN : 'obj_NaN', 27 Infinity : 'obj_Infinity', 28 eval : function(){return 'obj_eval';}, 29 parseFloat : function(){return 'obj_parseFloat';}, 30 isNaN : function(){return 'obj_isNaN';}, 31 isFinite : function(){return 'obj_isFinite';} 32 } 33 var del; 34 var st_p1 = "p1"; 35 var st_p2 = "p2"; 36 var st_p3 = "p3"; 37 var st_parseInt = "parseInt"; 38 var st_NaN = "NaN"; 39 var st_Infinity = "Infinity"; 40 var st_eval = "eval"; 41 var st_parseFloat = "parseFloat"; 42 var st_isNaN = "isNaN"; 43 var st_isFinite = "isFinite"; 44 45 try { 46 with(myObj){ 47 do{ 48 throw value; 49 st_p1 = p1; 50 st_p2 = p2; 51 st_p3 = p3; 52 st_parseInt = parseInt; 53 st_NaN = NaN; 54 st_Infinity = Infinity; 55 st_eval = eval; 56 st_parseFloat = parseFloat; 57 st_isNaN = isNaN; 58 st_isFinite = isFinite; 59 p1 = 'x1'; 60 this.p2 = 'x2'; 61 del = delete p3; 62 var p4 = 'x4'; 63 p5 = 'x5'; 64 var value = 'value'; 65 } 66 while(false); 67 } 68 } catch(e){ 69 result = e; 70 } 71 72 if(!(result === "myObj_value")){ 73 throw new Test262Error('#0: result === "myObj_value". Actual: result ==='+ result ); 74 } 75 76 if(!(p1 === 1)){ 77 throw new Test262Error('#1: p1 === 1. Actual: p1 ==='+ p1 ); 78 } 79 80 if(!(p2 === 2)){ 81 throw new Test262Error('#2: p2 === 2. Actual: p2 ==='+ p2 ); 82 } 83 84 if(!(p3 === 3)){ 85 throw new Test262Error('#3: p3 === 3. Actual: p3 ==='+ p3 ); 86 } 87 88 if(!(p4 === undefined)){ 89 throw new Test262Error('#4: p4 === undefined. Actual: p4 ==='+ p4 ); 90 } 91 92 try { 93 p5; 94 throw new Test262Error('#5: p5 is not defined'); 95 } catch(e) { 96 } 97 98 if(!(myObj.p1 === "a")){ 99 throw new Test262Error('#6: myObj.p1 === "a". Actual: myObj.p1 ==='+ myObj.p1 ); 100 } 101 102 if(!(myObj.p2 === "b")){ 103 throw new Test262Error('#7: myObj.p2 === "b". Actual: myObj.p2 ==='+ myObj.p2 ); 104 } 105 106 if(!(myObj.p3 === "c")){ 107 throw new Test262Error('#8: myObj.p3 === "c". Actual: myObj.p3 ==='+ myObj.p3 ); 108 } 109 110 if(!(myObj.p4 === undefined)){ 111 throw new Test262Error('#9: myObj.p4 === undefined. Actual: myObj.p4 ==='+ myObj.p4 ); 112 } 113 114 if(!(myObj.p5 === undefined)){ 115 throw new Test262Error('#10: myObj.p5 === undefined. Actual: myObj.p5 ==='+ myObj.p5 ); 116 } 117 118 if(!(st_parseInt === "parseInt")){ 119 throw new Test262Error('#11: myObj.parseInt === "parseInt". Actual: myObj.parseInt ==='+ myObj.parseInt ); 120 } 121 122 if(!(st_NaN === "NaN")){ 123 throw new Test262Error('#12: st_NaN === "NaN". Actual: st_NaN ==='+ st_NaN ); 124 } 125 126 if(!(st_Infinity === "Infinity")){ 127 throw new Test262Error('#13: st_Infinity === "Infinity". Actual: st_Infinity ==='+ st_Infinity ); 128 } 129 130 if(!(st_eval === "eval")){ 131 throw new Test262Error('#14: st_eval === "eval". Actual: st_eval ==='+ st_eval ); 132 } 133 134 if(!(st_parseFloat === "parseFloat")){ 135 throw new Test262Error('#15: st_parseFloat === "parseFloat". Actual: st_parseFloat ==='+ st_parseFloat ); 136 } 137 138 if(!(st_isNaN === "isNaN")){ 139 throw new Test262Error('#16: st_isNaN === "isNaN". Actual: st_isNaN ==='+ st_isNaN ); 140 } 141 142 if(!(st_isFinite === "isFinite")){ 143 throw new Test262Error('#17: st_isFinite === "isFinite". Actual: st_isFinite ==='+ st_isFinite ); 144 } 145 146 if(!(value === undefined)){ 147 throw new Test262Error('#18: value === undefined. Actual: value ==='+ value ); 148 } 149 150 if(!(myObj.value === "myObj_value")){ 151 throw new Test262Error('#19: myObj.value === "myObj_value". Actual: myObj.value ==='+ myObj.value ); 152 } 153 154 reportCompare(0, 0);