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.
michael@0 | 1 | function test1() { |
michael@0 | 2 | var f = function() { return 1; }; |
michael@0 | 3 | |
michael@0 | 4 | for (var i=0; i<25; i++) { |
michael@0 | 5 | f.call(); |
michael@0 | 6 | if (i > 20) |
michael@0 | 7 | f = Math.abs; |
michael@0 | 8 | } |
michael@0 | 9 | } |
michael@0 | 10 | test1(); |
michael@0 | 11 | |
michael@0 | 12 | var origCall = Function.prototype.call; |
michael@0 | 13 | |
michael@0 | 14 | function test2() { |
michael@0 | 15 | var f = function() { return 1; }; |
michael@0 | 16 | var c = 0; |
michael@0 | 17 | for (var i=0; i<25; i++) { |
michael@0 | 18 | f.call(); |
michael@0 | 19 | if (i > 20) |
michael@0 | 20 | Function.prototype.call = function() { c++; }; |
michael@0 | 21 | } |
michael@0 | 22 | assertEq(c, 3); |
michael@0 | 23 | } |
michael@0 | 24 | test2(); |
michael@0 | 25 | Function.prototype.call = origCall; |
michael@0 | 26 | |
michael@0 | 27 | function test3() { |
michael@0 | 28 | var f = function() { return 1; }; |
michael@0 | 29 | for (var i=0; i<25; i++) { |
michael@0 | 30 | f.call(); |
michael@0 | 31 | if (i > 20) |
michael@0 | 32 | Function.prototype.call = undefined; |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | try { |
michael@0 | 36 | test3(); |
michael@0 | 37 | assertEq(0, 1); |
michael@0 | 38 | } catch(e) {} |
michael@0 | 39 | |
michael@0 | 40 | Function.prototype.call = origCall; |
michael@0 | 41 | |
michael@0 | 42 | function test4() { |
michael@0 | 43 | var f = function(a, b, c) { |
michael@0 | 44 | assertEq(arguments.length, 1); |
michael@0 | 45 | assertEq(a, 1); |
michael@0 | 46 | assertEq(b, undefined); |
michael@0 | 47 | assertEq(c, undefined); |
michael@0 | 48 | return 1; |
michael@0 | 49 | }; |
michael@0 | 50 | for (var i=0; i<25; i++) { |
michael@0 | 51 | f.call(null, 1); |
michael@0 | 52 | } |
michael@0 | 53 | } |
michael@0 | 54 | test4(); |