js/src/tests/js1_5/Exceptions/regress-123002.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  *
     8  * Date:    01 Feb 2002
     9  * SUMMARY: Testing Error.length
    10  * See http://bugzilla.mozilla.org/show_bug.cgi?id=123002
    11  *
    12  * NOTE: Error.length should equal the length of FormalParameterList of the
    13  * Error constructor. This is currently 1 in Rhino, 3 in SpiderMonkey.
    14  *
    15  * The difference is due to http://bugzilla.mozilla.org/show_bug.cgi?id=50447.
    16  * As a result of that bug, SpiderMonkey has extended ECMA to allow two new
    17  * parameters to Error constructors:
    18  *
    19  * Rhino:        new Error (message)
    20  * SpiderMonkey: new Error (message, fileName, lineNumber)
    21  *
    22  * NOTE: since we have hard-coded the length expectations, this testcase will
    23  * have to be changed if the Error FormalParameterList is ever changed again.
    24  *
    25  * To do this, just change the two LENGTH constants below -
    26  */
    27 //-----------------------------------------------------------------------------
    28 var UBound = 0;
    29 var BUGNUMBER = 123002;
    30 var summary = 'Testing Error.length';
    31 var QUOTE = '"';
    32 var status = '';
    33 var statusitems = [];
    34 var actual = '';
    35 var actualvalues = [];
    36 var expect= '';
    37 var expectedvalues = [];
    40 var LENGTH_EXPECTED = 1;
    42 /*
    43  * The various NativeError objects; see ECMA-262 Edition 3, Section 15.11.6
    44  */
    45 var errObjects = [new Error(), new EvalError(), new RangeError(),
    46 		  new ReferenceError(), new SyntaxError(), new TypeError(), new URIError()];
    49 for (var i in errObjects)
    50 {
    51   var err = errObjects[i];
    52   status = inSection(quoteThis(err.name));
    53   actual = Error.length;
    54   expect = LENGTH_EXPECTED;
    55   addThis();
    56 }
    60 //-----------------------------------------------------------------------------
    61 test();
    62 //-----------------------------------------------------------------------------
    66 function addThis()
    67 {
    68   statusitems[UBound] = status;
    69   actualvalues[UBound] = actual;
    70   expectedvalues[UBound] = expect;
    71   UBound++;
    72 }
    75 function test()
    76 {
    77   enterFunc('test');
    78   printBugNumber(BUGNUMBER);
    79   printStatus(summary);
    81   for (var i=0; i<UBound; i++)
    82   {
    83     reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
    84   }
    86   exitFunc ('test');
    87 }
    90 function quoteThis(text)
    91 {
    92   return QUOTE + text + QUOTE;
    93 }

mercurial