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 testMathMaxMin(aFun) { |
michael@0 | 2 | var test_error = { name: "test" }; |
michael@0 | 3 | test(function() { |
michael@0 | 4 | assert_throws(test_error, function() { |
michael@0 | 5 | Math[aFun](NaN, { |
michael@0 | 6 | valueOf: function() { |
michael@0 | 7 | throw test_error; |
michael@0 | 8 | } |
michael@0 | 9 | }); |
michael@0 | 10 | }); |
michael@0 | 11 | }, "ToNumber should be called on all arguments: NaN."); |
michael@0 | 12 | test(function() { |
michael@0 | 13 | assert_throws(test_error, function() { |
michael@0 | 14 | Math[aFun](-Infinity, { |
michael@0 | 15 | valueOf: function() { |
michael@0 | 16 | throw test_error; |
michael@0 | 17 | } |
michael@0 | 18 | }); |
michael@0 | 19 | }); |
michael@0 | 20 | }, "ToNumber should be called on all arguments: -Infinity."); |
michael@0 | 21 | test(function() { |
michael@0 | 22 | assert_throws(test_error, function() { |
michael@0 | 23 | Math[aFun](Infinity, { |
michael@0 | 24 | valueOf: function() { |
michael@0 | 25 | throw test_error; |
michael@0 | 26 | } |
michael@0 | 27 | }); |
michael@0 | 28 | }); |
michael@0 | 29 | }, "ToNumber should be called on all arguments: Infinity."); |
michael@0 | 30 | test(function() { |
michael@0 | 31 | assert_throws(test_error, function() { |
michael@0 | 32 | Math[aFun]({ |
michael@0 | 33 | valueOf: function() { |
michael@0 | 34 | throw test_error; |
michael@0 | 35 | } |
michael@0 | 36 | }, |
michael@0 | 37 | { |
michael@0 | 38 | valueOf: function() { |
michael@0 | 39 | throw 7; |
michael@0 | 40 | } |
michael@0 | 41 | }); |
michael@0 | 42 | }); |
michael@0 | 43 | }, "ToNumber should be called left to right."); |
michael@0 | 44 | test(function() { |
michael@0 | 45 | assert_equals(Math[aFun]("1"), 1); |
michael@0 | 46 | }, "Should return a number."); |
michael@0 | 47 | test(function() { |
michael@0 | 48 | var expected = { |
michael@0 | 49 | "max": 0, |
michael@0 | 50 | "min": -0 |
michael@0 | 51 | } |
michael@0 | 52 | assert_equals(Math[aFun](0, -0), expected[aFun]); |
michael@0 | 53 | assert_equals(Math[aFun](-0, 0), expected[aFun]); |
michael@0 | 54 | assert_equals(Math[aFun](0, 0), 0); |
michael@0 | 55 | assert_equals(Math[aFun](-0, -0), -0); |
michael@0 | 56 | }, "Should handle negative zero correctly."); |
michael@0 | 57 | } |