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 // vim: set ts=8 sts=4 et sw=4 tw=99:
3 function testUKeyUObject(a, key1, key2, key3) {
4 a.a = function () { return this.d; }
5 a.b = function () { return this.e; }
6 a.c = function() { return this.f; }
7 a.d = 20;
8 a.e = "hi";
9 a.f = 500;
10 assertEq(a[key1](), 20);
11 assertEq(a[key2](), "hi");
12 assertEq(a[key3](), 500);
13 }
15 function testVKeyUObject(a, key1, key2, key3) {
16 a.a = function () { return this.d; }
17 a.b = function () { return this.e; }
18 a.c = function() { return this.f; }
19 a.d = 20;
20 a.e = "hi";
21 a.f = 500;
22 assertEq(a["" + key1](), 20);
23 assertEq(a["" + key2](), "hi");
24 assertEq(a["" + key3](), 500);
25 }
27 function testKKeyUObject(a) {
28 a.a = function () { return this.d; }
29 a.b = function () { return this.e; }
30 a.c = function() { return this.f; }
31 a.d = 20;
32 a.e = "hi";
33 a.f = 500;
34 var key1 = "a";
35 var key2 = "b";
36 var key3 = "c";
37 assertEq(a[key1](), 20);
38 assertEq(a[key2](), "hi");
39 assertEq(a[key3](), 500);
40 }
42 function testUKeyVObject(key1, key2, key3) {
43 a = { a: function () { return this.d; },
44 b: function () { return this.e; },
45 c: function () { return this.f; },
46 d: 20,
47 e: "hi",
48 f: 500
49 };
50 assertEq(a[key1](), 20);
51 assertEq(a[key2](), "hi");
52 assertEq(a[key3](), 500);
53 }
55 function testVKeyVObject(key1, key2, key3) {
56 a = { a: function () { return this.d; },
57 b: function () { return this.e; },
58 c: function () { return this.f; },
59 d: 20,
60 e: "hi",
61 f: 500
62 };
63 assertEq(a["" + key1](), 20);
64 assertEq(a["" + key2](), "hi");
65 assertEq(a["" + key3](), 500);
66 }
68 function testKKeyVObject(a) {
69 a = { a: function () { return this.d; },
70 b: function () { return this.e; },
71 c: function () { return this.f; },
72 d: 20,
73 e: "hi",
74 f: 500
75 };
76 var key1 = "a";
77 var key2 = "b";
78 var key3 = "c";
79 assertEq(a[key1](), 20);
80 assertEq(a[key2](), "hi");
81 assertEq(a[key3](), 500);
82 }
84 for (var i = 0; i < 5; i++) {
85 testUKeyUObject({}, "a", "b", "c");
86 testVKeyUObject({}, "a", "b", "c");
87 testKKeyUObject({});
88 testUKeyVObject("a", "b", "c");
89 testVKeyVObject("a", "b", "c");
90 testKKeyVObject();
91 }