Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright 2009 the Sputnik authors. All rights reserved. |
michael@0 | 2 | // This code is governed by the BSD license found in the LICENSE file. |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Evaluating the nested productions TryStatement |
michael@0 | 6 | * |
michael@0 | 7 | * @path ch12/12.14/S12.14_A7_T1.js |
michael@0 | 8 | * @description Checking if the production of nested TryStatement statements evaluates correct |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | // CHECK#1 |
michael@0 | 12 | try{ |
michael@0 | 13 | try{ |
michael@0 | 14 | throw "ex2"; |
michael@0 | 15 | } |
michael@0 | 16 | catch(er2){ |
michael@0 | 17 | if (er2!=="ex2") |
michael@0 | 18 | $ERROR('#1.1: Exception === "ex2". Actual: Exception ==='+ e ); |
michael@0 | 19 | throw "ex1"; |
michael@0 | 20 | } |
michael@0 | 21 | } |
michael@0 | 22 | catch(er1){ |
michael@0 | 23 | if (er1!=="ex1") $ERROR('#1.2: Exception === "ex1". Actual: '+er1); |
michael@0 | 24 | if (er1==="ex2") $ERROR('#1.3: Exception !== "ex2". Actual: catch previous embedded exception'); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | // CHECK#2 |
michael@0 | 28 | try{ |
michael@0 | 29 | throw "ex1"; |
michael@0 | 30 | } |
michael@0 | 31 | catch(er1){ |
michael@0 | 32 | try{ |
michael@0 | 33 | throw "ex2"; |
michael@0 | 34 | } |
michael@0 | 35 | catch(er1){ |
michael@0 | 36 | if (er1==="ex1") $ERROR('#2.1: Exception !== "ex1". Actual: catch previous catching exception'); |
michael@0 | 37 | if (er1!=="ex2") $ERROR('#2.2: Exception === "ex2". Actual: Exception ==='+ er1 ); |
michael@0 | 38 | } |
michael@0 | 39 | if (er1!=="ex1") $ERROR('#2.3: Exception === "ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 40 | if (er1==="ex2") $ERROR('#2.4: Exception !== "ex2". Actual: catch previous catching exception'); |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | // CHECK#3 |
michael@0 | 44 | try{ |
michael@0 | 45 | throw "ex1"; |
michael@0 | 46 | } |
michael@0 | 47 | catch(er1){ |
michael@0 | 48 | if (er1!=="ex1") $ERROR('#3.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 49 | } |
michael@0 | 50 | finally{ |
michael@0 | 51 | try{ |
michael@0 | 52 | throw "ex2"; |
michael@0 | 53 | } |
michael@0 | 54 | catch(er1){ |
michael@0 | 55 | if (er1==="ex1") $ERROR('#3.2: Exception !=="ex1". Actual: catch previous embedded exception'); |
michael@0 | 56 | if (er1!=="ex2") $ERROR('#3.3: Exception ==="ex2". Actual: Exception ==='+ er1 ); |
michael@0 | 57 | } |
michael@0 | 58 | } |
michael@0 | 59 | |
michael@0 | 60 | // CHECK#4 |
michael@0 | 61 | var c4=0; |
michael@0 | 62 | try{ |
michael@0 | 63 | throw "ex1"; |
michael@0 | 64 | } |
michael@0 | 65 | catch(er1){ |
michael@0 | 66 | try{ |
michael@0 | 67 | throw "ex2"; |
michael@0 | 68 | } |
michael@0 | 69 | catch(er1){ |
michael@0 | 70 | if (er1==="ex1") $ERROR('#4.1: Exception !=="ex1". Actual: catch previous catching exception'); |
michael@0 | 71 | if (er1!=="ex2") $ERROR('#4.2: Exception ==="ex2". Actual: Exception ==='+ er1 ); |
michael@0 | 72 | } |
michael@0 | 73 | if (er1!=="ex1") $ERROR('#4.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 74 | if (er1==="ex2") $ERROR('#4.4: Exception !=="ex2". Actual: Catch previous embedded exception'); |
michael@0 | 75 | } |
michael@0 | 76 | finally{ |
michael@0 | 77 | c4=1; |
michael@0 | 78 | } |
michael@0 | 79 | if (c4!==1) $ERROR('#4.5: "finally" block must be evaluated'); |
michael@0 | 80 | |
michael@0 | 81 | // CHECK#5 |
michael@0 | 82 | var c5=0; |
michael@0 | 83 | try{ |
michael@0 | 84 | try{ |
michael@0 | 85 | throw "ex2"; |
michael@0 | 86 | } |
michael@0 | 87 | catch(er1){ |
michael@0 | 88 | if (er1!=="ex2") $ERROR('#5.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); |
michael@0 | 89 | } |
michael@0 | 90 | throw "ex1"; |
michael@0 | 91 | } |
michael@0 | 92 | catch(er1){ |
michael@0 | 93 | if (er1!=="ex1") $ERROR('#5.2: Exception ==="ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 94 | if (er1==="ex2") $ERROR('#5.3: Exception !=="ex2". Actual: catch previous embedded exception'); |
michael@0 | 95 | } |
michael@0 | 96 | finally{ |
michael@0 | 97 | c5=1; |
michael@0 | 98 | } |
michael@0 | 99 | if (c5!==1) $ERROR('#5.4: "finally" block must be evaluated'); |
michael@0 | 100 | |
michael@0 | 101 | // CHECK#6 |
michael@0 | 102 | var c6=0; |
michael@0 | 103 | try{ |
michael@0 | 104 | try{ |
michael@0 | 105 | throw "ex1"; |
michael@0 | 106 | } |
michael@0 | 107 | catch(er1){ |
michael@0 | 108 | if (er1!=="ex1") $ERROR('#6.1: Exception ==="ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 109 | } |
michael@0 | 110 | } |
michael@0 | 111 | finally{ |
michael@0 | 112 | c6=1; |
michael@0 | 113 | } |
michael@0 | 114 | if (c6!==1) $ERROR('#6.2: "finally" block must be evaluated'); |
michael@0 | 115 | |
michael@0 | 116 | // CHECK#7 |
michael@0 | 117 | var c7=0; |
michael@0 | 118 | try{ |
michael@0 | 119 | try{ |
michael@0 | 120 | throw "ex1"; |
michael@0 | 121 | } |
michael@0 | 122 | finally{ |
michael@0 | 123 | try{ |
michael@0 | 124 | c7=1; |
michael@0 | 125 | throw "ex2"; |
michael@0 | 126 | } |
michael@0 | 127 | catch(er1){ |
michael@0 | 128 | if (er1!=="ex2") $ERROR('#7.1: Exception ==="ex2". Actual: Exception ==='+ er1 ); |
michael@0 | 129 | if (er1==="ex1") $ERROR('#7.2: Exception !=="ex1". Actual: catch previous embedded exception'); |
michael@0 | 130 | c7++; |
michael@0 | 131 | } |
michael@0 | 132 | } |
michael@0 | 133 | } |
michael@0 | 134 | catch(er1){ |
michael@0 | 135 | if (er1!=="ex1") $ERROR('#7.3: Exception ==="ex1". Actual: Exception ==='+ er1 ); |
michael@0 | 136 | } |
michael@0 | 137 | if (c7!==2) $ERROR('#7.4: "finally" block must be evaluated'); |
michael@0 | 138 |