mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 11:36:57 +00:00

PR-URL: https://github.com/nodejs/node/pull/21983 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
58 lines
1.5 KiB
JavaScript
58 lines
1.5 KiB
JavaScript
// Copyright 2018 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.
|
|
|
|
let {session, contextGroup, Protocol} =
|
|
InspectorTest.start('Set breakpoint before function call.');
|
|
|
|
contextGroup.addScript(`
|
|
function static() {
|
|
console.log("> static"); // Break
|
|
}
|
|
|
|
function install() {
|
|
eval("this.dynamic = function dynamic() { \\n" +
|
|
" console.log(\\"> dynamic\\"); // Break\\n" +
|
|
"}\\n" +
|
|
"//# sourceURL=dynamicScript");
|
|
}
|
|
|
|
install();
|
|
//# sourceURL=staticScript`);
|
|
|
|
(async function test() {
|
|
session.setupScriptMap();
|
|
Protocol.Debugger.enable();
|
|
await session.logSourceLocation((await Protocol.Debugger.setBreakpointByUrl({
|
|
url: 'dynamicScript',
|
|
lineNumber: 1
|
|
})).result.locations[0]);
|
|
await session.logSourceLocation((await Protocol.Debugger.setBreakpointByUrl({
|
|
url: 'staticScript',
|
|
lineNumber: 2
|
|
})).result.locations[0]);
|
|
|
|
Protocol.Runtime.evaluate({ expression: 'dynamic(); static();' });
|
|
{
|
|
const {
|
|
params:{
|
|
callFrames:[{location}]
|
|
}
|
|
} = await Protocol.Debugger.oncePaused();
|
|
InspectorTest.log('Paused at:');
|
|
await session.logSourceLocation(location);
|
|
}
|
|
{
|
|
InspectorTest.log('Resume..');
|
|
Protocol.Debugger.resume();
|
|
const {
|
|
params:{
|
|
callFrames:[{location}]
|
|
}
|
|
} = await Protocol.Debugger.oncePaused();
|
|
InspectorTest.log('Paused at:');
|
|
await session.logSourceLocation(location);
|
|
}
|
|
InspectorTest.completeTest();
|
|
})();
|