[inspector] Add regression test for hoisting and debug-evaluate

This CL adds a regression test for sloppy block function hoisting and
debug-evaluate. This was fixed in the past but the test was missing.

Fixed: chromium:1246897
Change-Id: I1d7dcbd4d95ef8e5a09f09615de017b65c3e7087
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4011039
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#84141}
This commit is contained in:
Simon Zünd 2022-11-08 08:18:11 +01:00 committed by V8 LUCI CQ
parent 97aebdc551
commit b278b806f1
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,7 @@
Test that sloppy function block hoisting works with debug-evaluate.
Paused on debugger statement
{
result : {
type : undefined
}
}

View File

@ -0,0 +1,27 @@
// Copyright 2022 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(
'Test that sloppy function block hoisting works with debug-evaluate.');
(async () => {
await Protocol.Debugger.enable();
Protocol.Runtime.evaluate({
expression: `debugger`,
replMode: true,
});
const {params: { callFrames: [{callFrameId}]}} = await Protocol.Debugger.oncePaused();
InspectorTest.log('Paused on debugger statement');
const { result } = await Protocol.Debugger.evaluateOnCallFrame({
expression: '{ function f() {f} }; f();',
callFrameId,
});
InspectorTest.logMessage(result);
InspectorTest.completeTest();
})();