js/src/tests/ecma_5/extensions/bug472534.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.

     1 function monthNames () {
     2     return [
     3       /jan(uar(y)?)?/, 0,
     4       /feb(ruar(y)?)?/, 1,
     5       /m\u00e4r|mar|m\u00e4rz|maerz|march/, 2,
     6       /apr(il)?/, 3,
     7       /ma(i|y)/, 4,
     8       /jun(i|o|e)?/, 5,
     9       /jul(i|y)?/, 6,
    10       /aug(ust)?/, 7,
    11       /sep((t)?(ember))?/, 8,
    12       /o(c|k)t(ober)?/, 9,
    13       /nov(ember)?/, 10,
    14       /de(c|z)(ember)?/, 11
    15     ];
    16 };
    18 var actual = '';
    19 var expected = '(jan(uar(y)?)?)|(feb(ruar(y)?)?)|(m\\u00e4r|mar|m\\u00e4rz|maerz|march)|(apr(il)?)|(ma(i|y))|(jun(i|o|e)?)|(jul(i|y)?)|(aug(ust)?)|(sep((t)?(ember))?)|(o(c|k)t(ober)?)|(nov(ember)?)|(de(c|z)(ember)?)';
    20 var mn = monthNames();
    21 for (var i = 0; i < mn.length; ++i) {
    22     if (actual)
    23         actual += '|';
    24     actual += '(' + mn[i++].source + ')';
    25 }
    27 assertEq(actual, expected);
    29 if (typeof reportCompare === "function")
    30     reportCompare(true, true);

mercurial