Skip to content

Commit e4487ef

Browse files
authored
support symbolication with native frames (#181)
1 parent d95ac13 commit e4487ef

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

front_end/panels/console/ErrorStackParser.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,25 @@ describe('ErrorStackParser', () => {
340340
assert.strictEqual(parsedFrames[3].link?.url, urlString`http://example.com/b.js`);
341341
assert.isTrue(parsedFrames[3].isCallFrame);
342342
});
343+
344+
it('combines builtin frames in native frames', () => {
345+
const parsedFrames = parseErrorStack(`Error: some error
346+
at foo (http://example.com/a.js:6:3)
347+
at forEach (native)
348+
at JSON.parse (native)
349+
at bar (http://example.com/b.js:43:14)`);
350+
assert.exists(parsedFrames);
351+
352+
assert.isUndefined(parsedFrames[0].link);
353+
assert.isUndefined(parsedFrames[0].isCallFrame);
354+
assert.strictEqual(parsedFrames[1].link?.url, urlString`http://example.com/a.js`);
355+
assert.isTrue(parsedFrames[1].isCallFrame);
356+
assert.isUndefined(parsedFrames[2].link);
357+
assert.isTrue(parsedFrames[2].isCallFrame);
358+
assert.strictEqual(
359+
parsedFrames[2].line, ' at forEach (native)\n at JSON.parse (native)');
360+
assert.strictEqual(parsedFrames[3].link?.url, urlString`http://example.com/b.js`);
361+
assert.isTrue(parsedFrames[3].isCallFrame);
362+
});
343363
});
344364
});

front_end/panels/console/ErrorStackParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export function parseSourcePositionsFromErrorStack(
7575

7676
const linkCandidate = line.substring(left, right);
7777
const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
78-
if (splitResult.url === '<anonymous>') {
78+
if (splitResult.url === '<anonymous>' || splitResult.url === 'native') {
7979
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame && !linkInfos[linkInfos.length - 1].link) {
8080
// Combine builtin frames.
8181
linkInfos[linkInfos.length - 1].line += `\n${line}`;

0 commit comments

Comments
 (0)