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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // Add the debug event listener. | 60 // Add the debug event listener. |
61 Debug.setListener(listener); | 61 Debug.setListener(listener); |
62 result = -1; | 62 result = -1; |
63 f(); | 63 f(); |
64 assertEquals(1, result); | 64 assertEquals(1, result); |
65 | 65 |
66 // Clear breakpoint. | 66 // Clear breakpoint. |
67 Debug.clearBreakPoint(bp); | 67 Debug.clearBreakPoint(bp); |
68 // Get rid of the debug event listener. | 68 // Get rid of the debug event listener. |
69 Debug.setListener(null); | 69 Debug.setListener(null); |
| 70 |
| 71 |
| 72 function f1() { |
| 73 { |
| 74 let i = 1; |
| 75 debugger; |
| 76 assertEquals(2, i); |
| 77 } |
| 78 } |
| 79 |
| 80 function f2() { |
| 81 { |
| 82 let i = 1; |
| 83 debugger; |
| 84 assertEquals(2, i); |
| 85 return function() { return i++; } |
| 86 } |
| 87 } |
| 88 |
| 89 var exception; |
| 90 Debug.setListener(function (event, exec_state, event_data, data) { |
| 91 try { |
| 92 if (event == Debug.DebugEvent.Break) { |
| 93 var frame = exec_state.frame(); |
| 94 assertEquals(1, frame.evaluate("i").value()); |
| 95 var allScopes = frame.allScopes(); |
| 96 assertEquals(1, allScopes[0].scopeObject().value().i); |
| 97 allScopes[0].setVariableValue("i", 2); |
| 98 } |
| 99 } catch (e) { |
| 100 exception = e; |
| 101 } |
| 102 }); |
| 103 |
| 104 exception = null; |
| 105 f1(); |
| 106 assertEquals(null, exception, exception); |
| 107 exception = null; |
| 108 f2(); |
| 109 assertEquals(null, exception, exception); |
OLD | NEW |