Skip to content

Commit 1a8dbf9

Browse files
committed
parse "empty url" and "address at" frames as non-hyperlinked text
1 parent 7774c38 commit 1a8dbf9

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

front_end/panels/console/ErrorStackParser.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,37 @@ 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+
// functions implemented in c++.
32+
// TODO: these might be enhanced to include the C++ loc for the frame
33+
// so that a debugger could stitch together a hybrid cross-language call stack
34+
if (url === 'native') {
35+
return 'native';
36+
}
37+
38+
// frames with empty url
39+
// TODO: these seem to be happening due to a bug that needs to be investigated
40+
// and produce an actual script URL instead
41+
if (url === '') {
42+
return 'empty url';
43+
}
44+
45+
// frames pointing to a bytecode locations
46+
// TODO: these could be symbolicated and link to source files with the help of
47+
// a bytecode source maps once they are available.
48+
if (url.startsWith?.('address at ')) {
49+
return 'address at';
50+
}
51+
52+
return null;
53+
}
54+
2455
/**
2556
* Takes a V8 Error#stack string and extracts source position information.
2657
*
@@ -79,7 +110,8 @@ export function parseSourcePositionsFromErrorStack(
79110

80111
const linkCandidate = line.substring(left, right);
81112
const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
82-
if (splitResult.url === '<anonymous>' || splitResult.url === 'native') {
113+
const specialHermesFrameType = getSpecialHermesStackTraceFrameType(splitResult);
114+
if (splitResult.url === '<anonymous>' || specialHermesFrameType !== null) {
83115
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame && !linkInfos[linkInfos.length - 1].link) {
84116
// Combine builtin frames.
85117
linkInfos[linkInfos.length - 1].line += `\n${line}`;

0 commit comments

Comments
 (0)