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.
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 * Using "try" with "catch" or "finally" statement in a constructor
6 *
7 * @path ch12/12.14/S12.14_A17.js
8 * @description Creating exceptions within constructor
9 */
11 var i=1;
12 function Integer( value, exception ) {
13 try{
14 this.value = checkValue( value );
15 if(exception) $ERROR('#'+i+'.1: Must be exception');
16 }
17 catch(e){
18 this.value = e.toString();
19 if(!exception) $ERROR('#'+i+'.2: Don`t must be exception');
20 }
21 i++;
22 }
24 function checkValue(value){
25 if(Math.floor(value)!=value||isNaN(value)){
26 throw (INVALID_INTEGER_VALUE +": " + value);
27 }
28 else{
29 return value;
30 }
31 }
33 // CHECK#1
34 new Integer(13, false);
35 // CHECK#2
36 new Integer(NaN, true);
37 // CHECK#3
38 new Integer(0, false);
39 // CHECK#4
40 new Integer(Infinity, false);
41 // CHECK#5
42 new Integer(-1.23, true);
43 // CHECK#6
44 new Integer(Math.LN2, true);