Skip to content

Commit e80e0d8

Browse files
authored
fix: Wrap oldOnPopState.apply call in try/catch to prevent Firefox from crashing (#3377)
1 parent 6deffe7 commit e80e0d8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/utils/src/instrument.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,14 @@ function instrumentHistory(): void {
330330
to,
331331
});
332332
if (oldOnPopState) {
333-
return oldOnPopState.apply(this, args);
333+
// Apparently this can throw in Firefox when incorrectly implemented plugin is installed.
334+
// https://github.com/getsentry/sentry-javascript/issues/3344
335+
// https://github.com/bugsnag/bugsnag-js/issues/469
336+
try {
337+
return oldOnPopState.apply(this, args);
338+
} catch (_oO) {
339+
// no-empty
340+
}
334341
}
335342
};
336343

0 commit comments

Comments
 (0)