OLD | NEW |
1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 18 matching lines...) Expand all Loading... |
29 // Flags: --turbo-deoptimization | 29 // Flags: --turbo-deoptimization |
30 // Get the Debug object exposed from the debug context global object. | 30 // Get the Debug object exposed from the debug context global object. |
31 var Debug = debug.Debug | 31 var Debug = debug.Debug |
32 | 32 |
33 // Simple function which stores the last debug event. | 33 // Simple function which stores the last debug event. |
34 var listenerComplete = false; | 34 var listenerComplete = false; |
35 var exception = false; | 35 var exception = false; |
36 | 36 |
37 var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; | 37 var base_request = '"seq":0,"type":"request","command":"clearbreakpointgroup"'; |
38 var scriptId = null; | 38 var scriptId = null; |
| 39 var muteListener = false; |
39 | 40 |
40 function safeEval(code) { | 41 function safeEval(code) { |
41 try { | 42 try { |
| 43 muteListener = true; |
42 return eval('(' + code + ')'); | 44 return eval('(' + code + ')'); |
43 } catch (e) { | 45 } catch (e) { |
44 assertEquals(void 0, e); | 46 assertEquals(void 0, e); |
45 return undefined; | 47 return undefined; |
| 48 } finally { |
| 49 muteListener = false; |
46 } | 50 } |
47 } | 51 } |
48 | 52 |
49 function testArguments(dcp, arguments, success) { | 53 function testArguments(dcp, arguments, success) { |
50 var request = '{' + base_request + ',"arguments":' + arguments + '}' | 54 var request = '{' + base_request + ',"arguments":' + arguments + '}' |
51 var json_response = dcp.processDebugJSONRequest(request); | 55 var json_response = dcp.processDebugJSONRequest(request); |
52 var response = safeEval(json_response); | 56 var response = safeEval(json_response); |
53 if (success) { | 57 if (success) { |
54 assertTrue(response.success, json_response); | 58 assertTrue(response.success, json_response); |
55 } else { | 59 } else { |
56 assertFalse(response.success, json_response); | 60 assertFalse(response.success, json_response); |
57 } | 61 } |
58 } | 62 } |
59 | 63 |
60 function listener(event, exec_state, event_data, data) { | 64 function listener(event, exec_state, event_data, data) { |
| 65 if (muteListener) return; |
61 try { | 66 try { |
62 if (event == Debug.DebugEvent.Break) { | 67 if (event == Debug.DebugEvent.Break) { |
63 // Get the debug command processor. | 68 // Get the debug command processor. |
64 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); | 69 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
65 | 70 |
66 // Clear breakpoint group 1. | 71 // Clear breakpoint group 1. |
67 testArguments(dcp, '{"groupId":1}', true); | 72 testArguments(dcp, '{"groupId":1}', true); |
68 | 73 |
69 // Indicate that all was processed. | 74 // Indicate that all was processed. |
70 listenerComplete = true; | 75 listenerComplete = true; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Check that all breakpoints from group 1 were deleted and all the | 119 // Check that all breakpoints from group 1 were deleted and all the |
115 // rest are preserved. | 120 // rest are preserved. |
116 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); | 121 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); |
117 | 122 |
118 assertFalse(exception, "exception in listener"); | 123 assertFalse(exception, "exception in listener"); |
119 | 124 |
120 // Clear all breakpoints to allow the test to run again (--stress-opt). | 125 // Clear all breakpoints to allow the test to run again (--stress-opt). |
121 Debug.clearBreakPoint(bp2); | 126 Debug.clearBreakPoint(bp2); |
122 Debug.clearBreakPoint(bp3); | 127 Debug.clearBreakPoint(bp3); |
123 Debug.clearBreakPoint(bp5); | 128 Debug.clearBreakPoint(bp5); |
OLD | NEW |