2017-06-20 09:18:59 +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.
|
|
|
|
|
2017-07-13 00:22:02 +00:00
|
|
|
(function() {
|
2018-06-05 09:49:59 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
createSuite('Debugger.paused', 10000, DebuggerPaused, Setup, TearDown);
|
|
|
|
createSuite(
|
|
|
|
'Debugger.getPossibleBreakpoints', 10000, DebuggerGetPossibleBreakpoints,
|
|
|
|
SetupGetPossibleBreakpoints, TearDown);
|
|
|
|
createSuite(
|
|
|
|
'AsyncStacksInstrumentation', 10000, AsyncStacksInstrumentation,
|
|
|
|
SetupAsyncStacksInstrumentation, TearDown);
|
2017-07-28 21:51:26 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function Setup() {
|
|
|
|
SendMessage('Debugger.enable');
|
|
|
|
// Force lazy compilation of inspector related scripts.
|
|
|
|
SendMessage('Runtime.evaluate', {expression: ''});
|
|
|
|
}
|
2017-06-20 09:18:59 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function TearDown() {
|
|
|
|
SendMessage('Debugger.disable');
|
|
|
|
}
|
2017-06-20 09:18:59 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function DebuggerPaused() {
|
|
|
|
for (var i = 0; i < 10; ++i) {
|
|
|
|
debugger;
|
2017-06-20 09:18:59 +00:00
|
|
|
}
|
2018-05-24 14:26:15 +00:00
|
|
|
}
|
2017-07-28 21:51:26 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
let scriptId;
|
|
|
|
function SetupGetPossibleBreakpoints() {
|
|
|
|
Setup();
|
|
|
|
let expression = '';
|
|
|
|
for (let i = 0; i < 20; ++i) {
|
|
|
|
expression += `function foo${i}(){
|
|
|
|
if (a) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}\n`;
|
2018-06-05 09:49:59 +00:00
|
|
|
};
|
2018-05-24 14:26:15 +00:00
|
|
|
listener = function(msg) {
|
|
|
|
if (msg.method === 'Debugger.scriptParsed') {
|
|
|
|
scriptId = msg.params.scriptId;
|
|
|
|
listener = null;
|
2017-07-28 21:51:26 +00:00
|
|
|
}
|
2018-06-05 09:49:59 +00:00
|
|
|
};
|
|
|
|
SendMessage('Runtime.evaluate', {expression});
|
2018-05-24 14:26:15 +00:00
|
|
|
}
|
2017-07-28 21:51:26 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function DebuggerGetPossibleBreakpoints() {
|
|
|
|
SendMessage(
|
|
|
|
'Debugger.getPossibleBreakpoints',
|
|
|
|
{start: {lineNumber: 0, columnNumber: 0, scriptId: scriptId}});
|
|
|
|
}
|
2017-11-13 16:53:44 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function SetupAsyncStacksInstrumentation() {
|
|
|
|
Setup();
|
|
|
|
SendMessage('Debugger.setAsyncCallStackDepth', {maxDepth: 1024});
|
|
|
|
}
|
2017-11-13 16:53:44 +00:00
|
|
|
|
2018-05-24 14:26:15 +00:00
|
|
|
function AsyncStacksInstrumentation() {
|
|
|
|
var p = Promise.resolve();
|
|
|
|
var nopCallback = () => undefined;
|
|
|
|
var done = false;
|
|
|
|
for (let i = 0; i < 1000; ++i) {
|
|
|
|
p = p.then(nopCallback);
|
2017-11-13 16:53:44 +00:00
|
|
|
}
|
2018-05-24 14:26:15 +00:00
|
|
|
p = p.then(() => done = true);
|
2018-12-04 06:12:49 +00:00
|
|
|
while (!done) %PerformMicrotaskCheckpoint();
|
2018-05-24 14:26:15 +00:00
|
|
|
}
|
2018-06-05 09:49:59 +00:00
|
|
|
|
2017-07-13 00:22:02 +00:00
|
|
|
})();
|