mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 10:01:49 +00:00

PR-URL: https://github.com/nodejs/node/pull/38990 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
// Copyright 2016 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(
|
|
'Check that debug and monitor methods from Command Line API works with bound function.');
|
|
|
|
contextGroup.addScript(`
|
|
function foo() {}
|
|
function boo() {}
|
|
var bar = () => boo();
|
|
|
|
function testFunction() {
|
|
console.log("> debug foo and bar");
|
|
debug(foo);
|
|
debug(bar);
|
|
console.log("> call foo and bar");
|
|
foo();
|
|
bar();
|
|
console.log("> undebug foo and bar");
|
|
undebug(foo);
|
|
undebug(bar);
|
|
console.log("> call foo and bar");
|
|
foo();
|
|
bar();
|
|
|
|
console.log("> monitor foo and bar");
|
|
monitor(foo);
|
|
monitor(bar);
|
|
console.log("> call foo and bar");
|
|
foo();
|
|
bar();
|
|
console.log("> unmonitor foo and bar");
|
|
unmonitor(foo);
|
|
unmonitor(bar);
|
|
console.log("> call foo and bar");
|
|
foo();
|
|
bar();
|
|
|
|
console.log("> monitor and debug bar");
|
|
monitor(bar);
|
|
debug(bar);
|
|
console.log("> call bar");
|
|
bar();
|
|
console.log("> undebug bar");
|
|
undebug(bar);
|
|
console.log("> call bar");
|
|
bar();
|
|
console.log("> debug and unmonitor bar");
|
|
debug(bar);
|
|
unmonitor(bar);
|
|
console.log("> call bar");
|
|
bar();
|
|
}`);
|
|
|
|
Protocol.Runtime.enable();
|
|
Protocol.Debugger.enable();
|
|
Protocol.Debugger.onPaused(message => {
|
|
var functionName = message.params.callFrames[0].functionName;
|
|
InspectorTest.log(`paused in ${functionName}`);
|
|
Protocol.Debugger.resume();
|
|
});
|
|
Protocol.Runtime.onConsoleAPICalled(
|
|
message => InspectorTest.log(message.params.args[0].value));
|
|
Protocol.Runtime
|
|
.evaluate({expression: 'testFunction()', includeCommandLineAPI: true})
|
|
.then(InspectorTest.completeTest);
|