js/src/tests/ecma/Array/15.4.4.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.

     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:          15.4.4.2.js
     9    ECMA Section:       15.4.4.2 Array.prototype.toString()
    10    Description:        The elements of this object are converted to strings
    11    and these strings are then concatenated, separated by
    12    comma characters.  The result is the same as if the
    13    built-in join method were invoiked for this object
    14    with no argument.
    15    Author:             christine@netscape.com
    16    Date:               7 october 1997
    17 */
    19 var SECTION = "15.4.4.2";
    20 var VERSION = "ECMA_1";
    21 startTest();
    22 var TITLE   = "Array.prototype.toString";
    24 writeHeaderToLog( SECTION + " "+ TITLE);
    26 new TestCase( SECTION, 
    27 	      "Array.prototype.toString.length", 
    28 	      0, 
    29 	      Array.prototype.toString.length );
    31 new TestCase( SECTION, 
    32 	      "(new Array()).toString()",    
    33 	      "",    
    34 	      (new Array()).toString() );
    36 new TestCase( SECTION, 
    37 	      "(new Array(2)).toString()",   
    38 	      ",",   
    39 	      (new Array(2)).toString() );
    41 new TestCase( SECTION, 
    42 	      "(new Array(0,1)).toString()", 
    43 	      "0,1", 
    44 	      (new Array(0,1)).toString() );
    46 new TestCase( SECTION, 
    47 	      "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", 
    48 	      "NaN,Infinity,-Infinity",  
    49 	      (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() );
    51 new TestCase( SECTION, 
    52 	      "(new Array( Boolean(1), Boolean(0))).toString()",  
    53 	      "true,false",  
    54 	      (new Array(Boolean(1),Boolean(0))).toString() );
    56 new TestCase( SECTION, 
    57 	      "(new Array(void 0,null)).toString()",   
    58 	      ",",   
    59 	      (new Array(void 0,null)).toString() );
    61 var EXPECT_STRING = "";
    62 var MYARR = new Array();
    64 for ( var i = -50; i < 50; i+= 0.25 ) {
    65   MYARR[MYARR.length] = i;
    66   EXPECT_STRING += i +",";
    67 }
    69 EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 );
    71 new TestCase( SECTION,
    72 	      "MYARR.toString()", 
    73 	      EXPECT_STRING, 
    74 	      MYARR.toString() );
    76 test();

mercurial