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 // optimized
2 (function(b) {
3 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
4 })({a:'A', b:'B' });
5 (function() {
6 var b = {a:'A', b:'B' };
7 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
8 })();
9 (function() {
10 let (b = {a:'A', b:'B' }) {
11 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
12 }
13 })();
14 (function() {
15 var b = {a:'A', b:'B' };
16 (function () {
17 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
18 })();
19 })();
20 (function() {
21 let (b = {a:'A', b:'B' }) {
22 (function () {
23 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
24 })();
25 }
26 })();
27 (function() {
28 var b = {a:'A', b:'B' };
29 (function () {
30 (function () {
31 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
32 })();
33 })();
34 })();
36 // not optimized:
37 (function() {
38 var b = {a:'A', b:'B' };
39 with ({}) {
40 (function () {
41 assertEq("abc".replace(/a|b/g, function(a) { return b[a] }), 'ABc');
42 })();
43 }
44 })();
45 (function() {
46 var b = {a:'A', b:'B' };
47 var bad = function() { b = {a:1, b:2}; return 'X' }
48 Object.defineProperty(b, 'x', {get:bad});
49 assertEq("xabc".replace(/x|a|b/g, function(a) { return b[a] }), 'X12c');
50 })();