Commit a81e8d16 authored by Benedikt Meurer's avatar Benedikt Meurer Committed by V8 LUCI CQ

[inspector] Correct location for inline scripts with sourceURL.

Previously the `Debugger.CallFrame`s in `Debugger.paused` events would
report locations relative to the surrounding document in case of inline
scripts with `//@ sourceURL` annotations (while `Runtime.CallFrame` was
already fixed previously as part of crrev.com/c/3069289). With this CL
the locations in `Debugger.CallFrame` are also appropriately adjusted.

Drive-by-fix: Several inspector tests were (incorrectly) relying on this
wrong treatment, and were also unnecessarily using //# sourceURL
annotations. So part of this CL also addresses that problem and makes
the tests more robust, using addInlineScript() helper.

Fixed: chromium:1283049
Bug: chromium:1183990, chromium:578269
Change-Id: I6e3b215d951c3453c0a9cfc9bccf3dc3d5e92fd6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3359619
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78450}
parent 09dc239a
......@@ -505,6 +505,10 @@ Location Script::GetSourceLocation(int offset) const {
i::Handle<i::Script> script = Utils::OpenHandle(this);
i::Script::PositionInfo info;
i::Script::GetPositionInfo(script, offset, &info, i::Script::WITH_OFFSET);
if (script->HasSourceURLComment()) {
info.line -= script->line_offset();
if (info.line == 0) info.column -= script->column_offset();
}
return Location(info.line, info.column);
}
......
......@@ -9,12 +9,12 @@ test (test.js:21:2)
foo (test.js:10:2)
-- Promise.then --
test (test.js:12:14)
test (test.js:19:14)
(anonymous) (expr1.js:0:0)
foo (test.js:12:2)
-- Promise.then --
test (test.js:12:14)
test (test.js:19:14)
(anonymous) (expr1.js:0:0)
......
......@@ -4,7 +4,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks async instrumentation enabled in the middle.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function foo() {
// asyncTaskStarted
debugger;
......@@ -20,9 +21,8 @@ function test() {
resolve1(); // asyncTaskScheduled
debugger;
return p2;
}
//# sourceURL=test.js`, 7, 26);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
Checks async stack for late .then handlers with gc
foo1 (test.js:11:2)
-- Promise.then --
test (test.js:10:14)
test (test.js:18:14)
(anonymous) (expr.js:0:0)
foo1 (test.js:11:2)
-- Promise.then --
test (test.js:14:14)
test (test.js:22:14)
(anonymous) (expr.js:0:0)
foo1 (test.js:11:2)
-- Promise.then --
test (test.js:16:14)
test (test.js:24:14)
(anonymous) (expr.js:0:0)
......@@ -5,7 +5,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks async stack for late .then handlers with gc');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function foo1() {
gc();
debugger;
......@@ -24,8 +25,8 @@ function test() {
var p4 = p1.then(foo1);
gc();
return Promise.all([p2,p3,p4]);
}
//# sourceURL=test.js`, 8, 26);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -2,10 +2,10 @@ Checks that async stack contains setTimeout
inner1 (test.js:11:4)
foo1 (test.js:14:2)
-- setTimeout --
inner2 (test.js:11:4)
foo2 (test.js:13:2)
inner2 (test.js:18:4)
foo2 (test.js:20:2)
-- setTimeout --
inner3 (test.js:18:4)
foo3 (test.js:20:2)
inner3 (test.js:25:4)
foo3 (test.js:27:2)
(anonymous) (expr.js:0:0)
......@@ -4,7 +4,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async stack contains setTimeout');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
var resolveCallback;
function foo1() {
function inner1() {
......@@ -26,8 +27,8 @@ function foo3() {
}
inner3();
return promise;
}
//# sourceURL=test.js`, 7, 26);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -3,78 +3,78 @@ Checks created frame for async call chain
Running test: testPromise
foo1 (test.js:10:2)
-- Promise.then --
promise (test.js:12:14)
promise (test.js:20:14)
(anonymous) (expr.js:0:0)
Running test: testPromiseThen
foo1 (test.js:10:2)
-- Promise.then --
promiseThen (test.js:20:14)
promiseThen (test.js:28:14)
(anonymous) (expr.js:0:0)
foo2 (test.js:14:2)
-- Promise.then --
promiseThen (test.js:21:14)
promiseThen (test.js:29:14)
(anonymous) (expr.js:0:0)
Running test: testPromiseThenThen
foo1 (test.js:10:2)
-- Promise.then --
promiseThenThen (test.js:29:14)
promiseThenThen (test.js:37:14)
(anonymous) (expr.js:0:0)
foo1 (test.js:10:2)
-- Promise.then --
promiseThenThen (test.js:30:14)
promiseThenThen (test.js:38:14)
(anonymous) (expr.js:0:0)
foo2 (test.js:14:2)
-- Promise.then --
promiseThenThen (test.js:29:25)
promiseThenThen (test.js:37:25)
(anonymous) (expr.js:0:0)
Running test: testPromiseResolve
foo1 (test.js:10:2)
-- Promise.then --
promiseResolve (test.js:36:27)
promiseResolve (test.js:44:27)
(anonymous) (expr.js:0:0)
Running test: testPromiseReject
foo1 (test.js:10:2)
-- Promise.catch --
promiseReject (test.js:40:31)
promiseReject (test.js:48:31)
(anonymous) (expr.js:0:0)
Running test: testPromiseAll
foo1 (test.js:10:2)
-- Promise.then --
promiseAll (test.js:44:44)
promiseAll (test.js:52:44)
(anonymous) (expr.js:0:0)
Running test: testPromiseRace
foo1 (test.js:10:2)
-- Promise.then --
promiseRace (test.js:48:45)
promiseRace (test.js:56:45)
(anonymous) (expr.js:0:0)
Running test: testThenableJob1
foo1 (test.js:10:2)
-- Promise.then --
thenableJob1 (test.js:52:72)
thenableJob1 (test.js:60:72)
(anonymous) (expr.js:0:0)
Running test: testThenableJob2
foo1 (test.js:10:2)
-- Promise.then --
thenableJob2 (test.js:56:57)
thenableJob2 (test.js:64:57)
(anonymous) (expr.js:0:0)
......@@ -82,10 +82,10 @@ Running test: testSetTimeouts
foo1 (test.js:10:2)
(anonymous) (test.js:72:25)
-- setTimeout --
(anonymous) (test.js:64:6)
(anonymous) (test.js:72:6)
-- setTimeout --
(anonymous) (test.js:63:4)
(anonymous) (test.js:71:4)
-- setTimeout --
setTimeouts (test.js:62:2)
setTimeouts (test.js:70:2)
(anonymous) (expr.js:0:0)
......@@ -5,7 +5,7 @@
// TODO(kozyatinskiy): fix this test.
let {session, contextGroup, Protocol} = InspectorTest.start('Checks created frame for async call chain');
contextGroup.addScript(
contextGroup.addInlineScript(
`
function foo1() {
debugger;
......@@ -72,10 +72,8 @@ function setTimeouts() {
setTimeout(() =>
setTimeout(() => { foo1(); resolve(); }, 0), 0), 0);
return p;
}
//# sourceURL=test.js`,
8, 4);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -3,94 +3,94 @@ Checks that async chains for promises are correct.
Running test: testPromise
foo1 (test.js:9:2)
-- Promise.then --
promise (test.js:12:14)
promise (test.js:19:14)
(anonymous) (testPromise.js:0:0)
Running test: testPromiseResolvedBySetTimeout
foo1 (test.js:9:2)
-- Promise.then --
promiseResolvedBySetTimeout (test.js:20:14)
promiseResolvedBySetTimeout (test.js:27:14)
(anonymous) (testPromiseResolvedBySetTimeout.js:0:0)
Running test: testPromiseAll
foo1 (test.js:9:2)
-- Promise.then --
promiseAll (test.js:30:35)
promiseAll (test.js:37:35)
(anonymous) (testPromiseAll.js:0:0)
Running test: testPromiseAllReverseOrder
foo1 (test.js:9:2)
-- Promise.then --
promiseAllReverseOrder (test.js:41:35)
promiseAllReverseOrder (test.js:48:35)
(anonymous) (testPromiseAllReverseOrder.js:0:0)
Running test: testPromiseRace
foo1 (test.js:9:2)
-- Promise.then --
promiseRace (test.js:52:36)
promiseRace (test.js:59:36)
(anonymous) (testPromiseRace.js:0:0)
Running test: testTwoChainedCallbacks
foo1 (test.js:9:2)
-- Promise.then --
twoChainedCallbacks (test.js:61:14)
twoChainedCallbacks (test.js:68:14)
(anonymous) (testTwoChainedCallbacks.js:0:0)
foo2 (test.js:13:2)
-- Promise.then --
twoChainedCallbacks (test.js:61:25)
twoChainedCallbacks (test.js:68:25)
(anonymous) (testTwoChainedCallbacks.js:0:0)
Running test: testPromiseResolve
foo1 (test.js:9:2)
-- Promise.then --
promiseResolve (test.js:67:27)
promiseResolve (test.js:74:27)
(anonymous) (testPromiseResolve.js:0:0)
foo2 (test.js:13:2)
-- Promise.then --
promiseResolve (test.js:67:38)
promiseResolve (test.js:74:38)
(anonymous) (testPromiseResolve.js:0:0)
Running test: testThenableJobResolvedInSetTimeout
foo1 (test.js:9:2)
-- Promise.then --
thenableJobResolvedInSetTimeout (test.js:79:40)
thenableJobResolvedInSetTimeout (test.js:86:40)
(anonymous) (testThenableJobResolvedInSetTimeout.js:0:0)
Running test: testThenableJobResolvedInSetTimeoutWithStack
foo1 (test.js:9:2)
-- Promise.then --
thenableJobResolvedInSetTimeoutWithStack (test.js:97:40)
thenableJobResolvedInSetTimeoutWithStack (test.js:104:40)
(anonymous) (testThenableJobResolvedInSetTimeoutWithStack.js:0:0)
Running test: testThenableJobResolvedByPromise
foo1 (test.js:9:2)
-- Promise.then --
thenableJobResolvedByPromise (test.js:111:40)
thenableJobResolvedByPromise (test.js:118:40)
(anonymous) (testThenableJobResolvedByPromise.js:0:0)
Running test: testThenableJobResolvedByPromiseWithStack
foo1 (test.js:9:2)
-- Promise.then --
thenableJobResolvedByPromiseWithStack (test.js:129:40)
thenableJobResolvedByPromiseWithStack (test.js:136:40)
(anonymous) (testThenableJobResolvedByPromiseWithStack.js:0:0)
Running test: testLateThenCallback
foo1 (test.js:9:2)
-- Promise.then --
lateThenCallback (test.js:138:12)
lateThenCallback (test.js:145:12)
(anonymous) (testLateThenCallback.js:0:0)
......@@ -98,36 +98,36 @@ Running test: testComplex
inner1 (test.js:154:6)
foo1 (test.js:156:4)
-- Promise.then --
complex (test.js:195:5)
complex (test.js:202:5)
(anonymous) (testComplex.js:0:0)
(anonymous) (test.js:207:8)
-- Promise.then --
(anonymous) (test.js:199:8)
(anonymous) (test.js:206:8)
-- Promise.then --
(anonymous) (test.js:198:6)
(anonymous) (test.js:205:6)
-- setTimeout --
complex (test.js:197:2)
complex (test.js:204:2)
(anonymous) (testComplex.js:0:0)
Running test: testReject
foo1 (test.js:9:2)
-- Promise.catch --
reject (test.js:210:31)
reject (test.js:217:31)
(anonymous) (testReject.js:0:0)
Running test: testFinally1
foo1 (test.js:9:2)
-- Promise.finally --
finally1 (test.js:214:33)
finally1 (test.js:221:33)
(anonymous) (testFinally1.js:0:0)
Running test: testFinally2
foo1 (test.js:9:2)
-- Promise.finally --
finally2 (test.js:218:34)
finally2 (test.js:225:34)
(anonymous) (testFinally2.js:0:0)
......@@ -4,7 +4,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks that async chains for promises are correct.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function foo1() {
debugger;
}
......@@ -223,8 +224,8 @@ function finally1() {
function finally2() {
return Promise.resolve().finally(foo1);
}
//# sourceURL=test.js`, 7, 26);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -8,9 +8,9 @@ asyncFact (test.js:9:2)
asyncFact (test.js:11:2)
-- await --
asyncFact (test.js:3:20)
asyncFact (test.js:3:20)
asyncFact (test.js:3:20)
asyncFact (test.js:10:20)
asyncFact (test.js:10:20)
asyncFact (test.js:10:20)
(anonymous) (expr.js:0:0)
......
......@@ -4,7 +4,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Check that continue-to-location works with different strategies.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
async function asyncFact(n) {
if (n == 0) return 1;
let r = n * await asyncFact(n - 1);
......@@ -20,15 +21,18 @@ function fact(n) {
}
function topLevel() {
eval(` + '`' + `
eval(` +
'`' +
`
var a = 1;
var b = 2;
fact(3);
console.log(a + b);
` + '`' + `);
}
//# sourceURL=test.js`, 7, 26);
` +
'`' +
`);
}`,
'test.js');
session.setupScriptMap();
InspectorTest.runAsyncTestSuite([
......
......@@ -20,7 +20,7 @@ throwUncaughtError (framework.js:21:2)
Running test: testUncaughtExceptionWithInlinedFrame
> mixed top frame in framework:
throwUserException (user.js:66:2)
throwUserException (user.js:76:2)
inlinedWrapper (framework.js:56:4)
throwInlinedUncaughtError (framework.js:60:2)
(anonymous) (framework.js:0:0)
......@@ -50,7 +50,7 @@ syncDOMBreakpoint (framework.js:33:12)
Running test: testSyncDOMBreakpointWithInlinedUserFrame
> mixed, top frame in framework:
syncDOMBreakpoint (framework.js:33:12)
userFunction (user.js:70:2)
userFunction (user.js:80:2)
inlinedWrapper (framework.js:65:4)
syncDOMBreakpointWithInlinedUserFrame (framework.js:69:2)
(anonymous) (framework.js:0:0)
......
......@@ -5,7 +5,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks that breaks in framework code correctly processed.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function frameworkAssert() {
console.assert(false);
}
......@@ -67,20 +68,19 @@ function syncDOMBreakpointWithInlinedUserFrame() {
%PrepareFunctionForOptimization(inlinedWrapper);
%OptimizeFunctionOnNextCall(inlinedWrapper);
inlinedWrapper();
}
//# sourceURL=framework.js`, 8, 26);
}`,
'framework.js');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function throwUserException() {
throw new Error();
}
function userFunction() {
syncDOMBreakpoint();
}
//# sourceURL=user.js`, 64, 26)
}`,
'user.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -4,7 +4,8 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks nested scheduled break in framework code.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function frameworkCall(callback) {
inspector.callWithScheduledBreak(doFrameworkWork.bind(null, callback),
'top-framework-scheduled-break',
......@@ -18,11 +19,11 @@ function doFrameworkWork(callback) {
function doFrameworkBreak() {
inspector.breakProgram('framework-break', JSON.stringify({ data: 'data for framework-break' }));
}
//# sourceURL=framework.js`, 7, 26);
}`,
'framework.js');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function testFunction() {
inspector.callWithScheduledBreak(frameworkCall.bind(null, callback),
'top-scheduled-break', '');
......@@ -31,9 +32,8 @@ function testFunction() {
function callback() {
inspector.breakProgram('user-break', JSON.stringify({ data: 'data for user-break' }));
return 42;
}
//# sourceURL=user.js`, 25, 26);
}`,
'user.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -4,7 +4,7 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks framework debugging with blackboxed ranges.');
contextGroup.addScript(
contextGroup.addInlineScript(
`
function foo() {
return boo();
......@@ -14,9 +14,8 @@ function boo() {
}
function testFunction() {
foo();
}
//# sourceURL=test.js`,
7, 26);
}`,
'test.js');
session.setupScriptMap();
Protocol.Debugger.onPaused(message => {
......
......@@ -5,21 +5,21 @@ Running test: testStepIntoFromUser
Executing stepInto...
Executing stepInto...
userFoo (user.js:23:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userFoo (user.js:21:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing stepInto...
Executing stepInto...
userBoo (user.js:27:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userBoo (user.js:25:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing stepInto...
Executing stepInto...
testStepFromUser (user.js:32:0)
testStepFromUser (user.js:30:0)
(anonymous) (expr.js:0:0)
Executing resume...
......@@ -29,21 +29,21 @@ Running test: testStepOverFromUser
Executing stepInto...
Executing stepInto...
userFoo (user.js:23:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userFoo (user.js:21:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing stepOver...
Executing stepOver...
userBoo (user.js:27:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userBoo (user.js:25:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing stepOver...
Executing stepOver...
testStepFromUser (user.js:32:0)
testStepFromUser (user.js:30:0)
(anonymous) (expr.js:0:0)
Executing resume...
......@@ -53,50 +53,50 @@ Running test: testStepOutFromUser
Executing stepInto...
Executing stepInto...
userFoo (user.js:23:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userFoo (user.js:21:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing stepOut...
userBoo (user.js:27:2)
frameworkCall (framework.js:10:23)
testStepFromUser (user.js:31:2)
userBoo (user.js:25:2)
frameworkCall (framework.js:9:23)
testStepFromUser (user.js:29:2)
(anonymous) (expr.js:0:0)
Executing resume...
Running test: testStepIntoFromFramework
frameworkBreakAndCall (framework.js:14:12)
testStepFromFramework (user.js:35:2)
frameworkBreakAndCall (framework.js:13:12)
testStepFromFramework (user.js:33:2)
(anonymous) (expr.js:0:0)
Executing stepInto...
userFoo (user.js:23:2)
frameworkBreakAndCall (framework.js:15:23)
testStepFromFramework (user.js:35:2)
userFoo (user.js:21:2)
frameworkBreakAndCall (framework.js:14:23)
testStepFromFramework (user.js:33:2)
(anonymous) (expr.js:0:0)
Executing resume...
Running test: testStepOverFromFramework
frameworkBreakAndCall (framework.js:14:12)
testStepFromFramework (user.js:35:2)
frameworkBreakAndCall (framework.js:13:12)
testStepFromFramework (user.js:33:2)
(anonymous) (expr.js:0:0)
Executing stepOver...
testStepFromFramework (user.js:36:0)
testStepFromFramework (user.js:34:0)
(anonymous) (expr.js:0:0)
Executing resume...
Running test: testStepOutFromFramework
frameworkBreakAndCall (framework.js:14:12)
testStepFromFramework (user.js:35:2)
frameworkBreakAndCall (framework.js:13:12)
testStepFromFramework (user.js:33:2)
(anonymous) (expr.js:0:0)
Executing stepOut...
testStepFromFramework (user.js:36:0)
testStepFromFramework (user.js:34:0)
(anonymous) (expr.js:0:0)
Executing resume...
......@@ -4,7 +4,7 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Checks stepping with blackboxed frames on stack');
contextGroup.addScript(
contextGroup.addInlineScript(
`
function frameworkCall(funcs) {
for (var f of funcs) f();
......@@ -13,11 +13,10 @@ function frameworkCall(funcs) {
function frameworkBreakAndCall(funcs) {
inspector.breakProgram('', '');
for (var f of funcs) f();
}
//# sourceURL=framework.js`,
8, 4);
}`,
'framework.js');
contextGroup.addScript(
contextGroup.addInlineScript(
`
function userFoo() {
return 1;
......@@ -33,9 +32,8 @@ function testStepFromUser() {
function testStepFromFramework() {
frameworkBreakAndCall([userFoo, userBoo]);
}
//# sourceURL=user.js`,
21, 4);
}`,
'user.js');
session.setupScriptMap();
......
......@@ -8,7 +8,7 @@ let {session, contextGroup, Protocol} =
(async function test() {
session.setupScriptMap();
await Protocol.Debugger.enable();
contextGroup.addScript(`debugger;//# sourceURL=test.js`, -3, -3);
contextGroup.addScript(`debugger;`, -3, -3, 'test.js');
let {params:{callFrames}} = await Protocol.Debugger.oncePaused();
session.logCallFrames(callFrames);
InspectorTest.completeTest();
......
......@@ -8,7 +8,7 @@ test (foo.js:12:2)
(anonymous) (timeout1.js:0:8)
foo (timeout2.js:2:2)
foo (timeout2.js:19:2)
(anonymous) (timeout3.js:0:8)
......@@ -28,9 +28,9 @@ test (foo.js:13:0)
(anonymous) (timeout1.js:0:35)
foo (timeout2.js:2:2)
foo (timeout2.js:19:2)
foo (timeout2.js:2:12)
foo (timeout2.js:19:12)
(anonymous) (timeout3.js:0:8)
......@@ -61,9 +61,9 @@ test (foo.js:13:0)
(anonymous) (timeout1.js:0:35)
foo (timeout2.js:2:2)
foo (timeout2.js:19:2)
foo (timeout2.js:2:12)
foo (timeout2.js:19:12)
(anonymous) (timeout3.js:0:8)
......
......@@ -4,20 +4,22 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Debugger breaks in next script after stepOut from previous one.');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function test() {
setTimeout('var a = 1;//# sourceURL=timeout1.js', 0);
setTimeout(foo, 0);
setTimeout('var a = 3;//# sourceURL=timeout3.js', 0);
debugger;
}
//# sourceURL=foo.js`, 7, 26);
}`,
'foo.js');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function foo() {
return 42;
}
//# sourceURL=timeout2.js`)
}`,
'timeout2.js');
session.setupScriptMap();
var stepAction;
......
Regression test for crbug/1283049
Running test: test
foo (foo.js:0:17)
(anonymous) (:0:0)
// 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.
const {session, contextGroup, Protocol} =
InspectorTest.start('Regression test for crbug/1283049');
session.setupScriptMap();
contextGroup.addInlineScript(
`function foo() { debugger; }
//# sourceURL=foo.js`,
'regress-crbug-1283049.js');
InspectorTest.runAsyncTestSuite([async function test() {
await Promise.all([
Protocol.Runtime.enable(),
Protocol.Debugger.enable(),
]);
const evalPromise = Protocol.Runtime.evaluate({expression: 'foo()'});
const {params: {callFrames}} = await Protocol.Debugger.oncePaused();
session.logCallFrames(callFrames);
await Promise.all([
Protocol.Debugger.resume(),
evalPromise,
Protocol.Runtime.disable(),
Protocol.Debugger.disable(),
]);
}]);
......@@ -35,12 +35,12 @@ Evaluating debugger in 1
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
location: bar@26
data: null
Paused in 2:
reason: other
hit breakpoints:
location: bar@25
location: bar@26
data: null
Resuming in 2
Resumed in 1
......@@ -77,12 +77,12 @@ Evaluating debugger in 2
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
location: bar@26
data: null
Paused in 2:
reason: other
hit breakpoints:
location: bar@25
location: bar@26
data: null
Resuming in 2
Resumed in 1
......@@ -187,7 +187,7 @@ Evaluating bar() in 2
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
location: bar@26
data: null
Resuming in 1
Resumed in 1
......
......@@ -6,7 +6,8 @@ InspectorTest.log('Tests how multiple sessions interact while pausing, stepping,
var contextGroup = new InspectorTest.ContextGroup();
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function foo() {
return 1;
}
......@@ -17,14 +18,15 @@ function stepping() {
debugger;
var a = 1;
var b = 1;
}
//# sourceURL=test.js`, 9, 25);
}`,
'test.js');
contextGroup.addScript(`
contextGroup.addInlineScript(
`
function bar() {
debugger;
}
//# sourceURL=test2.js`, 23, 25);
}`,
'test2.js');
(async function test() {
InspectorTest.log('Connecting session 1');
......
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