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 -*- */
3 /*
4 * Any copyright is dedicated to the Public Domain.
5 * http://creativecommons.org/licenses/publicdomain/
6 */
8 var obj = {}
10 function strict() { "use strict"; return this; }
11 assertEq(strict.call(""), "");
12 assertEq(strict.call(true), true);
13 assertEq(strict.call(42), 42);
14 assertEq(strict.call(null), null);
15 assertEq(strict.call(undefined), undefined);
16 assertEq(strict.call(obj), obj);
17 assertEq(new strict() instanceof Object, true);
19 /*
20 * The compiler internally converts x['foo'] to x.foo. Writing x[s] where
21 * s='foo' is enough to throw it off the scent for now.
22 */
23 var strictString = 'strict';
25 Boolean.prototype.strict = strict;
26 assertEq(true.strict(), true);
27 assertEq(true[strictString](), true);
29 Number.prototype.strict = strict;
30 assertEq((42).strict(), 42);
31 assertEq(42[strictString](), 42);
33 String.prototype.strict = strict;
34 assertEq("".strict(), "");
35 assertEq(""[strictString](), "");
37 function lenient() { return this; }
38 assertEq(lenient.call("") instanceof String, true);
39 assertEq(lenient.call(true) instanceof Boolean, true);
40 assertEq(lenient.call(42) instanceof Number, true);
41 assertEq(lenient.call(null), this);
42 assertEq(lenient.call(undefined), this);
43 assertEq(lenient.call(obj), obj);
44 assertEq(new lenient() instanceof Object, true);
46 var lenientString = 'lenient';
48 Boolean.prototype.lenient = lenient;
49 assertEq(true.lenient() instanceof Boolean, true);
50 assertEq(true[lenientString]() instanceof Boolean, true);
52 Number.prototype.lenient = lenient;
53 assertEq(42[lenientString]() instanceof Number, true);
55 String.prototype.lenient = lenient;
56 assertEq(""[lenientString]() instanceof String, true);
58 reportCompare(true, true);