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 | |
michael@0 | 2 | // aaa is initially undefined. Make sure it's set to the |
michael@0 | 3 | // correct value - we have to store the type tag, even though |
michael@0 | 4 | // its known type is int32. |
michael@0 | 5 | var aaa; |
michael@0 | 6 | function f() { |
michael@0 | 7 | function g(x) { |
michael@0 | 8 | if (x) |
michael@0 | 9 | aaa = 22; |
michael@0 | 10 | } |
michael@0 | 11 | g(10); |
michael@0 | 12 | |
michael@0 | 13 | function h() { |
michael@0 | 14 | aaa = 22; |
michael@0 | 15 | } |
michael@0 | 16 | for (var i=0; i<70; i++) { |
michael@0 | 17 | h(); |
michael@0 | 18 | } |
michael@0 | 19 | assertEq(aaa, 22); |
michael@0 | 20 | } |
michael@0 | 21 | f(); |
michael@0 | 22 | |
michael@0 | 23 | x = 0; |
michael@0 | 24 | function setX(i) { |
michael@0 | 25 | x = i; |
michael@0 | 26 | } |
michael@0 | 27 | for (var i=0; i<70; i++) |
michael@0 | 28 | setX(i); |
michael@0 | 29 | assertEq(x, 69); |
michael@0 | 30 | |
michael@0 | 31 | y = 3.14; |
michael@0 | 32 | y = true; |
michael@0 | 33 | y = []; |
michael@0 | 34 | function setY(arg) { |
michael@0 | 35 | y = arg; |
michael@0 | 36 | } |
michael@0 | 37 | for (var i=0; i<70; i++) |
michael@0 | 38 | setY([1]); |
michael@0 | 39 | setY([1, 2, 3]); |
michael@0 | 40 | assertEq(y.length, 3); |
michael@0 | 41 | |
michael@0 | 42 | // z is non-configurable, but can be made non-writable. |
michael@0 | 43 | var z = 10; |
michael@0 | 44 | |
michael@0 | 45 | function testNonWritable() { |
michael@0 | 46 | function g() { |
michael@0 | 47 | z = 11; |
michael@0 | 48 | } |
michael@0 | 49 | for (var i=0; i<70; i++) { |
michael@0 | 50 | g(); |
michael@0 | 51 | } |
michael@0 | 52 | Object.defineProperty(this, "z", {value: 1234, writable: false}); |
michael@0 | 53 | g(); |
michael@0 | 54 | assertEq(z, 1234); |
michael@0 | 55 | } |
michael@0 | 56 | testNonWritable(); |