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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 //-----------------------------------------------------------------------------
7 var BUGNUMBER = "(none)";
8 var summary = "Iterator() test";
9 var actual, expect;
11 printBugNumber(BUGNUMBER);
12 printStatus(summary);
14 /**************
15 * BEGIN TEST *
16 **************/
18 var failed = false;
20 function Array_equals(a, b)
21 {
22 if (!(a instanceof Array) || !(b instanceof Array))
23 throw new Error("Arguments not both of type Array");
24 if (a.length != b.length)
25 return false;
26 for (var i = 0, sz = a.length; i < sz; i++)
27 if (a[i] !== b[i])
28 return false;
29 return true;
30 }
32 var meow = "meow", oink = "oink", baa = "baa";
34 var it = Iterator([meow, oink, baa]);
35 var it2 = Iterator([meow, oink, baa], true);
37 try
38 {
39 if (!Array_equals(it.next(), [0, meow]))
40 throw [0, meow];
41 if (!Array_equals(it.next(), [1, oink]))
42 throw [1, oink];
43 if (!Array_equals(it.next(), [2, baa]))
44 throw [2, baa];
46 var stopPassed = false;
47 try
48 {
49 it.next();
50 }
51 catch (e)
52 {
53 if (e === StopIteration)
54 stopPassed = true;
55 }
57 if (!stopPassed)
58 throw "it: missing or incorrect StopIteration";
60 if (it2.next() != 0)
61 throw "wanted key=0";
62 if (it2.next() != 1)
63 throw "wanted key=1";
64 if (it2.next() != 2)
65 throw "wanted key=2";
67 var stopPassed = false;
68 try
69 {
70 it2.next();
71 }
72 catch (e)
73 {
74 if (e === StopIteration)
75 stopPassed = true;
76 }
78 if (!stopPassed)
79 throw "it2: missing or incorrect StopIteration";
80 }
81 catch (e)
82 {
83 failed = e;
84 }
86 expect = false;
87 actual = failed;
89 reportCompare(expect, actual, summary);