Skip to content

Commit 2548697

Browse files
committed
fix(browser): Set : as a part of gecko protocol regex group.
1 parent 49cfc13 commit 2548697

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

packages/browser/src/stack-parsers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const chromeStackLineParser: StackLineParser = [CHROME_PRIORITY, chrome];
6767
// generates filenames without a prefix like `file://` the filenames in the stacktrace are just 42.js
6868
// We need this specific case for now because we want no other regex to match.
6969
const geckoREgex =
70-
/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension|capacitor).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i;
70+
/^\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;
7171
const geckoEvalRegex = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
7272

7373
const gecko: StackLineParserFn = line => {

packages/browser/test/unit/tracekit/firefox.test.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,50 @@ describe('Tracekit - Firefox Tests', () => {
310310
},
311311
});
312312
});
313+
314+
it('should parse Firefox errors with `file` inside an identifier', () => {
315+
const FIREFOX_FILE_IN_IDENTIFIER = {
316+
stack:
317+
'us@https://www.random_website.com/vendor.d1cae9cfc9917df88de7.js:1:296021\n' +
318+
'detectChanges@https://www.random_website.com/vendor.d1cae9cfc9917df88de7.js:1:333807\n' +
319+
'handleProfileResult@https://www.random_website.com/main.4a4119c3cdfd10266d84.js:146:1018410\n',
320+
fileName: 'https://www.random_website.com/main.4a4119c3cdfd10266d84.js',
321+
lineNumber: 5529,
322+
columnNumber: 16,
323+
message: 'this.props.raw[this.state.dataSource].rows is undefined',
324+
name: 'TypeError',
325+
};
326+
327+
const stacktrace = exceptionFromError(parser, FIREFOX_FILE_IN_IDENTIFIER);
328+
329+
expect(stacktrace).toEqual({
330+
stacktrace: {
331+
frames: [
332+
{
333+
colno: 1018410,
334+
filename: 'https://www.random_website.com/main.4a4119c3cdfd10266d84.js',
335+
function: 'handleProfileResult',
336+
in_app: true,
337+
lineno: 146,
338+
},
339+
{
340+
colno: 333807,
341+
filename: 'https://www.random_website.com/vendor.d1cae9cfc9917df88de7.js',
342+
function: 'detectChanges',
343+
in_app: true,
344+
lineno: 1,
345+
},
346+
{
347+
colno: 296021,
348+
filename: 'https://www.random_website.com/vendor.d1cae9cfc9917df88de7.js',
349+
function: 'us',
350+
in_app: true,
351+
lineno: 1,
352+
},
353+
],
354+
},
355+
type: 'TypeError',
356+
value: 'this.props.raw[this.state.dataSource].rows is undefined',
357+
});
358+
});
313359
});

0 commit comments

Comments
 (0)