| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Flags: --expose-debug-as debug | 5 // Flags: --expose-debug-as debug |
| 6 | 6 |
| 7 function static() { | 7 function static() { |
| 8 print("> static"); // Break | 8 print("> static"); // Break |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 exception = e; | 22 exception = e; |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 | 25 |
| 26 Debug.setListener(listener); | 26 Debug.setListener(listener); |
| 27 | 27 |
| 28 function install() { | 28 function install() { |
| 29 eval("this.dynamic = function dynamic() { \n" + | 29 eval("this.dynamic = function dynamic() { \n" + |
| 30 " print(\"> dynamic\"); // Break\n" + | 30 " print(\"> dynamic\"); // Break\n" + |
| 31 "}\n" + | 31 "}\n" + |
| 32 "//@ sourceURL=dynamicScript"); | 32 "//# sourceURL=dynamicScript"); |
| 33 } | 33 } |
| 34 | 34 |
| 35 install(); | 35 install(); |
| 36 | 36 |
| 37 var scripts = Debug.scripts(); | 37 var scripts = Debug.scripts(); |
| 38 var dynamic_script; | 38 var dynamic_script; |
| 39 var static_script; | 39 var static_script; |
| 40 for (var script of scripts) { | 40 for (var script of scripts) { |
| 41 if (script.source_url == "dynamicScript") dynamic_script = script; | 41 if (script.source_url == "dynamicScript") dynamic_script = script; |
| 42 if (script.source_url == "staticScript") static_script = script; | 42 if (script.source_url == "staticScript") static_script = script; |
| 43 } | 43 } |
| 44 | 44 |
| 45 Debug.setScriptBreakPointById(dynamic_script.id, 1); | 45 Debug.setScriptBreakPointById(dynamic_script.id, 1); |
| 46 Debug.setScriptBreakPointById(static_script.id, 7); | 46 Debug.setScriptBreakPointById(static_script.id, 7); |
| 47 | 47 |
| 48 dynamic(); | 48 dynamic(); |
| 49 static(); | 49 static(); |
| 50 | 50 |
| 51 Debug.setListener(null); | 51 Debug.setListener(null); |
| 52 | 52 |
| 53 assertNull(exception); | 53 assertNull(exception); |
| 54 assertEquals(2, break_count); | 54 assertEquals(2, break_count); |
| 55 | 55 |
| 56 //@ sourceURL=staticScript | 56 //# sourceURL=staticScript |
| OLD | NEW |