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 // |reftest| skip
2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 417131;
9 var summary = 'stress test for cache';
10 var actual = '';
11 var expect = '';
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
24 function f(N)
25 {
26 for (var i = 0; i != N; ++i) {
27 var obj0 = {}, obj1 = {}, obj2 = {};
28 obj1['a'+i] = 0;
29 obj2['b'+i] = 0;
30 obj2['b'+(i+1)] = 1;
31 for (var repeat = 0;repeat != 2; ++repeat) {
32 var count = 0;
33 for (var j in obj1) {
34 if (j !== 'a'+i)
35 throw "Bad:"+j;
36 for (var k in obj2) {
37 if (i == Math.floor(N/3) || i == Math.floor(2*N/3))
38 gc();
39 var expected;
40 switch (count) {
41 case 0: expected='b'+i; break;
42 case 1: expected='b'+(i+1); break;
43 default:
44 throw "Bad count: "+count;
45 }
46 if (expected != k)
47 throw "Bad k, expected="+expected+", actual="+k;
48 for (var l in obj0)
49 ++count;
50 ++count;
51 }
52 }
53 if (count !== 2)
54 throw "Bad count: "+count;
55 }
56 }
57 }
59 var array = [function() { f(10); },
60 function() { f(50); },
61 function() { f(200); },
62 function() { f(400); }
63 ];
65 if (typeof scatter == "function") {
66 scatter(array);
67 } else {
68 for (var i = 0; i != array.length; ++i)
69 array[i]();
70 }
73 reportCompare(expect, actual, summary);
75 exitFunc ('test');
76 }