OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-debug-as debug | 5 // Flags: --expose-debug-as debug |
6 // Tests stepping into through Array.prototype.forEach callbacks. | 6 // Tests stepping into through Array.prototype.forEach callbacks. |
7 | 7 |
8 Debug = debug.Debug | 8 Debug = debug.Debug |
9 var exception = null; | 9 var exception = null; |
10 var break_count = 0; | 10 var break_count = 0; |
(...skipping 19 matching lines...) Loading... |
30 exec_state.prepareStep(Debug.StepAction.StepIn, 1); | 30 exec_state.prepareStep(Debug.StepAction.StepIn, 1); |
31 } | 31 } |
32 } | 32 } |
33 } catch(e) { | 33 } catch(e) { |
34 exception = e; | 34 exception = e; |
35 print(e, e.stack); | 35 print(e, e.stack); |
36 } | 36 } |
37 }; | 37 }; |
38 | 38 |
39 Debug.setListener(listener); | 39 Debug.setListener(listener); |
| 40 var bound_callback = callback.bind(null); |
40 | 41 |
41 debugger; // Break 0. | 42 debugger; // Break 0. |
42 [1,2].forEach(callback); // Break 1. | 43 [1,2].forEach(callback); // Break 1. |
| 44 [3,4].forEach(bound_callback); // Break 6. |
43 | 45 |
44 function callback(x) { | 46 function callback(x) { |
45 return x; // Break 2. // Break 4. | 47 return x; // Break 2. // Break 4. // Break 7. // Break 9. |
46 } // Break 3. // Break 5. | 48 } // Break 3. // Break 5. // Break 8. // Break 10. |
47 | 49 |
48 assertNull(exception); // Break 6. | 50 assertNull(exception); // Break 11. |
49 assertEquals(expected_breaks, break_count); | 51 assertEquals(expected_breaks, break_count); |
50 | 52 |
51 Debug.setListener(null); | 53 Debug.setListener(null); |
OLD | NEW |