tor-browser

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

S12.14_A19_T1.js (1682B)


      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_T1
      7 description: Testing try/catch syntax construction
      8 ---*/
      9 
     10 // CHECK#1
     11 try{
     12  throw (Error("hello"));
     13 }
     14 catch(e){
     15  if (e.toString()!=="Error: hello") throw new Test262Error('#1: Exception.toString()==="Error: hello". Actual: Exception is '+e);
     16 }
     17 
     18 // CHECK#2
     19 try{
     20  throw (new Error("hello"));
     21 }
     22 catch(e){
     23  if (e.toString()!=="Error: hello") throw new Test262Error('#2: Exception.toString()==="Error: hello". Actual: Exception is '+e);
     24 }
     25 
     26 // CHECK#3
     27 var c3=0;
     28 try{
     29  throw EvalError(1);
     30 }
     31 catch(e){
     32  if (e.toString()!=="EvalError: 1") throw new Test262Error('#3: Exception.toString()==="EvalError: 1". Actual: Exception is '+e);
     33 }
     34 
     35 // CHECK#4
     36 try{
     37  throw RangeError(1);
     38 }
     39 catch(e){
     40  if (e.toString()!=="RangeError: 1") throw new Test262Error('#4: Exception.toString()==="RangeError: 1". Actual: Exception is '+e);
     41 }
     42 
     43 // CHECK#5
     44 try{
     45  throw ReferenceError(1);
     46 }
     47 catch(e){
     48  if (e.toString()!=="ReferenceError: 1") throw new Test262Error('#5: Exception.toString()==="ReferenceError: 1". Actual: Exception is '+e);
     49 }
     50 
     51 // CHECK#6
     52 var c6=0;
     53 try{
     54  throw TypeError(1);
     55 }
     56 catch(e){
     57  if (e.toString()!=="TypeError: 1") throw new Test262Error('#6: Exception.toString()==="TypeError: 1". Actual: Exception is '+e);
     58 }
     59 
     60 // CHECK#7
     61 try{
     62  throw URIError("message", "fileName", "1"); 
     63 }
     64 catch(e){
     65  if (e.toString()!=="URIError: message") throw new Test262Error('#7: Exception.toString()==="URIError: message". Actual: Exception is '+e);
     66 }
     67 
     68 reportCompare(0, 0);