2017-01-27 07:31:03 +00:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2018-06-21 14:24:46 +00:00
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
|
2017-01-27 07:31:03 +00:00
|
|
|
Debug = debug.Debug
|
|
|
|
var counter = 0;
|
|
|
|
var exception = null;
|
|
|
|
function f() {
|
|
|
|
if (++counter > 5) return;
|
|
|
|
debugger;
|
|
|
|
return counter;
|
2018-06-21 14:24:46 +00:00
|
|
|
};
|
2017-01-27 07:31:03 +00:00
|
|
|
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
|
|
if (event != Debug.DebugEvent.Break) return;
|
|
|
|
try {
|
|
|
|
var original = 'debugger;';
|
|
|
|
var patch = 'debugger;\n';
|
2018-06-21 14:24:46 +00:00
|
|
|
%LiveEditPatchScript(f, Debug.scriptSource(f).replace(original, patch));
|
2017-01-27 07:31:03 +00:00
|
|
|
} catch (e) {
|
|
|
|
exception = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Debug.setListener(listener);
|
|
|
|
f();
|
|
|
|
Debug.setListener(null);
|
2018-06-07 08:43:44 +00:00
|
|
|
assertNull(exception);
|
2017-01-27 07:31:03 +00:00
|
|
|
assertEquals(6, counter);
|