js/src/tests/test262/ch12/12.14/S12.14_A8.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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  * "try" with "catch" or "finally" statement within/without an "if" statement
     6  *
     7  * @path ch12/12.14/S12.14_A8.js
     8  * @description Throwing exception within an "if" statement
     9  */
    11 // CHECK#1
    12 var c1=1;
    13 try{
    14   if(c1===1){
    15     throw "ex1";
    16     $ERROR('#1.1: throw "ex1" lead to throwing exception');
    17   }
    18   $ERROR('#1.2: throw "ex1" inside the "if" statement lead to throwing exception');
    19 }
    20 catch(er1){	
    21   if (er1!=="ex1") $ERROR('#1.3: Exception ==="ex1". Actual:  Exception ==='+er1);
    22 }
    24 // CHECK#2
    25 var c2=1;
    26 if(c2===1){
    27   try{
    28     throw "ex1";
    29     $ERROR('#2.1: throw "ex1" lead to throwing exception');
    30   }
    31   catch(er1){
    32     if(er1!="ex1") $ERROR('#2.2: Exception ==="ex1". Actual:  Exception ==='+er1);
    33   }
    34 }

mercurial