Skip to content

Commit

Permalink
ref(browser): Remove stack parser support for Opera pre v15 (#4923)
Browse files Browse the repository at this point in the history
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]
})
```
  • Loading branch information
timfish authored and lobsterkatie committed Apr 26, 2022
1 parent c2a57a7 commit 48da5f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
8 changes: 1 addition & 7 deletions packages/browser/src/stack-parsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
13 changes: 7 additions & 6 deletions packages/browser/test/unit/tracekit/opera.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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)',
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 48da5f1

Please sign in to comment.