js/src/tests/ecma_2/Exceptions/date-003.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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /**
     8    File Name:          date-003.js
     9    Corresponds To      15.9.5.3-1.js
    10    ECMA Section:       15.9.5.3-1 Date.prototype.valueOf
    11    Description:
    13    The valueOf function returns a number, which is this time value.
    15    The valueOf function is not generic; it generates a runtime error if
    16    its this value is not a Date object.  Therefore it cannot be transferred
    17    to other kinds of objects for use as a method.
    19    Author:             christine@netscape.com
    20    Date:               12 november 1997
    21 */
    22 var SECTION = "date-003";
    23 var VERSION = "JS1_4";
    24 var TITLE   = "Date.prototype.valueOf";
    26 startTest();
    27 writeHeaderToLog( SECTION + " "+ TITLE);
    29 var result = "Failed";
    30 var exception = "No exception thrown";
    31 var expect = "Passed";
    33 try {
    34   var OBJ = new MyObject( new Date(0) );
    35   result = OBJ.valueOf();
    36 } catch ( e ) {
    37   result = expect;
    38   exception = e.toString();
    39 }
    41 new TestCase(
    42   SECTION,
    43   "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" +
    44   " (threw " + exception +")",
    45   expect,
    46   result );
    48 test();
    50 function MyObject( value ) {
    51   this.value = value;
    52   this.valueOf = Date.prototype.valueOf;
    53 //  The following line causes an infinte loop
    54 //    this.toString = new Function( "return this+\"\";");
    55   return this;
    56 }

mercurial