v8/test/inspector/regress/regress-crbug-1246897.js
Simon Zünd b278b806f1 [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}
2022-11-09 11:09:18 +00:00

28 lines
798 B
JavaScript

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