OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 23 matching lines...) Expand all Loading... |
34 var state = 1; | 34 var state = 1; |
35 var expected_source_line_text = null; | 35 var expected_source_line_text = null; |
36 var expected_function_name = null; | 36 var expected_function_name = null; |
37 | 37 |
38 // Simple debug event handler which first time will cause 'step in' action | 38 // Simple debug event handler which first time will cause 'step in' action |
39 // and than check that execution is paused inside function | 39 // and than check that execution is paused inside function |
40 // expected_function_name. | 40 // expected_function_name. |
41 function listener(event, exec_state, event_data, data) { | 41 function listener(event, exec_state, event_data, data) { |
42 try { | 42 try { |
43 if (event == Debug.DebugEvent.Break) { | 43 if (event == Debug.DebugEvent.Break) { |
44 if (state == 1) { | 44 if (state == 3) { |
45 exec_state.prepareStep(Debug.StepAction.StepIn, 2); | |
46 state = 2; | |
47 } else if (state == 2) { | |
48 assertEquals(expected_function_name, event_data.func().name()); | 45 assertEquals(expected_function_name, event_data.func().name()); |
49 assertEquals(expected_source_line_text, | 46 assertEquals(expected_source_line_text, |
50 event_data.sourceLineText()); | 47 event_data.sourceLineText()); |
51 state = 3; | 48 state = 4; |
| 49 } else { |
| 50 exec_state.prepareStep(Debug.StepAction.StepIn); |
| 51 state++; |
52 } | 52 } |
53 } | 53 } |
54 } catch(e) { | 54 } catch(e) { |
55 exception = e; | 55 exception = e; |
56 } | 56 } |
57 }; | 57 }; |
58 | 58 |
59 // Add the debug event listener. | 59 // Add the debug event listener. |
60 Debug.setListener(listener); | 60 Debug.setListener(listener); |
61 | 61 |
62 var a = [1,2,3,4,5]; | 62 var a = [1,2,3,4,5]; |
63 | 63 |
64 // Test step into function call from a function without local variables. | 64 // Test step into function call from a function without local variables. |
65 function testStepInArraySlice() { | 65 function testStepInArraySlice() { |
66 expected_function_name = 'testStepInArraySlice'; | 66 expected_function_name = 'testStepInArraySlice'; |
67 expected_source_line_text = '} // expected line'; | 67 expected_source_line_text = '} // expected line'; |
68 debugger; | 68 debugger; |
69 var s = Array.prototype.slice.call(a, 2,3); | 69 var s = Array.prototype.slice.call(a, 2,3); |
70 } // expected line | 70 } // expected line |
71 | 71 |
72 state = 1; | 72 state = 1; |
73 testStepInArraySlice(); | 73 testStepInArraySlice(); |
74 assertNull(exception); | 74 assertNull(exception); |
75 assertEquals(3, state); | 75 assertEquals(4, state); |
76 | 76 |
77 // Get rid of the debug event listener. | 77 // Get rid of the debug event listener. |
78 Debug.setListener(null); | 78 Debug.setListener(null); |
OLD | NEW |