Skip to content

Commit

Permalink
fix(browser): check supportedEntryTypes before caling the function (#…
Browse files Browse the repository at this point in the history
…13541)

`PerformanceObserver` is available on iOS 11 and later, but
the `supportedEntryTypes` method is available on iOS 13 and later.

ref:
https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver

Therefore, a runtime error will occur if we use Sentry on iOS 11 or iOS
12.
  • Loading branch information
odanado authored Sep 9, 2024
1 parent 8eaa562 commit 315a5db
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/browser/src/tracing/browserTracingIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ export const browserTracingIntegration = ((_options: Partial<BrowserTracingOptio
if (
enableLongAnimationFrame &&
GLOBAL_OBJ.PerformanceObserver &&
PerformanceObserver.supportedEntryTypes &&
PerformanceObserver.supportedEntryTypes.includes('long-animation-frame')
) {
startTrackingLongAnimationFrames();
Expand Down

0 comments on commit 315a5db

Please sign in to comment.