tor-browser

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

S12.14_A7_T3.js (4489B)


      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: Evaluating the nested productions TryStatement
      6 es5id: 12.14_A7_T3
      7 description: >
      8    Checking if the production of nested TryStatement statements
      9    evaluates correct
     10 ---*/
     11 
     12 // CHECK#1
     13 try{
     14  try{
     15    throw "ex2";
     16  }
     17  catch(er2){
     18    if (er2!=="ex2") throw new Test262Error('#1.1: Exception === "ex2". Actual:  Exception ==='+er2);
     19    throw "ex1";
     20  }
     21  finally{
     22    throw "ex3";
     23  }
     24 }
     25 catch(er1){
     26  if (er1!=="ex3") throw new Test262Error('#1.2: Exception === "ex3". Actual:  Exception ==='+er1);
     27  if (er1==="ex2") throw new Test262Error('#1.3: Exception !=="ex2". Actual: catch previous catched exception');
     28  if (er1==="ex1") throw new Test262Error('#1.4: Exception !=="ex1". Actual: catch previous embedded exception');
     29 }
     30 
     31 // CHECK#2
     32 var c2=0;
     33 try{
     34  throw "ex1";
     35 }
     36 catch(er1){
     37  try{
     38    throw "ex2";
     39  }
     40  catch(er1){
     41    if (er1==="ex1") throw new Test262Error('#2.1: Exception !=="ex1". Actual: catch previous catched exception');
     42    if (er1!=="ex2") throw new Test262Error('#2.2: Exception === "ex2". Actual:  Exception ==='+er1);
     43  }
     44  finally{
     45    c2=1;
     46  }
     47  if (er1!=="ex1") throw new Test262Error('#2.3: Exception === "ex1". Actual:  Exception ==='+er1);
     48  if (er1==="ex2") throw new Test262Error('#2.4: Exception !== "ex2". Actual: catch previous embedded exception');
     49 }
     50 if (c2!==1)	throw new Test262Error('#2.5: "finally" block must be evaluated');
     51 
     52 // CHECK#3
     53 var c3=0;
     54 try{
     55  throw "ex1";
     56 }
     57 catch(er1){
     58  if (er1!=="ex1") throw new Test262Error('#3.1: Exception === "ex1". Actual:  Exception ==='+er1);
     59 }
     60 finally{
     61  try{
     62    throw "ex2";
     63  }
     64  catch(er1){
     65    if (er1==="ex1") throw new Test262Error('#3.2: Exception !=="ex1". Actual: catch previous catched exception');
     66    if (er1!=="ex2") throw new Test262Error('#3.3: Exception === "ex2". Actual:  Exception ==='+er1);
     67  }
     68  finally{
     69    c3=1;
     70  }
     71 }
     72 if (c3!==1)	throw new Test262Error('#3.4: "finally" block must be evaluated');
     73 
     74 // CHECK#4
     75 var c4=0;
     76 try{
     77  try{
     78    throw "ex1";
     79  }
     80  catch(er1){
     81    try{
     82      throw "ex2";
     83    }
     84    catch(er1){
     85      if (er1==="ex1") throw new Test262Error('#4.1: Exception !=="ex2". Actual: catch previous catched exception');
     86      if (er1!=="ex2") throw new Test262Error('#4.2: Exception === "ex2". Actual:  Exception ==='+er1);
     87    }
     88    finally{
     89      c4=2;
     90      throw "ex3";
     91    }
     92    if (er1!=="ex1") throw new Test262Error('#4.3: Exception === "ex2". Actual:  Exception ==='+er1);
     93    if (er1==="ex2") throw new Test262Error('#4.4: Exception !=="ex2". Actual: catch previous catched exception');
     94    if (er1==="ex3") throw new Test262Error('#4.5: Exception !=="ex3". Actual: Catch previous embedded exception');
     95  }
     96  finally{
     97    c4*=2;
     98  }
     99 }
    100 catch(er1){}
    101 if (c4!==4) throw new Test262Error('#4.6: "finally" block must be evaluated');
    102 
    103 // CHECK#5
    104 var c5=0;
    105 try{
    106  try{
    107    throw "ex2";
    108  }
    109  catch(er1){
    110    if (er1!=="ex2") throw new Test262Error('#5.1: Exception === "ex2". Actual:  Exception ==='+er1);
    111  }
    112  finally{
    113    throw "ex3";
    114  }
    115  throw "ex1";
    116 }
    117 catch(er1){
    118  if (er1!=="ex3") throw new Test262Error('#5.2: Exception === "ex3". Actual:  Exception ==='+er1);
    119  if (er1==="ex2") throw new Test262Error('#5.3: Exception !=="ex2". Actual: catch previous catched exception');
    120  if (er1==="ex1") throw new Test262Error('#5.4: Exception !=="ex1". Actual: catch previous embedded exception');
    121 }
    122 finally{
    123  c5=1;
    124 }
    125 if (c5!==1) throw new Test262Error('#5.5: "finally" block must be evaluated');
    126 
    127 // CHECK#6
    128 var c6=0;
    129 try{
    130  try{
    131    throw "ex1";
    132  }
    133  catch(er1){
    134    if (er1!=="ex1") throw new Test262Error('#6.1: Exception === "ex1". Actual:  Exception ==='+er1);
    135  }
    136  finally{
    137    c6=2;
    138  }
    139 }
    140 finally{
    141  c6*=2;
    142 }
    143 if (c6!==4) throw new Test262Error('#6.2: "finally" block must be evaluated');
    144 
    145 // CHECK#7
    146 var c7=0;
    147 try{
    148  try{
    149    throw "ex1";
    150  }
    151  finally{
    152    try{
    153      c7=1;
    154      throw "ex2";
    155    }
    156    catch(er1){
    157      if (er1!=="ex2") throw new Test262Error('#7.1: Exception === "ex2". Actual:  Exception ==='+er1);
    158      if (er1==="ex1") throw new Test262Error('#7.2: Exception !=="ex2". Actual: catch previous catched exception');
    159      c7++;
    160    }
    161    finally{
    162      c7*=2;
    163    }
    164  }
    165 }
    166 catch(er1){
    167  if (er1!=="ex1") throw new Test262Error('#7.3: Exception === "ex1". Actual:  Exception ==='+er1);
    168 }
    169 if (c7!==4) throw new Test262Error('#7.4: "finally" block must be evaluated');
    170 
    171 reportCompare(0, 0);