node/deps/v8/test/inspector/debugger/regress-crbug-481896.js
Michaël Zasso 586db2414a
deps: update V8 to 6.9.427.22
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>
2018-09-07 20:59:13 +02:00

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();
})();