js/src/jit-test/tests/basic/testBug504520Harder.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 testBug504520Harder() {
michael@0 2 // test 1024 similar cases
michael@0 3 var vals = [1/0, -1/0, 0, 0/0];
michael@0 4 var ops = ["===", "!==", "==", "!=", "<", ">", "<=", ">="];
michael@0 5 for each (var x in vals) {
michael@0 6 for each (var y in vals) {
michael@0 7 for each (var op in ops) {
michael@0 8 for each (var z in vals) {
michael@0 9 // Assume eval is correct. This depends on the global
michael@0 10 // Infinity property not having been reassigned.
michael@0 11 var xz = eval(x + op + z);
michael@0 12 var yz = eval(y + op + z);
michael@0 13
michael@0 14 var arr = [x, x, x, x, x, x, x, x, x, y];
michael@0 15 assertEq(arr.length > 9, true);
michael@0 16 var expected = [xz, xz, xz, xz, xz, xz, xz, xz, xz, yz];
michael@0 17
michael@0 18 // ?: looks superfluous but that's what we're testing here
michael@0 19 var fun = eval(
michael@0 20 '(function (arr, results) {\n' +
michael@0 21 ' for (let i = 0; i < arr.length; i++)\n' +
michael@0 22 ' results.push(arr[i]' + op + z + ' ? "true" : "false");\n' +
michael@0 23 '});\n');
michael@0 24 var actual = [];
michael@0 25 fun(arr, actual);
michael@0 26 print(x, y, op, z);
michael@0 27 assertEq("" + actual, "" + expected);
michael@0 28 }
michael@0 29 }
michael@0 30 }
michael@0 31 }
michael@0 32 }
michael@0 33 testBug504520Harder();

mercurial