js/src/tests/ecma_2/Expressions/StrictEquality-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:          StrictEquality-001.js
     9  *  ECMA Section:       11.9.6.js
    10  *  Description:
    11  *
    12  *  Author:             christine@netscape.com
    13  *  Date:               4 september 1998
    14  */
    15 var SECTION = "StrictEquality-001 - 11.9.6";
    16 var VERSION = "ECMA_2";
    17 var TITLE   =  "The strict equality operator ( === )";
    19 startTest();
    20 writeHeaderToLog( SECTION + " "+ TITLE);
    23 // 1. If Type(x) is different from Type(y) return false
    25 StrictEquality( true, new Boolean(true), false );
    26 StrictEquality( new Boolean(), false, false );
    27 StrictEquality( "", new String(),    false );
    28 StrictEquality( new String("hi"), "hi", false );
    30 // 2. If Type(x) is not Number go to step 9.
    32 // 3. If x is NaN, return false
    33 StrictEquality( NaN, NaN,   false );
    34 StrictEquality( NaN, 0,     false );
    36 // 4. If y is NaN, return false.
    37 StrictEquality( 0,  NaN,    false );
    39 // 5. if x is the same number value as y, return true
    41 // 6. If x is +0 and y is -0, return true
    43 // 7. If x is -0 and y is +0, return true
    45 // 8. Return false.
    48 // 9.  If Type(x) is String, then return true if x and y are exactly
    49 //  the same sequence of characters ( same length and same characters
    50 //  in corresponding positions.) Otherwise return false.
    52 //  10. If Type(x) is Boolean, return true if x and y are both true or
    53 //  both false. otherwise return false.
    56 //  Return true if x and y refer to the same object.  Otherwise return
    57 //  false.
    59 // Return false.
    62 test();
    64 function StrictEquality( x, y, expect ) {
    65   result = ( x === y );
    67   new TestCase(
    68     SECTION,
    69     x +" === " + y,
    70     expect,
    71     result );
    72 }

mercurial