Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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-2.js |
michael@0 | 9 | ECMA Section: 15.4 Array Objects |
michael@0 | 10 | |
michael@0 | 11 | Description: Whenever a property is added whose name is an array |
michael@0 | 12 | index, the length property is changed, if necessary, |
michael@0 | 13 | to be one more than the numeric value of that array |
michael@0 | 14 | index; and whenever the length property is changed, |
michael@0 | 15 | every property whose name is an array index whose value |
michael@0 | 16 | is not smaller than the new length is automatically |
michael@0 | 17 | deleted. This constraint applies only to the Array |
michael@0 | 18 | object itself, and is unaffected by length or array |
michael@0 | 19 | index properties that may be inherited from its |
michael@0 | 20 | prototype. |
michael@0 | 21 | |
michael@0 | 22 | Author: christine@netscape.com |
michael@0 | 23 | Date: 28 october 1997 |
michael@0 | 24 | |
michael@0 | 25 | */ |
michael@0 | 26 | var SECTION = "15.4-2"; |
michael@0 | 27 | var VERSION = "ECMA_1"; |
michael@0 | 28 | startTest(); |
michael@0 | 29 | var TITLE = "Array Objects"; |
michael@0 | 30 | |
michael@0 | 31 | writeHeaderToLog( SECTION + " "+ TITLE); |
michael@0 | 32 | |
michael@0 | 33 | new TestCase( SECTION, |
michael@0 | 34 | "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", |
michael@0 | 35 | Math.pow(2,16)+1, |
michael@0 | 36 | eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") ); |
michael@0 | 37 | |
michael@0 | 38 | new TestCase( SECTION, |
michael@0 | 39 | "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", |
michael@0 | 40 | Math.pow(2,30)-1, |
michael@0 | 41 | eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") ); |
michael@0 | 42 | |
michael@0 | 43 | new TestCase( SECTION, |
michael@0 | 44 | "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", |
michael@0 | 45 | Math.pow(2,30), |
michael@0 | 46 | eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") ); |
michael@0 | 47 | |
michael@0 | 48 | new TestCase( SECTION, |
michael@0 | 49 | "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", |
michael@0 | 50 | Math.pow(2,30)+1, |
michael@0 | 51 | eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") ); |
michael@0 | 52 | |
michael@0 | 53 | |
michael@0 | 54 | new TestCase( SECTION, |
michael@0 | 55 | "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", |
michael@0 | 56 | Math.pow(2,31)-1, |
michael@0 | 57 | eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") ); |
michael@0 | 58 | |
michael@0 | 59 | new TestCase( SECTION, |
michael@0 | 60 | "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", |
michael@0 | 61 | Math.pow(2,31), |
michael@0 | 62 | eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") ); |
michael@0 | 63 | |
michael@0 | 64 | new TestCase( SECTION, |
michael@0 | 65 | "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", |
michael@0 | 66 | Math.pow(2,31)+1, |
michael@0 | 67 | eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") ); |
michael@0 | 68 | |
michael@0 | 69 | new TestCase( SECTION, |
michael@0 | 70 | "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", |
michael@0 | 71 | "0,1", |
michael@0 | 72 | eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") ); |
michael@0 | 73 | |
michael@0 | 74 | new TestCase( SECTION, |
michael@0 | 75 | "var arr = new Array(0,1); arr.length = 3; String(arr)", |
michael@0 | 76 | "0,1,", |
michael@0 | 77 | eval("var arr = new Array(0,1); arr.length = 3; String(arr)") ); |
michael@0 | 78 | |
michael@0 | 79 | test(); |
michael@0 | 80 |