Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /**
5 * Using "try" with "catch" or "finally" statement within/without a "while" statement
6 *
7 * @path ch12/12.14/S12.14_A10_T4.js
8 * @description Try statement inside loop, where combinate using break and continue
9 */
11 // CHECK#1
12 var c1=0,fin=0;
13 while(c1<2){
14 try{
15 c1+=1;
16 break;
17 }
18 catch(er1){}
19 finally{
20 fin=1;
21 continue;
22 }
23 fin=-1;
24 c1+=2;
25 }
26 if(fin!==1){
27 $ERROR('#1.1: "finally" block must be evaluated');
28 }
29 if(c1!==2){
30 $ERROR('#1.2: "try{break} catch finally{continue}" must work correctly');
31 }
33 // CHECK#2
34 var c2=0,fin2=0;
35 while(c2<2){
36 try{
37 throw "ex1";
38 }
39 catch(er1){
40 c2+=1;
41 break;
42 }
43 finally{
44 fin2=1;
45 continue;
46 }
47 c2+=2;
48 fin2=-1;
49 }
50 if(fin2!==1){
51 $ERROR('#2.1: "finally" block must be evaluated');
52 }
53 if(c2!==2){
54 $ERROR('#2.2: "try catch{break} finally{continue} must work correctly');
55 }