js/src/tests/ecma_5/strict/regress-599159.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     3 /*
     4  * Any copyright is dedicated to the Public Domain.
     5  * http://creativecommons.org/licenses/publicdomain/
     6  */
     8 // Shu's test
     9 function test(makeNonArray) {
    10     function C() {}
    11     C.prototype = []
    12     if (makeNonArray)
    13         C.prototype.constructor = C
    14     c = new C();
    15     c.push("foo");
    16     return c.length
    17 }
    18 assertEq(test(true), 1);
    19 assertEq(test(false), 1);
    21 // jorendorff's longer test
    22 var a = [];
    23 a.slowify = 1;
    24 var b = Object.create(a);
    25 b.length = 12;
    26 assertEq(b.length, 12);
    28 // jorendorff's shorter test
    29 var b = Object.create(Array.prototype);
    30 b.length = 12;
    31 assertEq(b.length, 12);
    33 reportCompare(true, true);

mercurial