OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 Debug = debug.Debug |
| 6 var counter = 0; |
| 7 var exception = null; |
| 8 |
| 9 function f() { |
| 10 if (++counter > 5) return; |
| 11 debugger; |
| 12 return counter; |
| 13 } |
| 14 |
| 15 function listener(event, exec_state, event_data, data) { |
| 16 if (event != Debug.DebugEvent.Break) return; |
| 17 try { |
| 18 var script = Debug.findScript(f); |
| 19 var original = 'debugger;'; |
| 20 var patch = 'debugger;\n'; |
| 21 var position = script.source.indexOf(original); |
| 22 Debug.LiveEdit.TestApi.ApplySingleChunkPatch( |
| 23 script, position, original.length, patch, []); |
| 24 } catch (e) { |
| 25 exception = e; |
| 26 } |
| 27 } |
| 28 |
| 29 Debug.setListener(listener); |
| 30 f(); |
| 31 Debug.setListener(null); |
| 32 assertNull(exception); |
| 33 assertEquals(6, counter); |
OLD | NEW |