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 | // vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 2 | |
michael@0 | 3 | function testBadSetElems(obj, key) { |
michael@0 | 4 | obj[key] = 5; |
michael@0 | 5 | obj[-1] = 5; |
michael@0 | 6 | var L = obj; |
michael@0 | 7 | L[L] = L; |
michael@0 | 8 | obj = []; |
michael@0 | 9 | obj.K = 5; |
michael@0 | 10 | obj[2] = 5; |
michael@0 | 11 | var T = "a"; |
michael@0 | 12 | obj[T] = 12; |
michael@0 | 13 | obj = []; |
michael@0 | 14 | obj[Object] = key; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | function testDenseSets(L) { |
michael@0 | 18 | var obj = [,,,,,,,,,,]; |
michael@0 | 19 | obj[2] = 2; |
michael@0 | 20 | assertEq(obj[2], 2); |
michael@0 | 21 | var T = L; |
michael@0 | 22 | assertEq(obj[T], 2); |
michael@0 | 23 | assertEq(obj.length, 10); |
michael@0 | 24 | obj[10] = T; |
michael@0 | 25 | assertEq(obj[10], T); |
michael@0 | 26 | assertEq(obj.length, 11); |
michael@0 | 27 | var K = T + 9; |
michael@0 | 28 | obj[K] = K; |
michael@0 | 29 | assertEq(obj[K], K); |
michael@0 | 30 | assertEq(obj.length, 12); |
michael@0 | 31 | obj[K + 1] = obj; |
michael@0 | 32 | assertEq(obj[K + 1], obj); |
michael@0 | 33 | assertEq(obj.length, 13); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | for (var i = 0; i < 10; i++) { |
michael@0 | 37 | testBadSetElems([], -1); |
michael@0 | 38 | testDenseSets(2); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 |