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 = "346582";
8 var summary = "Basic support for iterable objects and for-in";
9 var actual, expect;
11 printBugNumber(BUGNUMBER);
12 printStatus(summary);
14 /**************
15 * BEGIN TEST *
16 **************/
18 var failed = false;
20 var iterable = { persistedProp: 17 };
22 try
23 {
24 // nothing unusual so far -- verify basic properties
25 for (var i in iterable)
26 {
27 if (i != "persistedProp")
28 throw "no persistedProp!";
29 if (iterable[i] != 17)
30 throw "iterable[\"persistedProp\"] == 17";
31 }
33 var keys = ["foo", "bar", "baz"];
34 var vals = [6, 5, 14];
36 iterable.__iterator__ =
37 function(keysOnly)
38 {
39 var gen =
40 function()
41 {
42 for (var i = 0; i < keys.length; i++)
43 {
44 if (keysOnly)
45 yield keys[i];
46 else
47 yield [keys[i], vals[i]];
48 }
49 };
50 return gen();
51 };
53 // for in sets keysOnly==true
54 var index = 0;
55 for (var k in iterable)
56 {
57 if (k != keys[index])
58 throw "for-in iteration failed on keys[\"" + index + "\"]";
59 index++;
60 }
61 if (index != keys.length)
62 throw "not everything iterated! index=" + index +
63 ", keys.length=" + keys.length;
65 if (iterable.persistedProp != 17)
66 throw "iterable.persistedProp not persisted!";
67 }
68 catch (e)
69 {
70 failed = e;
71 }
75 expect = false;
76 actual = failed;
78 reportCompare(expect, actual, summary);