OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 30 matching lines...) Expand all Loading... |
41 try { // Line 3. | 41 try { // Line 3. |
42 throw 'stuff'; // Line 4. | 42 throw 'stuff'; // Line 4. |
43 } catch (e) { // Line 5. | 43 } catch (e) { // Line 5. |
44 x = 2; // Line 6. | 44 x = 2; // Line 6. |
45 } | 45 } |
46 } | 46 } |
47 }; | 47 }; |
48 | 48 |
49 // Get the Debug object exposed from the debug context global object. | 49 // Get the Debug object exposed from the debug context global object. |
50 var Debug = debug.Debug | 50 var Debug = debug.Debug |
51 // Set breakpoint on line 6. | |
52 var bp = Debug.setBreakPoint(f, 6); | |
53 | 51 |
54 function listener(event, exec_state, event_data, data) { | 52 function listener(event, exec_state, event_data, data) { |
55 if (event == Debug.DebugEvent.Break) { | 53 if (event == Debug.DebugEvent.Break) { |
56 result = exec_state.frame().evaluate("i").value(); | 54 result = exec_state.frame().evaluate("i").value(); |
57 } | 55 } |
58 }; | 56 }; |
59 | 57 |
60 // Add the debug event listener. | 58 // Add the debug event listener. |
61 Debug.setListener(listener); | 59 Debug.setListener(listener); |
| 60 |
| 61 //Set breakpoint on line 6. |
| 62 var bp = Debug.setBreakPoint(f, 6); |
| 63 |
62 result = -1; | 64 result = -1; |
63 f(); | 65 f(); |
64 assertEquals(1, result); | 66 assertEquals(1, result); |
65 | 67 |
66 // Clear breakpoint. | 68 // Clear breakpoint. |
67 Debug.clearBreakPoint(bp); | 69 Debug.clearBreakPoint(bp); |
68 // Get rid of the debug event listener. | 70 // Get rid of the debug event listener. |
69 Debug.setListener(null); | 71 Debug.setListener(null); |
70 | 72 |
71 | 73 |
(...skipping 28 matching lines...) Expand all Loading... |
100 exception = e; | 102 exception = e; |
101 } | 103 } |
102 }); | 104 }); |
103 | 105 |
104 exception = null; | 106 exception = null; |
105 f1(); | 107 f1(); |
106 assertEquals(null, exception, exception); | 108 assertEquals(null, exception, exception); |
107 exception = null; | 109 exception = null; |
108 f2(); | 110 f2(); |
109 assertEquals(null, exception, exception); | 111 assertEquals(null, exception, exception); |
| 112 |
| 113 Debug.setListener(null); |
OLD | NEW |