js/src/tests/ecma_3/Date/15.9.3.2-1.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /*
michael@0 3 * Any copyright is dedicated to the Public Domain.
michael@0 4 * http://creativecommons.org/licenses/publicdomain/
michael@0 5 * Contributor: Bob Clary
michael@0 6 */
michael@0 7
michael@0 8 //-----------------------------------------------------------------------------
michael@0 9 var BUGNUMBER = 273292;
michael@0 10 var summary = '15.9.3.2 new Date(value)';
michael@0 11 var actual = '';
michael@0 12 var expect = '';
michael@0 13 var date1;
michael@0 14 var date2;
michael@0 15 var i;
michael@0 16 var validDateStrings = [
michael@0 17 "11/69/2004",
michael@0 18 "11/70/2004",
michael@0 19 "69/69/2004",
michael@0 20 "69/69/69",
michael@0 21 "69/69/1969",
michael@0 22 "70/69/70",
michael@0 23 "70/69/1970",
michael@0 24 "70/69/2004"
michael@0 25 ];
michael@0 26
michael@0 27 var invalidDateStrings = [
michael@0 28 "70/70/70",
michael@0 29 "70/70/1970",
michael@0 30 "70/70/2004"
michael@0 31 ];
michael@0 32
michael@0 33 printBugNumber(BUGNUMBER);
michael@0 34 printStatus (summary);
michael@0 35
michael@0 36 expect = 0;
michael@0 37
michael@0 38 for (i = 0; i < validDateStrings.length; i++)
michael@0 39 {
michael@0 40 date1 = new Date(validDateStrings[i]);
michael@0 41 date2 = new Date(date1.toDateString());
michael@0 42 actual = date2 - date1;
michael@0 43
michael@0 44 reportCompare(expect, actual, inSection(i) + ' ' +
michael@0 45 validDateStrings[i]);
michael@0 46 }
michael@0 47
michael@0 48 expect = true;
michael@0 49
michael@0 50 var offset = validDateStrings.length;
michael@0 51
michael@0 52 for (i = 0; i < invalidDateStrings.length; i++)
michael@0 53 {
michael@0 54 date1 = new Date(invalidDateStrings[i]);
michael@0 55 actual = isNaN(date1);
michael@0 56
michael@0 57 reportCompare(expect, actual, inSection(i + offset) + ' ' +
michael@0 58 invalidDateStrings[i] + ' is invalid.');
michael@0 59 }
michael@0 60

mercurial