Commit 0aef7a89 authored by Simon Zünd's avatar Simon Zünd Committed by V8 LUCI CQ

[insepctor] Add test for interaction of replMode and silent in evaluate

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/+/3822685Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82337}
parent 8faef5af
Tests that Runtime.evaluate works with REPL mode in silent
Paused because of 'promiseRejection' at
#loudReject1('Rejecting loud promise 1')
{
id : <messageId>
result : {
exceptionDetails : {
columnNumber : 0
exception : {
type : string
value : Rejecting silent promise
}
exceptionId : <exceptionId>
lineNumber : 0
text : Uncaught
}
result : {
type : string
value : Rejecting silent promise
}
}
}
Paused because of 'promiseRejection' at
#loudReject2('Rejecting loud promise 2')
// 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();
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment