Skip to content

Commit 3668543

Browse files
szuendDevtools-frontend LUCI CQ
authored andcommitted
[stack_trace] Forward the missing debug info in StackTraceModel
[email protected] Bug: 433162438 Change-Id: If5055b577db554fc1c2dc4961c8fdc2a1f09cf8c Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6903183 Commit-Queue: Simon Zünd <[email protected]> Reviewed-by: Philip Pfaffe <[email protected]>
1 parent 329dc8f commit 3668543

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

front_end/models/stack_trace/StackTraceImpl.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,16 @@ export class FrameImpl implements StackTrace.StackTrace.Frame {
7070
readonly line: number;
7171
readonly column: number;
7272

73+
readonly missingDebugInfo?: StackTrace.StackTrace.MissingDebugInfo;
74+
7375
constructor(
7476
url: string|undefined, uiSourceCode: Workspace.UISourceCode.UISourceCode|undefined, name: string|undefined,
75-
line: number, column: number) {
77+
line: number, column: number, missingDebugInfo?: StackTrace.StackTrace.MissingDebugInfo) {
7678
this.url = url;
7779
this.uiSourceCode = uiSourceCode;
7880
this.name = name;
7981
this.line = line;
8082
this.column = column;
83+
this.missingDebugInfo = missingDebugInfo;
8184
}
8285
}

front_end/models/stack_trace/StackTraceModel.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,24 @@ describeWithMockConnection('StackTraceModel', () => {
167167
} catch {
168168
}
169169
});
170+
171+
it('forwards missing debug info', async () => {
172+
const {model} = setup();
173+
const translateFn: StackTraceImpl.StackTraceModel.TranslateRawFrames = (frames, _target) =>
174+
Promise.resolve(frames.map(f => [{
175+
url: f.url,
176+
name: f.functionName,
177+
line: f.lineNumber,
178+
column: f.columnNumber,
179+
missingDebugInfo: {type: StackTrace.StackTrace.MissingDebugInfoType.NO_INFO},
180+
}]));
181+
182+
const stackTrace =
183+
await model.createFromProtocolRuntime({callFrames: [protocolCallFrame('foo.js:1:foo:1:10')]}, translateFn);
184+
185+
assert.strictEqual(
186+
stackTrace.syncFragment.frames[0].missingDebugInfo?.type, StackTrace.StackTrace.MissingDebugInfoType.NO_INFO);
187+
});
170188
});
171189

172190
describe('scriptInfoChanged', () => {
@@ -292,5 +310,26 @@ describeWithMockConnection('StackTraceModel', () => {
292310
sinon.assert.calledOnce(updatedSpyFull);
293311
sinon.assert.calledOnce(updatedSpySubSet);
294312
});
313+
314+
it('forwards missing debug info', async () => {
315+
const {model} = setup();
316+
const translateFn: StackTraceImpl.StackTraceModel.TranslateRawFrames = (frames, _target) =>
317+
Promise.resolve(frames.map(f => [{
318+
url: f.url,
319+
name: f.functionName,
320+
line: f.lineNumber,
321+
column: f.columnNumber,
322+
missingDebugInfo: {type: StackTrace.StackTrace.MissingDebugInfoType.NO_INFO},
323+
}]));
324+
const stackTrace = await model.createFromProtocolRuntime(
325+
{callFrames: [protocolCallFrame('foo.js:1:foo:1:10')]}, identityTranslateFn);
326+
assert.isUndefined(stackTrace.syncFragment.frames[0].missingDebugInfo);
327+
const script = {scriptId: '1', sourceURL: 'bar.js'} as SDK.Script.Script;
328+
329+
await model.scriptInfoChanged(script, translateFn);
330+
331+
const frame = stackTrace.syncFragment.frames[0];
332+
assert.strictEqual(frame.missingDebugInfo?.type, StackTrace.StackTrace.MissingDebugInfoType.NO_INFO);
333+
});
295334
});
296335
});

front_end/models/stack_trace/StackTraceModel.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import {type FrameNode, type RawFrame, Trie} from './Trie.js';
1515
*
1616
* Any implementation must return an array with the same length as `frames`.
1717
*/
18-
export type TranslateRawFrames = (frames: readonly RawFrame[], target: SDK.Target.Target) =>
19-
Promise<Array<Array<Pick<StackTrace.StackTrace.Frame, 'url'|'uiSourceCode'|'name'|'line'|'column'>>>>;
18+
export type TranslateRawFrames = (frames: readonly RawFrame[], target: SDK.Target.Target) => Promise<
19+
Array<Array<Pick<StackTrace.StackTrace.Frame, 'url'|'uiSourceCode'|'name'|'line'|'column'|'missingDebugInfo'>>>>;
2020

2121
/**
2222
* The {@link StackTraceModel} is a thin wrapper around a fragment trie.
@@ -93,7 +93,8 @@ export class StackTraceModel extends SDK.SDKModel.SDKModel<unknown> {
9393
let i = 0;
9494
for (const node of fragment.node.getCallStack()) {
9595
node.frames = uiFrames[i++].map(
96-
frame => new FrameImpl(frame.url, frame.uiSourceCode, frame.name, frame.line, frame.column));
96+
frame => new FrameImpl(
97+
frame.url, frame.uiSourceCode, frame.name, frame.line, frame.column, frame.missingDebugInfo));
9798
}
9899
}
99100

0 commit comments

Comments
 (0)