TraceKit
TraceKit copied to clipboard
Unexpected error when computing Gecko stack traces
By reviewing TraceKit code, I found an issue where the stack trace computation fails in certain condition. Keep in mind that I didn't observe an actual error matching this condition.
See the code in question:
} else if (i === 0 && !parts[5] && !_isUndefined(ex.columnNumber)) {
// ...
stack[0].column = ex.columnNumber + 1;
}
The issue is, if i === 0
, then the stack
array is always empty, so accessing its first element returns undefined
, and stack[0].column
throws TypeError: Cannot set properties of undefined
.
This piece of code is only used in Gecko if the first line doesn't contain any column number. You can see the tests failing if you remove the column number here for example.
Now, because this has been an issue for a long time and nobody reported it, I'm not sure if this should be fixed or if this particular condition could be removed altogether. It seems that Sentry chose the latter.
Thanks for reporting this issue, we appreciate it. Any chance you'd be willing to submit a pr with a second modified test and a fix. I wish sentry would help the community by contributing back fixes.