S12.6.3_A6.js (1253B)
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 While evaluating "for ( ; ; Expression) Statement", Statement is 7 evaluated first and then Expression is evaluated 8 es5id: 12.6.3_A6 9 description: Using "(function(){throw "SecondExpression";})()" as an Expression 10 ---*/ 11 12 ////////////////////////////////////////////////////////////////////////////// 13 //CHECK#1 14 try { 15 for(;;(function(){throw "SecondExpression";})()){ 16 var __in__for = "reached"; 17 } 18 throw new Test262Error('#1: (function(){throw "SecondExpression"}() lead to throwing exception'); 19 } catch (e) { 20 if (e !== "SecondExpression") { 21 throw new Test262Error('#1: When for ( ; ; Expression) Statement is evaluated Statement evaluates first then Expression evaluates'); 22 } 23 } 24 // 25 ////////////////////////////////////////////////////////////////////////////// 26 27 ////////////////////////////////////////////////////////////////////////////// 28 //CHECK#2 29 if (__in__for !== "reached") { 30 throw new Test262Error('#2: __in__for === "reached". Actual: __in__for ==='+ __in__for ); 31 } 32 // 33 ////////////////////////////////////////////////////////////////////////////// 34 35 reportCompare(0, 0);