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 | function t1() { |
michael@0 | 2 | assertEq(thisValue, this); |
michael@0 | 3 | } |
michael@0 | 4 | |
michael@0 | 5 | thisValue = {}; |
michael@0 | 6 | var f1 = t1.bind(thisValue); |
michael@0 | 7 | f1() |
michael@0 | 8 | f1() |
michael@0 | 9 | |
michael@0 | 10 | //////////////////////////////////////////////////////////// |
michael@0 | 11 | |
michael@0 | 12 | function t2() { |
michael@0 | 13 | bailout(); |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | var f2 = t2.bind(thisValue); |
michael@0 | 17 | f2() |
michael@0 | 18 | f2() |
michael@0 | 19 | |
michael@0 | 20 | //////////////////////////////////////////////////////////// |
michael@0 | 21 | |
michael@0 | 22 | function test3() { |
michael@0 | 23 | function i3(a,b,c,d) { |
michael@0 | 24 | bailout(); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function t3(a,b,c,d) { |
michael@0 | 28 | i3(a,b,c,d); |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | var f3 = t3.bind(thisValue); |
michael@0 | 32 | for (var i=0;i<10; i++) { |
michael@0 | 33 | f3(1,2,3,4) |
michael@0 | 34 | f3(1,2,3,4) |
michael@0 | 35 | } |
michael@0 | 36 | } |
michael@0 | 37 | test3(); |
michael@0 | 38 | test3(); |
michael@0 | 39 | |
michael@0 | 40 | //////////////////////////////////////////////////////////// |
michael@0 | 41 | |
michael@0 | 42 | function test4() { |
michael@0 | 43 | this.a = 1; |
michael@0 | 44 | var inner = function(a,b,c,d) { |
michael@0 | 45 | bailout(); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | var t = function(a,b,c,d) { |
michael@0 | 49 | assertEq(this.a, undefined); |
michael@0 | 50 | inner(a,b,c,d); |
michael@0 | 51 | assertEq(this.a, undefined); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | var f = t.bind(thisValue); |
michael@0 | 55 | for (var i=0;i<5; i++) { |
michael@0 | 56 | var res = f(1,2,3,4) |
michael@0 | 57 | var res2 = new f(1,2,3,4) |
michael@0 | 58 | assertEq(res, undefined); |
michael@0 | 59 | assertEq(res2 == undefined, false); |
michael@0 | 60 | } |
michael@0 | 61 | } |
michael@0 | 62 | test4(); |
michael@0 | 63 | test4(); |
michael@0 | 64 | |
michael@0 | 65 | //////////////////////////////////////////////////////////// |
michael@0 | 66 | |
michael@0 | 67 | function test5() { |
michael@0 | 68 | this.a = 1; |
michael@0 | 69 | var inner = function(a,b,c,d) { |
michael@0 | 70 | assertEq(a, 1); |
michael@0 | 71 | assertEq(b, 2); |
michael@0 | 72 | assertEq(c, 3); |
michael@0 | 73 | assertEq(d, 1); |
michael@0 | 74 | bailout(); |
michael@0 | 75 | assertEq(a, 1); |
michael@0 | 76 | assertEq(b, 2); |
michael@0 | 77 | assertEq(c, 3); |
michael@0 | 78 | assertEq(d, 1); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | var t = function(a,b,c,d) { |
michael@0 | 82 | inner(a,b,c,d); |
michael@0 | 83 | } |
michael@0 | 84 | |
michael@0 | 85 | var f = t.bind(thisValue, 1,2,3); |
michael@0 | 86 | for (var i=0;i<5; i++) { |
michael@0 | 87 | f(1,2,3,4) |
michael@0 | 88 | } |
michael@0 | 89 | } |
michael@0 | 90 | test5(); |
michael@0 | 91 | test5(); |
michael@0 | 92 | |
michael@0 | 93 | //////////////////////////////////////////////////////////// |
michael@0 | 94 | |
michael@0 | 95 | function test6() { |
michael@0 | 96 | function i6(a,b,c,d) { |
michael@0 | 97 | if (a == 1) |
michael@0 | 98 | bailout(); |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | function t6(a,b,c,d) { |
michael@0 | 102 | i6(a,b,c,d); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | var f6 = t6.bind(thisValue, 1); |
michael@0 | 106 | f6(1,2,3,4) |
michael@0 | 107 | f6(0,2,3,4) |
michael@0 | 108 | } |
michael@0 | 109 | test6(); |
michael@0 | 110 | test6(); |