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 | |
michael@0 | 3 | /* |
michael@0 | 4 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 5 | * http://creativecommons.org/licenses/publicdomain/ |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | // Shu's test |
michael@0 | 9 | function test(makeNonArray) { |
michael@0 | 10 | function C() {} |
michael@0 | 11 | C.prototype = [] |
michael@0 | 12 | if (makeNonArray) |
michael@0 | 13 | C.prototype.constructor = C |
michael@0 | 14 | c = new C(); |
michael@0 | 15 | c.push("foo"); |
michael@0 | 16 | return c.length |
michael@0 | 17 | } |
michael@0 | 18 | assertEq(test(true), 1); |
michael@0 | 19 | assertEq(test(false), 1); |
michael@0 | 20 | |
michael@0 | 21 | // jorendorff's longer test |
michael@0 | 22 | var a = []; |
michael@0 | 23 | a.slowify = 1; |
michael@0 | 24 | var b = Object.create(a); |
michael@0 | 25 | b.length = 12; |
michael@0 | 26 | assertEq(b.length, 12); |
michael@0 | 27 | |
michael@0 | 28 | // jorendorff's shorter test |
michael@0 | 29 | var b = Object.create(Array.prototype); |
michael@0 | 30 | b.length = 12; |
michael@0 | 31 | assertEq(b.length, 12); |
michael@0 | 32 | |
michael@0 | 33 | reportCompare(true, true); |