Skip to content

Commit 57cb2fc

Browse files
authored
feat(browser): Simplify stack parsers (#7897)
1 parent e6fb47b commit 57cb2fc

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

packages/browser/src/stack-parsers.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function createFrame(filename: string, func: string, lineno?: number, colno?: nu
5555

5656
// Chromium based browsers: Chrome, Brave, new Opera, new Edge
5757
const chromeRegex =
58-
/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?(?:async )?((?:file|https?|blob|chrome-extension|address|native|eval|webpack|<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
58+
/^\s*at (?:(.*\).*?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
5959
const chromeEvalRegex = /\((\S*)(?::(\d+))(?::(\d+))\)/;
6060

6161
const chrome: StackLineParserFn = line => {
@@ -91,7 +91,7 @@ export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chrome];
9191
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
9292
// We need this specific case for now because we want no other regex to match.
9393
const geckoREgex =
94-
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|safari-extension|safari-web-extension|capacitor)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
94+
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
9595
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
9696

9797
const gecko: StackLineParserFn = line => {
@@ -123,8 +123,7 @@ const gecko: StackLineParserFn = line => {
123123

124124
export const geckoStackLineParser: StackLineParser = [GECKO_PRIORITY, gecko];
125125

126-
const winjsRegex =
127-
/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
126+
const winjsRegex = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
128127

129128
const winjs: StackLineParserFn = line => {
130129
const parts = winjsRegex.exec(line);

0 commit comments

Comments
 (0)