@@ -83,7 +83,7 @@ interface StartTrackingWebVitalsOptions {
8383 */
8484export function startTrackingWebVitals ( { recordClsStandaloneSpans } : StartTrackingWebVitalsOptions ) : ( ) => void {
8585 const performance = getBrowserPerformanceAPI ( ) ;
86- if ( performance && browserPerformanceTimeOrigin ) {
86+ if ( performance && browserPerformanceTimeOrigin ( ) ) {
8787 // @ts -expect-error we want to make sure all of these are available, even if TS is sure they are
8888 if ( performance . mark ) {
8989 WINDOW . performance . mark ( 'sentry-tracing-init' ) ;
@@ -117,7 +117,7 @@ export function startTrackingLongTasks(): void {
117117 const { op : parentOp , start_timestamp : parentStartTimestamp } = spanToJSON ( parent ) ;
118118
119119 for ( const entry of entries ) {
120- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
120+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
121121 const duration = msToSec ( entry . duration ) ;
122122
123123 if ( parentOp === 'navigation' && parentStartTimestamp && startTime < parentStartTimestamp ) {
@@ -156,7 +156,7 @@ export function startTrackingLongAnimationFrames(): void {
156156 continue ;
157157 }
158158
159- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
159+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
160160
161161 const { start_timestamp : parentStartTimestamp , op : parentOp } = spanToJSON ( parent ) ;
162162
@@ -167,7 +167,6 @@ export function startTrackingLongAnimationFrames(): void {
167167 // routing instrumentations
168168 continue ;
169169 }
170-
171170 const duration = msToSec ( entry . duration ) ;
172171
173172 const attributes : SpanAttributes = {
@@ -210,7 +209,7 @@ export function startTrackingInteractions(): void {
210209 }
211210 for ( const entry of entries ) {
212211 if ( entry . name === 'click' ) {
213- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
212+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
214213 const duration = msToSec ( entry . duration ) ;
215214
216215 const spanOptions : StartSpanOptions & Required < Pick < StartSpanOptions , 'attributes' > > = {
@@ -271,7 +270,7 @@ function _trackFID(): () => void {
271270 return ;
272271 }
273272
274- const timeOrigin = msToSec ( browserPerformanceTimeOrigin as number ) ;
273+ const timeOrigin = msToSec ( browserPerformanceTimeOrigin ( ) as number ) ;
275274 const startTime = msToSec ( entry . startTime ) ;
276275 _measurements [ 'fid' ] = { value : metric . value , unit : 'millisecond' } ;
277276 _measurements [ 'mark.fid' ] = { value : timeOrigin + startTime , unit : 'second' } ;
@@ -300,12 +299,13 @@ interface AddPerformanceEntriesOptions {
300299/** Add performance related spans to a transaction */
301300export function addPerformanceEntries ( span : Span , options : AddPerformanceEntriesOptions ) : void {
302301 const performance = getBrowserPerformanceAPI ( ) ;
303- if ( ! performance ?. getEntries || ! browserPerformanceTimeOrigin ) {
302+ const origin = browserPerformanceTimeOrigin ( ) ;
303+ if ( ! performance ?. getEntries || ! origin ) {
304304 // Gatekeeper if performance API not available
305305 return ;
306306 }
307307
308- const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
308+ const timeOrigin = msToSec ( origin ) ;
309309
310310 const performanceEntries = performance . getEntries ( ) ;
311311
0 commit comments