tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S12.14_A9_T4.js (1106B)


      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    "try" with "catch" or "finally" statement within/without an "do while"
      7    statement
      8 es5id: 12.14_A9_T4
      9 description: >
     10    "try" statement within a loop, the statement contains "continue"
     11    and "break" statements
     12 ---*/
     13 
     14 // CHECK#1
     15 var c1=0,fin=0;
     16 do{
     17  try{
     18    c1+=1;
     19    break;
     20  }
     21  catch(er1){}
     22  finally{
     23    fin=1;
     24    continue;
     25  }
     26  fin=-1;
     27  c1+=2;
     28 }
     29 while(c1<2);
     30 if(fin!==1){
     31  throw new Test262Error('#1.1: "finally" block must be evaluated');
     32 }
     33 if(c1!==2){
     34  throw new Test262Error('#1.2: "try{break} catch finally{continue}" must work correctly');
     35 }
     36 
     37 // CHECK#2
     38 var c2=0,fin2=0;
     39 do{
     40  try{
     41    throw "ex1";
     42  }
     43  catch(er1){
     44    c2+=1;
     45    break;
     46  }
     47  finally{
     48    fin2=1;
     49    continue;
     50  }
     51  c2+=2;
     52  fin2=-1;
     53 }
     54 while(c2<2);
     55 if(fin2!==1){
     56  throw new Test262Error('#2.1: "finally" block must be evaluated');
     57 }
     58 if(c2!==2){
     59  throw new Test262Error('#2.2: "try catch{break} finally{continue}" must work correctly');
     60 }
     61 
     62 reportCompare(0, 0);