Skip to content

Commit 4caa946

Browse files
authored
feat(v7/core): Backport ResizeObserver and googletag default filters (#11210)
Backport two additional default error event filters to our `inboundFilters` integration: * #10845 * #11208
1 parent c7306da commit 4caa946

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

.size-limit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module.exports = [
5252
path: 'packages/browser/build/npm/esm/index.js',
5353
import: '{ init, browserTracingIntegration }',
5454
gzip: true,
55-
limit: '36 KB',
55+
limit: '37 KB',
5656
},
5757
{
5858
name: '@sentry/browser (incl. Feedback) - Webpack (gzipped)',

packages/core/src/integrations/inboundfilters.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import { convertIntegrationFnToClass, defineIntegration } from '../integration';
66

77
// "Script error." is hard coded into browsers for errors that it can't read.
88
// this is the result of a script being pulled in from an external domain and CORS.
9-
const DEFAULT_IGNORE_ERRORS = [/^Script error\.?$/, /^Javascript error: Script error\.? on line 0$/];
9+
const DEFAULT_IGNORE_ERRORS = [
10+
/^Script error\.?$/,
11+
/^Javascript error: Script error\.? on line 0$/,
12+
/^ResizeObserver loop completed with undelivered notifications.$/,
13+
/^Cannot redefine property: googletag$/,
14+
];
1015

1116
const DEFAULT_IGNORE_TRANSACTIONS = [
1217
/^.*\/healthcheck$/,

packages/core/test/lib/integrations/inboundfilters.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,28 @@ const SCRIPT_ERROR_EVENT: Event = {
188188
},
189189
};
190190

191+
const RESIZEOBSERVER_EVENT: Event = {
192+
exception: {
193+
values: [
194+
{
195+
type: 'Error',
196+
value: 'ResizeObserver loop completed with undelivered notifications.',
197+
},
198+
],
199+
},
200+
};
201+
202+
const GOOGLETAG_EVENT: Event = {
203+
exception: {
204+
values: [
205+
{
206+
type: 'TypeError',
207+
value: 'Cannot redefine property: googletag',
208+
},
209+
],
210+
},
211+
};
212+
191213
const MALFORMED_EVENT: Event = {
192214
exception: {
193215
values: [
@@ -304,11 +326,21 @@ describe('InboundFilters', () => {
304326
expect(eventProcessor(EXCEPTION_EVENT, {})).toBe(null);
305327
});
306328

307-
it('uses default filters', () => {
329+
it('uses default filters (script error)', () => {
308330
const eventProcessor = createInboundFiltersEventProcessor();
309331
expect(eventProcessor(SCRIPT_ERROR_EVENT, {})).toBe(null);
310332
});
311333

334+
it('uses default filters (ResizeObserver)', () => {
335+
const eventProcessor = createInboundFiltersEventProcessor();
336+
expect(eventProcessor(RESIZEOBSERVER_EVENT, {})).toBe(null);
337+
});
338+
339+
it('uses default filters (googletag)', () => {
340+
const eventProcessor = createInboundFiltersEventProcessor();
341+
expect(eventProcessor(GOOGLETAG_EVENT, {})).toBe(null);
342+
});
343+
312344
it('filters on last exception when multiple present', () => {
313345
const eventProcessor = createInboundFiltersEventProcessor({
314346
ignoreErrors: ['incorrect type given for parameter `chewToy`'],

0 commit comments

Comments
 (0)