Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
1 // IM has the following fastpaths:
2 // - constant index (constant)
3 // - need negative int check (neg)
4 // - needs hole check (hole)
5 // So to test everything we have to do:
6 // constant | neg | hole
7 // test 1: 0 0 0
8 // test 2: 1 0 0
9 // test 3: 0 1 0
10 // test 4: 1 1 0
11 // test 5: 0 0 1
12 // test 6: 1 0 1
13 // test 7: 0 1 1
14 // test 8: 1 1 1
16 function test1(index, a) {
17 if (index < 0)
18 index = -index
19 return index in a;
20 }
21 assertEq(test1(1, [1,2]), true);
23 function test2(a) {
24 return 0 in a;
25 }
26 assertEq(test2([1,2]), true);
28 function test3(index, a) {
29 return index in a;
30 }
32 var arr3 = [];
33 arr3["-1073741828"] = 17;
34 assertEq(test3(-1073741828, arr3), true);
36 function test4(a) {
37 return -1073741828 in a;
38 }
39 assertEq(test4(arr3), true);
42 function test5(index, a) {
43 if (index < 0)
44 index = -index
45 return index in a;
46 }
47 var arr5 = [];
48 arr5[0] = 1
49 arr5[1] = 1
50 arr5[2] = 1
51 arr5[4] = 1
52 assertEq(test5(1, arr5), true);
53 assertEq(test5(3, arr5), false);
55 function test7a(a) {
56 return 3 in a;
57 }
58 function test7b(a) {
59 return 4 in a;
60 }
61 assertEq(test7a(arr5), false);
62 assertEq(test7b(arr5), true);
64 function test8(index, a) {
65 return index in a;
66 }
67 arr5["-1073741828"] = 17;
68 assertEq(test8(-1073741828, arr5), true);
69 assertEq(test8(3, arr5), false);
70 assertEq(test8(0, arr5), true);
72 function test9a(a) {
73 return 0 in a;
74 }
75 function test9b(a) {
76 return 3 in a;
77 }
78 function test9c(a) {
79 return -1073741828 in a;
80 }
81 assertEq(test9a(arr5), true);
82 assertEq(test9b(arr5), false);
83 assertEq(test9c(arr5), true);