js/src/tests/ecma/Array/15.4.5.2-1.js

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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:          15.4.5.2-1.js
     9    ECMA Section:       Array.length
    10    Description:
    11    15.4.5.2 length
    12    The length property of this Array object is always numerically greater
    13    than the name of every property whose name is an array index.
    15    The length property has the attributes { DontEnum, DontDelete }.
    16    Author:             christine@netscape.com
    17    Date:               12 november 1997
    18 */
    20 var SECTION = "15.4.5.2-1";
    21 var VERSION = "ECMA_1";
    22 startTest();
    23 var TITLE   = "Array.length";
    25 writeHeaderToLog( SECTION + " "+ TITLE);
    27 new TestCase(   SECTION,
    28 		"var A = new Array(); A.length",
    29 		0,
    30 		eval("var A = new Array(); A.length") );
    31 new TestCase(   SECTION,
    32 		"var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
    33 		Math.pow(2,32)-1,
    34 		eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
    35 new TestCase(   SECTION,
    36 		"var A = new Array(); A.length = 123; A.length",
    37 		123,
    38 		eval("var A = new Array(); A.length = 123; A.length") );
    39 new TestCase(   SECTION,
    40 		"var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
    41 		"",
    42 		eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
    43 new TestCase(   SECTION,
    44 		"var A = new Array(); A.length = 123; delete A.length",
    45 		false ,
    46 		eval("var A = new Array(); A.length = 123; delete A.length") );
    47 new TestCase(   SECTION,
    48 		"var A = new Array(); A.length = 123; delete A.length; A.length",
    49 		123,
    50 		eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
    51 test();

mercurial