js/src/tests/ecma_3/Object/class-002.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/. */
     6 /*
     7  * Date: 14 Mar 2001
     8  *
     9  * SUMMARY: Testing the [[Class]] property of native constructors.
    10  * See ECMA-262 Edition 3 13-Oct-1999, Section 8.6.2 re [[Class]] property.
    11  *
    12  * Same as class-001.js - but testing the constructors here, not
    13  * object instances.  Therefore we expect the [[Class]] property to
    14  * equal 'Function' in each case.
    15  *
    16  * The getJSClass() function we use is in a utility file, e.g. "shell.js"
    17  */
    18 //-----------------------------------------------------------------------------
    19 var i = 0;
    20 var UBound = 0;
    21 var BUGNUMBER = '(none)';
    22 var summary = 'Testing the internal [[Class]] property of native constructors';
    23 var statprefix = 'Current constructor is: ';
    24 var status = ''; var statusList = [ ];
    25 var actual = ''; var actualvalue = [ ];
    26 var expect= ''; var expectedvalue = [ ];
    28 /*
    29  * We set the expect variable each time only for readability.
    30  * We expect 'Function' every time; see discussion above -
    31  */
    32 status = 'Object';
    33 actual = getJSClass(Object);
    34 expect = 'Function';
    35 addThis();
    37 status = 'Function';
    38 actual = getJSClass(Function);
    39 expect = 'Function';
    40 addThis();
    42 status = 'Array';
    43 actual = getJSClass(Array);
    44 expect = 'Function';
    45 addThis();
    47 status = 'String';
    48 actual = getJSClass(String);
    49 expect = 'Function';
    50 addThis();
    52 status = 'Boolean';
    53 actual = getJSClass(Boolean);
    54 expect = 'Function';
    55 addThis();
    57 status = 'Number';
    58 actual = getJSClass(Number);
    59 expect = 'Function';
    60 addThis();
    62 status = 'Date';
    63 actual = getJSClass(Date);
    64 expect = 'Function';
    65 addThis();
    67 status = 'RegExp';
    68 actual = getJSClass(RegExp);
    69 expect = 'Function';
    70 addThis();
    72 status = 'Error';
    73 actual = getJSClass(Error);
    74 expect = 'Function';
    75 addThis();
    79 //---------------------------------------------------------------------------------
    80 test();
    81 //---------------------------------------------------------------------------------
    85 function addThis()
    86 {
    87   statusList[UBound] = status;
    88   actualvalue[UBound] = actual;
    89   expectedvalue[UBound] = expect;
    90   UBound++;
    91 }
    94 function test()
    95 {
    96   enterFunc ('test');
    97   printBugNumber(BUGNUMBER);
    98   printStatus (summary);
   100   for (i = 0; i < UBound; i++)
   101   {
   102     reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
   103   }
   105   exitFunc ('test');
   106 }
   109 function getStatus(i)
   110 {
   111   return statprefix + statusList[i];
   112 }

mercurial