@@ -79,7 +79,7 @@ interface StartTrackingWebVitalsOptions {
7979 */
8080export function startTrackingWebVitals ( { recordClsStandaloneSpans } : StartTrackingWebVitalsOptions ) : ( ) => void {
8181 const performance = getBrowserPerformanceAPI ( ) ;
82- if ( performance && browserPerformanceTimeOrigin ) {
82+ if ( performance && browserPerformanceTimeOrigin ( ) ) {
8383 // @ts -expect-error we want to make sure all of these are available, even if TS is sure they are
8484 if ( performance . mark ) {
8585 WINDOW . performance . mark ( 'sentry-tracing-init' ) ;
@@ -109,7 +109,7 @@ export function startTrackingLongTasks(): void {
109109 return ;
110110 }
111111 for ( const entry of entries ) {
112- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
112+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
113113 const duration = msToSec ( entry . duration ) ;
114114
115115 const span = startInactiveSpan ( {
@@ -143,7 +143,7 @@ export function startTrackingLongAnimationFrames(): void {
143143 continue ;
144144 }
145145
146- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
146+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
147147 const duration = msToSec ( entry . duration ) ;
148148
149149 const attributes : SpanAttributes = {
@@ -189,7 +189,7 @@ export function startTrackingInteractions(): void {
189189 }
190190 for ( const entry of entries ) {
191191 if ( entry . name === 'click' ) {
192- const startTime = msToSec ( ( browserPerformanceTimeOrigin as number ) + entry . startTime ) ;
192+ const startTime = msToSec ( ( browserPerformanceTimeOrigin ( ) as number ) + entry . startTime ) ;
193193 const duration = msToSec ( entry . duration ) ;
194194
195195 const spanOptions : StartSpanOptions & Required < Pick < StartSpanOptions , 'attributes' > > = {
@@ -255,7 +255,7 @@ function _trackFID(): () => void {
255255 return ;
256256 }
257257
258- const timeOrigin = msToSec ( browserPerformanceTimeOrigin as number ) ;
258+ const timeOrigin = msToSec ( browserPerformanceTimeOrigin ( ) as number ) ;
259259 const startTime = msToSec ( entry . startTime ) ;
260260 DEBUG_BUILD && logger . log ( '[Measurements] Adding FID' ) ;
261261 _measurements [ 'fid' ] = { value : metric . value , unit : 'millisecond' } ;
@@ -286,13 +286,14 @@ interface AddPerformanceEntriesOptions {
286286/** Add performance related spans to a transaction */
287287export function addPerformanceEntries ( span : Span , options : AddPerformanceEntriesOptions ) : void {
288288 const performance = getBrowserPerformanceAPI ( ) ;
289- if ( ! performance || ! WINDOW . performance . getEntries || ! browserPerformanceTimeOrigin ) {
289+ const origin = browserPerformanceTimeOrigin ( ) ;
290+ if ( ! performance || ! WINDOW . performance . getEntries || ! origin ) {
290291 // Gatekeeper if performance API not available
291292 return ;
292293 }
293294
294295 DEBUG_BUILD && logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
295- const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
296+ const timeOrigin = msToSec ( origin ) ;
296297
297298 const performanceEntries = performance . getEntries ( ) ;
298299
0 commit comments