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.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 * File Name: function-001.js
michael@0 9 * Description:
michael@0 10 *
michael@0 11 * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455
michael@0 12 *
michael@0 13 * Earlier versions of JavaScript supported access to the arguments property
michael@0 14 * of the function object. This property held the arguments to the function.
michael@0 15 * function f() {
michael@0 16 * return f.arguments[0]; // deprecated
michael@0 17 * }
michael@0 18 * var x = f(3); // x will be 3
michael@0 19 *
michael@0 20 * This feature is not a part of the final ECMA standard. Instead, scripts
michael@0 21 * should simply use just "arguments":
michael@0 22 *
michael@0 23 * function f() {
michael@0 24 * return arguments[0]; // okay
michael@0 25 * }
michael@0 26 *
michael@0 27 * var x = f(3); // x will be 3
michael@0 28 *
michael@0 29 * Again, this feature was motivated by performance concerns. Access to the
michael@0 30 * arguments property is not threadsafe, which is of particular concern in
michael@0 31 * server environments. Also, the compiler can generate better code for
michael@0 32 * functions because it can tell when the arguments are being accessed only by
michael@0 33 * name and avoid setting up the arguments object.
michael@0 34 *
michael@0 35 * Author: christine@netscape.com
michael@0 36 * Date: 11 August 1998
michael@0 37 */
michael@0 38 var SECTION = "function-001.js";
michael@0 39 var VERSION = "JS1_4";
michael@0 40 var TITLE = "Accessing the arguments property of a function object";
michael@0 41 var BUGNUMBER="324455";
michael@0 42 startTest();
michael@0 43 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 44
michael@0 45 new TestCase(
michael@0 46 SECTION,
michael@0 47 "return function.arguments",
michael@0 48 "P",
michael@0 49 TestFunction_2("P", "A","S","S")[0] +"");
michael@0 50
michael@0 51
michael@0 52 new TestCase(
michael@0 53 SECTION,
michael@0 54 "return arguments",
michael@0 55 "P",
michael@0 56 TestFunction_1( "P", "A", "S", "S" )[0] +"");
michael@0 57
michael@0 58 new TestCase(
michael@0 59 SECTION,
michael@0 60 "return arguments when function contains an arguments property",
michael@0 61 "PASS",
michael@0 62 TestFunction_3( "P", "A", "S", "S" ) +"");
michael@0 63
michael@0 64 new TestCase(
michael@0 65 SECTION,
michael@0 66 "return function.arguments when function contains an arguments property",
michael@0 67 "[object Arguments]",
michael@0 68 TestFunction_4( "F", "A", "I", "L" ) +"");
michael@0 69
michael@0 70 test();
michael@0 71
michael@0 72 function TestFunction_1( a, b, c, d, e ) {
michael@0 73 return arguments;
michael@0 74 }
michael@0 75
michael@0 76 function TestFunction_2( a, b, c, d, e ) {
michael@0 77 return TestFunction_2.arguments;
michael@0 78 }
michael@0 79
michael@0 80 function TestFunction_3( a, b, c, d, e ) {
michael@0 81 var arguments = "PASS";
michael@0 82 return arguments;
michael@0 83 }
michael@0 84
michael@0 85 function TestFunction_4( a, b, c, d, e ) {
michael@0 86 var arguments = "FAIL";
michael@0 87 return TestFunction_4.arguments;
michael@0 88 }
michael@0 89

mercurial