|
1 this.name = "outer"; |
|
2 |
|
3 var sb = evalcx(''); |
|
4 sb.name = "inner"; |
|
5 sb.parent = this; |
|
6 |
|
7 var res = 0; |
|
8 |
|
9 function f() { |
|
10 assertEq(this.name, "outer"); |
|
11 res++; |
|
12 } |
|
13 |
|
14 // ff is a property of the inner global object. Generate a CALLNAME IC, then |
|
15 // change ff to a function on the outer global. It should get the inner this |
|
16 // value. |
|
17 evalcx('this.ff = function() {};' + |
|
18 '(function() { ' + |
|
19 'eval("");' + |
|
20 'for(var i=0; i<10; i++) {' + |
|
21 'ff();' + |
|
22 'if (i == 5) ff = parent.f;' + |
|
23 '}' + |
|
24 '})()', sb); |
|
25 assertEq(res, 4); |