tor-browser

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

S12.14_A19_T2.js (2453B)


      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: Catching system exceptions of different types with try statement
      6 es5id: 12.14_A19_T2
      7 description: Testing try/catch/finally syntax construction
      8 ---*/
      9 
     10 var fin=0;
     11 // CHECK#1
     12 try{
     13  throw (Error("hello"));
     14 }
     15 catch(e){
     16  if (e.toString()!=="Error: hello") throw new Test262Error('#1.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
     17 }
     18 finally{
     19  fin=1;
     20 }
     21 if (fin!==1) throw new Test262Error('#1.2: "finally" block must be evaluated'); 
     22 
     23 // CHECK#2
     24 fin=0;
     25 try{
     26  throw (new Error("hello"));
     27 }
     28 catch(e){
     29  if (e.toString()!=="Error: hello") throw new Test262Error('#2.1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
     30 }
     31 finally{
     32  fin=1;
     33 }
     34 if (fin!==1) throw new Test262Error('#2.2: "finally" block must be evaluated'); 
     35 
     36 // CHECK#3
     37 fin=0;
     38 var c3=0;
     39 try{
     40  throw EvalError(1);
     41 }
     42 catch(e){
     43  if (e.toString()!=="EvalError: 1") throw new Test262Error('#3.1: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
     44 }
     45 finally{
     46  fin=1;
     47 }
     48 if (fin!==1) throw new Test262Error('#3.2: "finally" block must be evaluated'); 
     49 
     50 // CHECK#4
     51 fin=0;
     52 try{
     53  throw RangeError(1);
     54 }
     55 catch(e){
     56  if (e.toString()!=="RangeError: 1") throw new Test262Error('#4.1: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
     57 }
     58 finally{
     59  fin=1;
     60 }
     61 if (fin!==1) throw new Test262Error('#4.2: "finally" block must be evaluated'); 
     62 
     63 // CHECK#5
     64 fin=0;
     65 try{
     66  throw ReferenceError(1);
     67 }
     68 catch(e){
     69  if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5.1: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
     70 }
     71 finally{
     72  fin=1;
     73 }
     74 if (fin!==1) throw new Test262Error('#5.2: "finally" block must be evaluated'); 
     75 
     76 // CHECK#6
     77 fin=0;
     78 try{
     79  throw TypeError(1);
     80 }
     81 catch(e){
     82  if (e.toString()!=="TypeError: 1") throw new Test262Error('#6.1: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
     83 }
     84 finally{
     85  fin=1;
     86 }
     87 if (fin!==1) throw new Test262Error('#6.2: "finally" block must be evaluated'); 
     88 
     89 // CHECK#7
     90 fin=0;
     91 try{
     92  throw URIError("message", "fileName", "1"); 
     93 }
     94 catch(e){
     95  if (e.toString()!=="URIError: message") throw new Test262Error('#7.1: Exception.toString()==="URIError: message". Actual: Exception is '+e);
     96 }
     97 finally{
     98  fin=1;
     99 }
    100 if (fin!==1) throw new Test262Error('#7.2: "finally" block must be evaluated');
    101 
    102 reportCompare(0, 0);