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 | load(libdir + 'andTestHelper.js'); |
michael@0 | 2 | load(libdir + 'orTestHelper.js'); |
michael@0 | 3 | |
michael@0 | 4 | (function () { |
michael@0 | 5 | var opsies = ["||", "&&"]; |
michael@0 | 6 | var falsies = [null, undefined, false, NaN, 0, ""]; |
michael@0 | 7 | var truthies = [{}, true, 1, 42, 1/0, -1/0, "blah"]; |
michael@0 | 8 | var boolies = [falsies, truthies]; |
michael@0 | 9 | |
michael@0 | 10 | // The for each here should abort tracing, so that this test framework |
michael@0 | 11 | // relies only on the interpreter while the orTestHelper and andTestHelper |
michael@0 | 12 | // functions get trace-JITed. |
michael@0 | 13 | for each (var op in opsies) { |
michael@0 | 14 | for (var i in boolies) { |
michael@0 | 15 | for (var j in boolies[i]) { |
michael@0 | 16 | var x = uneval(boolies[i][j]); |
michael@0 | 17 | for (var k in boolies) { |
michael@0 | 18 | for (var l in boolies[k]) { |
michael@0 | 19 | var y = uneval(boolies[k][l]); |
michael@0 | 20 | var prefix = (op == "||") ? "or" : "and"; |
michael@0 | 21 | var f = new Function("return " + prefix + "TestHelper(" + x + "," + y + ",10)"); |
michael@0 | 22 | var expected = eval(x + op + y) ? 45 : 0; |
michael@0 | 23 | assertEq(f(), expected); |
michael@0 | 24 | } |
michael@0 | 25 | } |
michael@0 | 26 | } |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | })(); |