js/src/tests/ecma/Date/15.9.1.1-2.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 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 File Name: 15.9.1.1-2.js
michael@0 9 ECMA Section: 15.9.1.1 Time Range
michael@0 10 Description:
michael@0 11 - leap seconds are ignored
michael@0 12 - assume 86400000 ms / day
michael@0 13 - numbers range fom +/- 9,007,199,254,740,991
michael@0 14 - ms precision for any instant that is within
michael@0 15 approximately +/-285,616 years from 1 jan 1970
michael@0 16 UTC
michael@0 17 - range of times supported is -100,000,000 days
michael@0 18 to 100,000,000 days from 1 jan 1970 12:00 am
michael@0 19 - time supported is 8.64e5*10e8 milliseconds from
michael@0 20 1 jan 1970 UTC (+/-273972.6027397 years)
michael@0 21 Author: christine@netscape.com
michael@0 22 Date: 9 july 1997
michael@0 23 */
michael@0 24
michael@0 25 // every one hundred years contains:
michael@0 26 // 24 years with 366 days
michael@0 27 //
michael@0 28 // every four hundred years contains:
michael@0 29 // 97 years with 366 days
michael@0 30 // 303 years with 365 days
michael@0 31 //
michael@0 32 // 86400000*366*97 = 3067372800000
michael@0 33 // +86400000*365*303 = + 9555408000000
michael@0 34 // = 1.26227808e+13
michael@0 35
michael@0 36 var FOUR_HUNDRED_YEARS = 1.26227808e+13;
michael@0 37 var SECTION = "15.9.1.1-2";
michael@0 38
michael@0 39 writeHeaderToLog("15.9.1.1 Time Range");
michael@0 40
michael@0 41 var M_SECS;
michael@0 42 var CURRENT_YEAR;
michael@0 43
michael@0 44 for ( M_SECS = 0, CURRENT_YEAR = 1970;
michael@0 45 M_SECS > -8640000000000000;
michael@0 46 M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
michael@0 47
michael@0 48 new TestCase( SECTION,
michael@0 49 "new Date("+M_SECS+")",
michael@0 50 CURRENT_YEAR,
michael@0 51 (new Date( M_SECS )).getUTCFullYear() );
michael@0 52
michael@0 53 }
michael@0 54
michael@0 55 test();
michael@0 56

mercurial