js/src/tests/ecma_2/Exceptions/number-001.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:          number-001
     9    Corresponds To:     15.7.4.2-2-n.js
    10    ECMA Section:       15.7.4.2.2 Number.prototype.toString()
    11    Description:
    12    If the radix is the number 10 or not supplied, then this number value is
    13    given as an argument to the ToString operator; the resulting string value
    14    is returned.
    16    If the radix is supplied and is an integer from 2 to 36, but not 10, the
    17    result is a string, the choice of which is implementation dependent.
    19    The toString function is not generic; it generates a runtime error if its
    20    this value is not a Number object. Therefore it cannot be transferred to
    21    other kinds of objects for use as a method.
    23    Author:             christine@netscape.com
    24    Date:               16 september 1997
    25 */
    26 var SECTION = "number-001";
    27 var VERSION = "JS1_4";
    28 var TITLE   = "Exceptions for Number.toString()";
    30 startTest();
    31 writeHeaderToLog( SECTION + " Number.prototype.toString()");
    33 var result = "Failed";
    34 var exception = "No exception thrown";
    35 var expect = "Passed";
    37 try {
    38   object= new Object();
    39   object.toString = Number.prototype.toString;
    40   result = object.toString();
    41 } catch ( e ) {
    42   result = expect;
    43   exception = e.toString();
    44 }
    46 new TestCase(
    47   SECTION,
    48   "object = new Object(); object.toString = Number.prototype.toString; object.toString()" +
    49   " (threw " + exception +")",
    50   expect,
    51   result );
    53 test();

mercurial