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 { |
42 return eval('(' + code + ')'); | 43 muteListener = true; |
yurys
2014/12/08 14:31:22
try/finally
kozy
2014/12/08 14:53:01
Done.
| |
44 var result = eval('(' + code + ')'); | |
45 muteListener = false; | |
46 return result; | |
43 } catch (e) { | 47 } catch (e) { |
44 assertEquals(void 0, e); | 48 assertEquals(void 0, e); |
49 muteListener = false; | |
45 return undefined; | 50 return undefined; |
46 } | 51 } |
47 } | 52 } |
48 | 53 |
49 function testArguments(dcp, arguments, success) { | 54 function testArguments(dcp, arguments, success) { |
50 var request = '{' + base_request + ',"arguments":' + arguments + '}' | 55 var request = '{' + base_request + ',"arguments":' + arguments + '}' |
51 var json_response = dcp.processDebugJSONRequest(request); | 56 var json_response = dcp.processDebugJSONRequest(request); |
52 var response = safeEval(json_response); | 57 var response = safeEval(json_response); |
53 if (success) { | 58 if (success) { |
54 assertTrue(response.success, json_response); | 59 assertTrue(response.success, json_response); |
55 } else { | 60 } else { |
56 assertFalse(response.success, json_response); | 61 assertFalse(response.success, json_response); |
57 } | 62 } |
58 } | 63 } |
59 | 64 |
60 function listener(event, exec_state, event_data, data) { | 65 function listener(event, exec_state, event_data, data) { |
66 if (muteListener) return; | |
61 try { | 67 try { |
62 if (event == Debug.DebugEvent.Break) { | 68 if (event == Debug.DebugEvent.Break) { |
63 // Get the debug command processor. | 69 // Get the debug command processor. |
64 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); | 70 var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); |
65 | 71 |
66 // Clear breakpoint group 1. | 72 // Clear breakpoint group 1. |
67 testArguments(dcp, '{"groupId":1}', true); | 73 testArguments(dcp, '{"groupId":1}', true); |
68 | 74 |
69 // Indicate that all was processed. | 75 // Indicate that all was processed. |
70 listenerComplete = true; | 76 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 | 120 // Check that all breakpoints from group 1 were deleted and all the |
115 // rest are preserved. | 121 // rest are preserved. |
116 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); | 122 assertEquals([bp2, bp3, bp5].sort(), breakpointNumbers.sort()); |
117 | 123 |
118 assertFalse(exception, "exception in listener"); | 124 assertFalse(exception, "exception in listener"); |
119 | 125 |
120 // Clear all breakpoints to allow the test to run again (--stress-opt). | 126 // Clear all breakpoints to allow the test to run again (--stress-opt). |
121 Debug.clearBreakPoint(bp2); | 127 Debug.clearBreakPoint(bp2); |
122 Debug.clearBreakPoint(bp3); | 128 Debug.clearBreakPoint(bp3); |
123 Debug.clearBreakPoint(bp5); | 129 Debug.clearBreakPoint(bp5); |
OLD | NEW |