Skip to content

Commit a7e4f59

Browse files
authored
allow parsing special hermes eval stack trace frames (#196)
1 parent 12ae91a commit a7e4f59

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

front_end/panels/console/ErrorStackParser.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ export type SpecialHermesStackTraceFrameTypes =
2727
// for the frame so that a debugger could stitch together a
2828
// hybrid cross-language call stack
2929
'native' |
30+
// e.g "(eval:1:2)"- Seem to be reported when there's a
31+
// ReferenceError or TypeError during the initial bundle code execution.
32+
// TODO: Understand exactly where these originate from and what further work
33+
// should be done in regards to them
34+
'eval' |
3035
// e.g "(:3:4)"- Frames with empty url
3136
// TODO: Seems to be happening due to a bug that needs to be investigated
3237
// and produce an actual script URL instead
@@ -44,6 +49,10 @@ function getSpecialHermesFrameBasedOnURL(url: string): SpecialHermesStackTraceFr
4449
return 'native';
4550
}
4651

52+
if (url === 'eval') {
53+
return 'eval';
54+
}
55+
4756
if (url === '') {
4857
return 'empty url';
4958
}
@@ -89,7 +98,7 @@ export function parseSourcePositionsFromErrorStack(
8998
if (!match) {
9099
if (linkInfos.length && linkInfos[linkInfos.length - 1].isCallFrame) {
91100
const specialHermesFrameType = getSpecialHermesFrameBasedOnLine(line);
92-
if (specialHermesFrameType) {
101+
if (specialHermesFrameType !== null) {
93102
specialHermesFramesParsed.add(specialHermesFrameType);
94103
if (!linkInfos[linkInfos.length - 1].link) {
95104
// Combine builtin frames.
@@ -136,7 +145,7 @@ export function parseSourcePositionsFromErrorStack(
136145
const linkCandidate = line.substring(left, right);
137146
const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
138147
const specialHermesFrameType = getSpecialHermesFrameBasedOnURL(splitResult.url);
139-
if (specialHermesFrameType) {
148+
if (specialHermesFrameType !== null) {
140149
specialHermesFramesParsed.add(specialHermesFrameType);
141150
}
142151

0 commit comments

Comments
 (0)