js/src/tests/ecma/ExecutionContexts/10.1.8-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:          10.1.8-2
     9    ECMA Section:       Arguments Object
    10    Description:
    12    When control enters an execution context for declared function code,
    13    anonymous code, or implementation-supplied code, an arguments object is
    14    created and initialized as follows:
    16    The [[Prototype]] of the arguments object is to the original Object
    17    prototype object, the one that is the initial value of Object.prototype
    18    (section 15.2.3.1).
    20    A property is created with name callee and property attributes {DontEnum}.
    21    The initial value of this property is the function object being executed.
    22    This allows anonymous functions to be recursive.
    24    A property is created with name length and property attributes {DontEnum}.
    25    The initial value of this property is the number of actual parameter values
    26    supplied by the caller.
    28    For each non-negative integer, iarg, less than the value of the length
    29    property, a property is created with name ToString(iarg) and property
    30    attributes { DontEnum }. The initial value of this property is the value
    31    of the corresponding actual parameter supplied by the caller. The first
    32    actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
    33    so on. In the case when iarg is less than the number of formal parameters
    34    for the function object, this property shares its value with the
    35    corresponding property of the activation object. This means that changing
    36    this property changes the corresponding property of the activation object
    37    and vice versa. The value sharing mechanism depends on the implementation.
    39    Author:             christine@netscape.com
    40    Date:               12 november 1997
    41 */
    43 var SECTION = "10.1.8-2";
    44 var VERSION = "ECMA_1";
    45 startTest();
    46 var TITLE   = "Arguments Object";
    48 writeHeaderToLog( SECTION + " "+ TITLE);
    50 //  Tests for anonymous functions
    52 var GetCallee       = new Function( "var c = arguments.callee; return c" );
    53 var GetArguments    = new Function( "var a = arguments; return a" );
    54 var GetLength       = new Function( "var l = arguments.length; return l" );
    56 var ARG_STRING = "value of the argument property";
    58 new TestCase( SECTION,
    59 	      "GetCallee()",
    60 	      GetCallee,
    61 	      GetCallee() );
    63 var LIMIT = 100;
    65 for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
    66   args += String(i) + ( i+1 < LIMIT ? "," : "" );
    68 }
    70 var LENGTH = eval( "GetLength("+ args +")" );
    72 new TestCase( SECTION,
    73 	      "GetLength("+args+")",
    74 	      100,
    75 	      LENGTH );
    77 var ARGUMENTS = eval( "GetArguments( " +args+")" );
    79 for ( var i = 0; i < 100; i++ ) {
    80   new TestCase( SECTION,
    81 		"GetArguments("+args+")["+i+"]",
    82 		i,
    83 		ARGUMENTS[i] );
    84 }
    86 test();

mercurial