js/src/tests/ecma/Date/15.9.5.8.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 // |reftest| random-if(Android)
     2 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     8 /**
     9    File Name:          15.9.5.8.js
    10    ECMA Section:       15.9.5.8
    11    Description:        Date.prototype.getMonth
    13    1.  Let t be this time value.
    14    2.  If t is NaN, return NaN.
    15    3.  Return MonthFromTime(LocalTime(t)).
    17    Author:             christine@netscape.com
    18    Date:               12 november 1997
    19 */
    21 var SECTION = "15.9.5.8";
    22 var VERSION = "ECMA_1";
    23 startTest();
    24 var TITLE   = "Date.prototype.getMonth()";
    26 writeHeaderToLog( SECTION + " "+ TITLE);
    28 addTestCase( TIME_NOW );
    29 addTestCase( TIME_0000 );
    30 addTestCase( TIME_1970 );
    31 addTestCase( TIME_1900 );
    32 addTestCase( TIME_2000 );
    33 addTestCase( UTC_FEB_29_2000 );
    34 addTestCase( UTC_JAN_1_2005 );
    36 new TestCase( SECTION,
    37               "(new Date(NaN)).getMonth()",
    38               NaN,
    39               (new Date(NaN)).getMonth() );
    41 new TestCase( SECTION,
    42               "Date.prototype.getMonth.length",
    43               0,
    44               Date.prototype.getMonth.length );
    45 test();
    47 function addTestCase( t ) {
    48   var leap = InLeapYear(t);
    50   for ( var m = 0; m < 12; m++ ) {
    52     t += TimeInMonth(m, leap);
    54     new TestCase( SECTION,
    55                   "(new Date("+t+")).getMonth()",
    56                   MonthFromTime(LocalTime(t)),
    57                   (new Date(t)).getMonth() );
    59     new TestCase( SECTION,
    60                   "(new Date("+(t+1)+")).getMonth()",
    61                   MonthFromTime(LocalTime(t+1)),
    62                   (new Date(t+1)).getMonth() );
    64     new TestCase( SECTION,
    65                   "(new Date("+(t-1)+")).getMonth()",
    66                   MonthFromTime(LocalTime(t-1)),
    67                   (new Date(t-1)).getMonth() );
    69     new TestCase( SECTION,
    70                   "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
    71                   MonthFromTime(LocalTime(t-TZ_ADJUST)),
    72                   (new Date(t-TZ_ADJUST)).getMonth() );
    74     new TestCase( SECTION,
    75                   "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
    76                   MonthFromTime(LocalTime(t+TZ_ADJUST)),
    77                   (new Date(t+TZ_ADJUST)).getMonth() );
    79   }
    80 }

mercurial