0aef7a8938
This CL adds a small inspector test to verify that Runtime.evaluate with silent on/off can be interleaved while replMode is true for all evaluations. This is to check that the interaction between console and live expressions works as expected when the user enables "Pause on exceptions". R=bmeurer@chromium.org Bug: chromium:1335439 Change-Id: Iebd3f9f207312dc6dcd3d0b9a8483ef09608528f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3822685 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org> Cr-Commit-Position: refs/heads/main@{#82337}
61 lines
1.9 KiB
JavaScript
61 lines
1.9 KiB
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, Protocol} = InspectorTest.start(
|
|
"Tests that Runtime.evaluate works with REPL mode in silent");
|
|
|
|
session.setupScriptMap();
|
|
|
|
(async function() {
|
|
await Protocol.Runtime.enable();
|
|
await Protocol.Debugger.enable();
|
|
await Protocol.Debugger.setPauseOnExceptions({ state: 'uncaught' });
|
|
|
|
Protocol.Debugger.onPaused(async ({ params: { callFrames, reason } }) => {
|
|
InspectorTest.log(`Paused because of '${reason}' at`);
|
|
await session.logSourceLocation(callFrames[0].location);
|
|
Protocol.Debugger.resume();
|
|
});
|
|
|
|
// First, create an unresolved promise and wait for it in a silent REPL mode
|
|
// evaluation.
|
|
const evalPromise = Protocol.Runtime.evaluate({
|
|
expression: `
|
|
let silentReject;
|
|
await new Promise((r, rej) => { silentReject = rej; });`,
|
|
replMode: true,
|
|
silent: true,
|
|
});
|
|
|
|
// Create two unresolved promises in non-silent REPL mode.
|
|
await Protocol.Runtime.evaluate({
|
|
expression: `
|
|
let loudReject1, loudReject2;
|
|
new Promise((r, rej) => { loudReject1 = rej; });
|
|
new Promise((r, rej) => { loudReject2 = rej; });`,
|
|
replMode: true,
|
|
});
|
|
|
|
// Resolve the first loud promise and expect a pause.
|
|
await Protocol.Runtime.evaluate({
|
|
expression: 'loudReject1(\'Rejecting loud promise 1\')',
|
|
replMode: true,
|
|
});
|
|
|
|
// Resolve the silent promise and expect no pause.
|
|
await Protocol.Runtime.evaluate({
|
|
expression: 'silentReject(\'Rejecting silent promise\')',
|
|
replMode: true,
|
|
});
|
|
InspectorTest.logMessage(await evalPromise);
|
|
|
|
// Resolve the loud promise and expect a pause.
|
|
await Protocol.Runtime.evaluate({
|
|
expression: 'loudReject2(\'Rejecting loud promise 2\')',
|
|
replMode: true,
|
|
});
|
|
|
|
InspectorTest.completeTest();
|
|
})();
|