js/src/tests/js1_4/Functions/function-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:          function-001.js
     9  *  Description:
    10  *
    11  * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455
    12  *
    13  *  Earlier versions of JavaScript supported access to the arguments property
    14  *  of the function object. This property held the arguments to the function.
    15  *  function f() {
    16  *      return f.arguments[0];    // deprecated
    17  *  }
    18  *  var x = f(3);    // x will be 3
    19  *
    20  * This feature is not a part of the final ECMA standard. Instead, scripts
    21  * should simply use just "arguments":
    22  *
    23  * function f() {
    24  *    return arguments[0];    // okay
    25  * }
    26  *
    27  * var x = f(3);    // x will be 3
    28  *
    29  * Again, this feature was motivated by performance concerns. Access to the
    30  * arguments property is not threadsafe, which is of particular concern in
    31  * server environments. Also, the compiler can generate better code for
    32  * functions because it can tell when the arguments are being accessed only by
    33  * name and avoid setting up the arguments object.
    34  *
    35  *  Author:             christine@netscape.com
    36  *  Date:               11 August 1998
    37  */
    38 var SECTION = "function-001.js";
    39 var VERSION = "JS1_4";
    40 var TITLE   = "Accessing the arguments property of a function object";
    41 var BUGNUMBER="324455";
    42 startTest();
    43 writeHeaderToLog( SECTION + " "+ TITLE);
    45 new TestCase(
    46   SECTION,
    47   "return function.arguments",
    48   "P",
    49   TestFunction_2("P", "A","S","S")[0] +"");
    52 new TestCase(
    53   SECTION,
    54   "return arguments",
    55   "P",
    56   TestFunction_1( "P", "A", "S", "S" )[0] +"");
    58 new TestCase(
    59   SECTION,
    60   "return arguments when function contains an arguments property",
    61   "PASS",
    62   TestFunction_3( "P", "A", "S", "S" ) +"");
    64 new TestCase(
    65   SECTION,
    66   "return function.arguments when function contains an arguments property",
    67   "[object Arguments]",
    68   TestFunction_4( "F", "A", "I", "L" ) +"");
    70 test();
    72 function TestFunction_1( a, b, c, d, e ) {
    73   return arguments;
    74 }
    76 function TestFunction_2( a, b, c, d, e ) {
    77   return TestFunction_2.arguments;
    78 }
    80 function TestFunction_3( a, b, c, d, e ) {
    81   var arguments = "PASS";
    82   return arguments;
    83 }
    85 function TestFunction_4( a, b, c, d, e ) {
    86   var arguments = "FAIL";
    87   return TestFunction_4.arguments;
    88 }

mercurial