Skip to content

Commit 8ca201f

Browse files
committed
parse empty and "address at" urls as non-hyperlinked text
1 parent 7774c38 commit 8ca201f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

front_end/panels/console/ErrorStackParser.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ export interface ParsedErrorFrame {
2121
};
2222
}
2323

24+
export type SpecialHermesStackTraceFrameTypes = 'native' | 'address at' | 'empty url';
25+
26+
function getSpecialHermesStackTraceFrameType({
27+
url,
28+
}: {
29+
url: Platform.DevToolsPath.UrlString,
30+
}): SpecialHermesStackTraceFrameTypes | null {
31+
if (url === 'native') {
32+
return 'native';
33+
}
34+
if (url === '') {
35+
return 'empty url';
36+
}
37+
if (url.startsWith?.('address at ')) {
38+
return 'address at';
39+
}
40+
return null;
41+
}
42+
2443
/**
2544
* Takes a V8 Error#stack string and extracts source position information.
2645
*
@@ -79,7 +98,8 @@ export function parseSourcePositionsFromErrorStack(
7998

8099
const linkCandidate = line.substring(left, right);
81100
const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
82-
if (splitResult.url === '<anonymous>' || splitResult.url === 'native') {
101+
const specialHermesFrameType = getSpecialHermesStackTraceFrameType(splitResult);
102+
if (splitResult.url === '<anonymous>' || specialHermesFrameType !== null) {
83103
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame && !linkInfos[linkInfos.length - 1].link) {
84104
// Combine builtin frames.
85105
linkInfos[linkInfos.length - 1].line += `\n${line}`;

0 commit comments

Comments
 (0)