js/src/tests/ecma/Array/15.4.5.1-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.

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: 15.4.5.1-2.js
michael@0 9 ECMA Section: [[ Put]] (P, V)
michael@0 10 Description:
michael@0 11 Array objects use a variation of the [[Put]] method used for other native
michael@0 12 ECMAScript objects (section 8.6.2.2).
michael@0 13
michael@0 14 Assume A is an Array object and P is a string.
michael@0 15
michael@0 16 When the [[Put]] method of A is called with property P and value V, the
michael@0 17 following steps are taken:
michael@0 18
michael@0 19 1. Call the [[CanPut]] method of A with name P.
michael@0 20 2. If Result(1) is false, return.
michael@0 21 3. If A doesn't have a property with name P, go to step 7.
michael@0 22 4. If P is "length", go to step 12.
michael@0 23 5. Set the value of property P of A to V.
michael@0 24 6. Go to step 8.
michael@0 25 7. Create a property with name P, set its value to V and give it empty
michael@0 26 attributes.
michael@0 27 8. If P is not an array index, return.
michael@0 28 9. If A itself has a property (not an inherited property) named "length",
michael@0 29 andToUint32(P) is less than the value of the length property of A, then
michael@0 30 return.
michael@0 31 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
michael@0 32 11. Return.
michael@0 33 12. Compute ToUint32(V).
michael@0 34 13. For every integer k that is less than the value of the length property
michael@0 35 of A but not less than Result(12), if A itself has a property (not an
michael@0 36 inherited property) named ToString(k), then delete that property.
michael@0 37 14. Set the value of property P of A to Result(12).
michael@0 38 15. Return.
michael@0 39
michael@0 40
michael@0 41 These are gTestcases from Waldemar, detailed in
michael@0 42 http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552
michael@0 43
michael@0 44 Author: christine@netscape.com
michael@0 45 Date: 15 June 1998
michael@0 46 */
michael@0 47
michael@0 48 var SECTION = "15.4.5.1-2";
michael@0 49 var VERSION = "ECMA_1";
michael@0 50 startTest();
michael@0 51 var TITLE = "Array [[Put]] (P,V)";
michael@0 52
michael@0 53 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 54
michael@0 55 var a = new Array();
michael@0 56
michael@0 57 AddCase( "3.00", "three" );
michael@0 58 AddCase( "00010", "eight" );
michael@0 59 AddCase( "37xyz", "thirty-five" );
michael@0 60 AddCase("5000000000", 5)
michael@0 61 AddCase( "-2", -3 );
michael@0 62
michael@0 63 new TestCase( SECTION,
michael@0 64 "a[10]",
michael@0 65 void 0,
michael@0 66 a[10] );
michael@0 67
michael@0 68 new TestCase( SECTION,
michael@0 69 "a[3]",
michael@0 70 void 0,
michael@0 71 a[3] );
michael@0 72
michael@0 73 a[4] = "four";
michael@0 74
michael@0 75 new TestCase( SECTION,
michael@0 76 "a[4] = \"four\"; a[4]",
michael@0 77 "four",
michael@0 78 a[4] );
michael@0 79
michael@0 80 new TestCase( SECTION,
michael@0 81 "a[\"4\"]",
michael@0 82 "four",
michael@0 83 a["4"] );
michael@0 84
michael@0 85 new TestCase( SECTION,
michael@0 86 "a[\"4.00\"]",
michael@0 87 void 0,
michael@0 88 a["4.00"] );
michael@0 89
michael@0 90 new TestCase( SECTION,
michael@0 91 "a.length",
michael@0 92 5,
michael@0 93 a.length );
michael@0 94
michael@0 95
michael@0 96 a["5000000000"] = 5;
michael@0 97
michael@0 98 new TestCase( SECTION,
michael@0 99 "a[\"5000000000\"] = 5; a.length",
michael@0 100 5,
michael@0 101 a.length );
michael@0 102
michael@0 103 new TestCase( SECTION,
michael@0 104 "a[\"-2\"] = -3; a.length",
michael@0 105 5,
michael@0 106 a.length );
michael@0 107
michael@0 108 test();
michael@0 109
michael@0 110 function AddCase ( arg, value ) {
michael@0 111
michael@0 112 a[arg] = value;
michael@0 113
michael@0 114 new TestCase( SECTION,
michael@0 115 "a[\"" + arg + "\"] = "+ value +"; a.length",
michael@0 116 0,
michael@0 117 a.length );
michael@0 118 }

mercurial