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 * If Result.type is break and Result.target is in the current
6 * label set, return (normal, Result.value, empty)
7 *
8 * @path ch12/12.11/S12.11_A1_T4.js
9 * @description Using case with isNaN and isNaN(value)
10 */
12 function SwitchTest(value){
13 var result = 0;
15 switch(value) {
16 case 0:
17 result += 2;
18 case 1:
19 result += 4;
20 break;
21 case 2:
22 result += 8;
23 case isNaN(value):
24 result += 16;
25 default:
26 result += 32;
27 break;
28 case null:
29 result += 64;
30 case isNaN:
31 result += 128;
32 break;
33 case Infinity:
34 result += 256;
35 case 2+3:
36 result += 512;
37 break;
38 case undefined:
39 result += 1024;
40 }
42 return result;
43 }
45 if(!(SwitchTest(eval('Number(false)')) === 6)){
46 $ERROR("#1: SwitchTest(0) === 6. Actual: SwitchTest(0) ==="+ SwitchTest(0) );
47 }
49 if(!(SwitchTest(parseInt) === 32)){
50 $ERROR("#2: SwitchTest(parseInt) === 32. Actual: SwitchTest(parseInt) ==="+ SwitchTest(parseInt) );
51 }
53 if(!(SwitchTest(isNaN) === 128)){
54 $ERROR("#3: SwitchTest(isNaN) === 128. Actual: SwitchTest(isNaN) ==="+ SwitchTest(isNaN) );
55 }
57 if(!(SwitchTest(true) === 32)){
58 $ERROR("#6: SwitchTest(true) === 32. Actual: SwitchTest(true) ==="+ SwitchTest(true) );
59 }
61 if(!(SwitchTest(false) === 48)){
62 $ERROR("#7: SwitchTest(false) === 48. Actual: SwitchTest(false) ==="+ SwitchTest(false) );
63 }
65 if(!(SwitchTest(null) === 192)){
66 $ERROR("#8: SwitchTest(null) === 192. Actual: SwitchTest(null) ==="+ SwitchTest(null) );
67 }
69 if(!(SwitchTest(void 0) === 1024)){
70 $ERROR("#9: SwitchTest(void 0) === 1024. Actual: SwitchTest(void 0) ==="+ SwitchTest(void 0) );
71 }
73 if(!(SwitchTest(NaN) === 32)){
74 $ERROR("#10: SwitchTest(NaN) === 32. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
75 }
77 if(!(SwitchTest(Infinity) === 768)){
78 $ERROR("#10: SwitchTest(NaN) === 768. Actual: SwitchTest(NaN) ==="+ SwitchTest(NaN) );
79 }