v8/test/inspector/debugger/debugger-statement.js
Kim-Anh Tran ccbe3217fa [debugger] Report hit breakpoints when stopping at a debugger statement
Previously when hitting a debugger statement we would ignore reporting
the hit breakpoints.

Bug: chromium:1229541, chromium:1133307
Change-Id: I47427a541391a27fc7783930e5e7eb41fbf2bb6a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3306373
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Kim-Anh Tran <kimanh@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78145}
2021-11-30 06:00:38 +00:00

27 lines
1.1 KiB
JavaScript

// Copyright 2021 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.
const {session, contextGroup, Protocol} = InspectorTest.start(
`Tests that pauses due to debugger statements and breakpoints report the hit breakpoint`);
InspectorTest.runAsyncTestSuite([async function testDebuggerStatement() {
await Protocol.Debugger.enable();
await Protocol.Runtime.enable();
const {result: {scriptId}} = await Protocol.Runtime.compileScript(
{expression: `debugger;`, sourceURL: 'foo.js', persistScript: true});
await Protocol.Debugger.setBreakpointByUrl({
lineNumber: 0,
url: 'foo.js',
});
const runPromise = Protocol.Runtime.runScript({scriptId});
let {params: {reason, hitBreakpoints}} = await Protocol.Debugger.oncePaused();
InspectorTest.log(
`Paused with reason ${reason} and hit breakpoints: ${hitBreakpoints}.`);
await Protocol.Debugger.resume();
await runPromise;
await Protocol.Debugger.disable();
await Protocol.Runtime.disable();
}]);