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 | * The production TryStatement: "try Block Catch Finally" |
michael@0 | 6 | * |
michael@0 | 7 | * @path ch12/12.14/S12.14_A6.js |
michael@0 | 8 | * @description Executing sequence of "try" statements, using counters with varying values within |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | // CHECK#1 |
michael@0 | 12 | var c1=0; |
michael@0 | 13 | try { |
michael@0 | 14 | c1+=1; |
michael@0 | 15 | y; |
michael@0 | 16 | $ERROR('#1.1: "y" lead to throwing exception'); |
michael@0 | 17 | } |
michael@0 | 18 | catch (e) { |
michael@0 | 19 | c1*=2; |
michael@0 | 20 | } |
michael@0 | 21 | if (c1!==2){ |
michael@0 | 22 | $ERROR('#1.2: Sequence evaluation of commands try/catch is 1. try, 2. catch'); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | // CHECK#2 |
michael@0 | 26 | var c2=0; |
michael@0 | 27 | try{ |
michael@0 | 28 | c2+=1; |
michael@0 | 29 | } |
michael@0 | 30 | finally{ |
michael@0 | 31 | c2*=2; |
michael@0 | 32 | } |
michael@0 | 33 | if (c2!==2){ |
michael@0 | 34 | $ERROR('#2: Sequence evaluation of commands try/finally is 1. try, 2. finally'); |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | // CHECK#3 |
michael@0 | 38 | var c3=0; |
michael@0 | 39 | try{ |
michael@0 | 40 | c3=1; |
michael@0 | 41 | z; |
michael@0 | 42 | } |
michael@0 | 43 | catch(err){ |
michael@0 | 44 | c3*=2; |
michael@0 | 45 | } |
michael@0 | 46 | finally{ |
michael@0 | 47 | c3+=1; |
michael@0 | 48 | } |
michael@0 | 49 | if (c3!==3){ |
michael@0 | 50 | $ERROR('#3: Sequence evaluation of commands try/catch/finally(with exception) is 1. try, 2. catch, 3. finally'); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | // CHECK#4 |
michael@0 | 54 | var c4=0; |
michael@0 | 55 | try{ |
michael@0 | 56 | c4=1; |
michael@0 | 57 | } |
michael@0 | 58 | catch(err){ |
michael@0 | 59 | c4*=3; |
michael@0 | 60 | } |
michael@0 | 61 | finally{ |
michael@0 | 62 | c4+=1; |
michael@0 | 63 | } |
michael@0 | 64 | if (c4!==2){ |
michael@0 | 65 | $ERROR('#4: Sequence evaluation of commands try/catch/finally(without exception) is 1. try, 2. finally'); |
michael@0 | 66 | } |
michael@0 | 67 |