23c45bf351
This fixes a bug in which CompileTopLevel has a pending exception that is never taken care of. This CL adds a check for the output of CompileTopLevel and clears the pending exceptions if existent. Also-by: bmeurer@chromium.org Bug: chromium:1190290 Change-Id: Ieba537d5af78fc35475f9547c240c70850bea608 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2773346 Commit-Queue: Kim-Anh Tran <kimanh@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#73561}
43 lines
1.4 KiB
JavaScript
43 lines
1.4 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.
|
|
|
|
// Flags: --allow-natives-syntax
|
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start(
|
|
'Checks if we correctly handle exceptions thrown on setBreakpointByUrl if script is invalid.');
|
|
|
|
session.setupScriptMap();
|
|
var executionContextId;
|
|
|
|
const invalidFunction = `console.lo g('This is a top level function')`;
|
|
const moduleFunction =
|
|
`function testFunc() { console.log('This is a module function') }`;
|
|
|
|
Protocol.Debugger.enable().then(onDebuggerEnabled);
|
|
|
|
function onDebuggerEnabled() {
|
|
Protocol.Runtime.enable();
|
|
Protocol.Runtime.onExecutionContextCreated(onExecutionContextCreated);
|
|
}
|
|
|
|
async function onExecutionContextCreated(messageObject) {
|
|
executionContextId = messageObject.params.context.id;
|
|
await testSetBreakpoint(
|
|
executionContextId, invalidFunction, 'invalidFunc.js');
|
|
await testSetBreakpoint(executionContextId, moduleFunction, 'moduleFunc.js');
|
|
InspectorTest.completeTest();
|
|
}
|
|
|
|
async function testSetBreakpoint(executionContextId, func, url) {
|
|
await Protocol.Runtime.compileScript({
|
|
expression: func,
|
|
sourceURL: url,
|
|
persistScript: true,
|
|
executionContextId: executionContextId
|
|
});
|
|
const {result: {locations}} =
|
|
await Protocol.Debugger.setBreakpointByUrl({lineNumber: 0, url});
|
|
InspectorTest.logMessage(locations);
|
|
}
|