From d603282a1da0c37b0940cb1f3b37d7ad0ee1eafd Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 12 Apr 2022 20:45:21 +0100 Subject: [PATCH] feat: Remove stack parser support for Opera pre v15 (#4923) Opera v15 was released in 2013 and was based on Chromium. This PR removes the two Opera specific stack parsers that cater for versions before this from the defaults. Anyone still wanting to support these ancient browser versions can do the following: ```ts import { init, defaultStackParsers, opera10StackParser, opera11StackParser } from '@sentry/browser'; init({ dsn: '__DSN__', stackParser: [...defaultStackParsers, opera10StackParser, opera11StackParser] }) ``` --- packages/browser/src/stack-parsers.ts | 8 +------- packages/browser/test/unit/tracekit/opera.test.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/packages/browser/src/stack-parsers.ts b/packages/browser/src/stack-parsers.ts index 5ee652001854..5d58e9865cd4 100644 --- a/packages/browser/src/stack-parsers.ts +++ b/packages/browser/src/stack-parsers.ts @@ -130,13 +130,7 @@ const opera11: StackLineParserFn = line => { export const opera11StackParser: StackLineParser = [OPERA11_PRIORITY, opera11]; -export const defaultStackParsers = [ - chromeStackParser, - geckoStackParser, - opera10StackParser, - opera11StackParser, - winjsStackParser, -]; +export const defaultStackParsers = [chromeStackParser, geckoStackParser, winjsStackParser]; /** * Safari web extensions, starting version unknown, can produce "frames-only" stacktraces. diff --git a/packages/browser/test/unit/tracekit/opera.test.ts b/packages/browser/test/unit/tracekit/opera.test.ts index a97675824e18..9084447d4e29 100644 --- a/packages/browser/test/unit/tracekit/opera.test.ts +++ b/packages/browser/test/unit/tracekit/opera.test.ts @@ -1,9 +1,10 @@ import { createStackParser } from '@sentry/utils'; import { exceptionFromError } from '../../../src/eventbuilder'; -import { defaultStackParsers } from '../../../src/stack-parsers'; +import { defaultStackParsers, opera10StackParser, opera11StackParser } from '../../../src/stack-parsers'; -const parser = createStackParser(...defaultStackParsers); +const operaParser = createStackParser(opera10StackParser, opera11StackParser); +const chromiumParser = createStackParser(...defaultStackParsers); describe('Tracekit - Opera Tests', () => { it('should parse Opera 10 error', () => { @@ -29,7 +30,7 @@ describe('Tracekit - Opera Tests', () => { '', }; - const ex = exceptionFromError(parser, OPERA_10); + const ex = exceptionFromError(operaParser, OPERA_10); expect(ex).toEqual({ value: 'Statement on line 42: Type mismatch (usually non-object value supplied where object required)', @@ -75,7 +76,7 @@ describe('Tracekit - Opera Tests', () => { ' foo();', }; - const ex = exceptionFromError(parser, OPERA_11); + const ex = exceptionFromError(operaParser, OPERA_11); expect(ex).toEqual({ value: "'this.undef' is not a function", @@ -112,7 +113,7 @@ describe('Tracekit - Opera Tests', () => { ' dumpException3();', }; - const ex = exceptionFromError(parser, OPERA_12); + const ex = exceptionFromError(operaParser, OPERA_12); expect(ex).toEqual({ value: "Cannot convert 'x' to object", @@ -156,7 +157,7 @@ describe('Tracekit - Opera Tests', () => { ' at bar (http://path/to/file.js:108:168)', }; - const ex = exceptionFromError(parser, OPERA_25); + const ex = exceptionFromError(chromiumParser, OPERA_25); expect(ex).toEqual({ value: "Cannot read property 'undef' of null",