js/src/tests/ecma_3/Object/class-004.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 [[Class]] property of native error constructors.
    10  * See ECMA-262 Edition 3, Section 8.6.2 for the [[Class]] property.
    11  *
    12  * See ECMA-262 Edition 3, Section 15.11.6 for the native error types.
    13  * See http://bugzilla.mozilla.org/show_bug.cgi?id=56868
    14  *
    15  * Same as class-003.js - but testing the constructors here, not
    16  * object instances.  Therefore we expect the [[Class]] property to
    17  * equal 'Function' in each case.
    18  *
    19  * The getJSClass() function we use is in a utility file, e.g. "shell.js"
    20  */
    21 //-----------------------------------------------------------------------------
    22 var i = 0;
    23 var UBound = 0;
    24 var BUGNUMBER = 56868;
    25 var summary = 'Testing the internal [[Class]] property of native error constructors';
    26 var statprefix = 'Current constructor is: ';
    27 var status = ''; var statusList = [ ];
    28 var actual = ''; var actualvalue = [ ];
    29 var expect= ''; var expectedvalue = [ ];
    31 /*
    32  * We set the expect variable each time only for readability.
    33  * We expect 'Function' every time; see discussion above -
    34  */
    35 status = 'Error';
    36 actual = getJSClass(Error);
    37 expect = 'Function';
    38 addThis();
    40 status = 'EvalError';
    41 actual = getJSClass(EvalError);
    42 expect = 'Function';
    43 addThis();
    45 status = 'RangeError';
    46 actual = getJSClass(RangeError);
    47 expect = 'Function';
    48 addThis();
    50 status = 'ReferenceError';
    51 actual = getJSClass(ReferenceError);
    52 expect = 'Function';
    53 addThis();
    55 status = 'SyntaxError';
    56 actual = getJSClass(SyntaxError);
    57 expect = 'Function';
    58 addThis();
    60 status = 'TypeError';
    61 actual = getJSClass(TypeError);
    62 expect = 'Function';
    63 addThis();
    65 status = 'URIError';
    66 actual = getJSClass(URIError);
    67 expect = 'Function';
    68 addThis();
    72 //---------------------------------------------------------------------------------
    73 test();
    74 //---------------------------------------------------------------------------------
    78 function addThis()
    79 {
    80   statusList[UBound] = status;
    81   actualvalue[UBound] = actual;
    82   expectedvalue[UBound] = expect;
    83   UBound++;
    84 }
    87 function test()
    88 {
    89   enterFunc ('test');
    90   printBugNumber(BUGNUMBER);
    91   printStatus (summary);
    93   for (i = 0; i < UBound; i++)
    94   {
    95     reportCompare(expectedvalue[i], actualvalue[i], getStatus(i));
    96   }
    98   exitFunc ('test');
    99 }
   102 function getStatus(i)
   103 {
   104   return statprefix + statusList[i];
   105 }

mercurial