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 3// found in the LICENSE file. 4 5// Flags: --expose-debug-as debug --min-preparse-length=10 6 7var source = 8 "var foo = function foo() {\n" + 9 " return 1;\n" + 10 "}\n" + 11 "//@ sourceURL=test"; 12 13Debug = debug.Debug; 14Debug.setListener(listener); 15var exception = null; 16var break_count = 0; 17 18function listener(event, exec_state, event_data, data) { 19 if (event == Debug.DebugEvent.Break) break_count++; 20 if (event != Debug.DebugEvent.AfterCompile) return; 21 try { 22 var name = event_data.script().name(); 23 var id = event_data.script().id(); 24 assertEquals("test", name); 25 Debug.setScriptBreakPointById(id, 2); 26 } catch (e) { 27 exception = e; 28 } 29} 30 31eval(source); 32 33assertEquals(0, break_count); 34foo(); 35assertEquals(1, break_count); 36assertNull(exception); 37