Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/migration/draft-v9-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Deprecated `BAGGAGE_HEADER_NAME`. No replacements.
- Deprecated `makeFifoCache`. No replacements.
- Deprecated `flatten`. No replacements.
- Deprecated `_browserPerformanceTimeOriginMode`. No replacements.

## `@sentry/core`

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/utils-hoist/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export {
} from './supports';
export { SyncPromise, rejectedSyncPromise, resolvedSyncPromise } from './syncpromise';
export {
// eslint-disable-next-line deprecation/deprecation
_browserPerformanceTimeOriginMode,
browserPerformanceTimeOrigin,
dateTimestampInSeconds,
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/utils-hoist/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export const timestampInSeconds = createUnixTimestampInSecondsFunc();

/**
* Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.
*
* @deprecated This variable will be removed in the next major version.
*/
export let _browserPerformanceTimeOriginMode: string;

Expand All @@ -84,6 +86,7 @@ export const browserPerformanceTimeOrigin = ((): number | undefined => {

const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
if (!performance || !performance.now) {
// eslint-disable-next-line deprecation/deprecation
_browserPerformanceTimeOriginMode = 'none';
return undefined;
}
Expand Down Expand Up @@ -113,15 +116,18 @@ export const browserPerformanceTimeOrigin = ((): number | undefined => {
if (timeOriginIsReliable || navigationStartIsReliable) {
// Use the more reliable time origin
if (timeOriginDelta <= navigationStartDelta) {
// eslint-disable-next-line deprecation/deprecation
_browserPerformanceTimeOriginMode = 'timeOrigin';
return performance.timeOrigin;
} else {
// eslint-disable-next-line deprecation/deprecation
_browserPerformanceTimeOriginMode = 'navigationStart';
return navigationStart;
}
}

// Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.
// eslint-disable-next-line deprecation/deprecation
_browserPerformanceTimeOriginMode = 'dateNow';
return dateNow;
})();
1 change: 1 addition & 0 deletions packages/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ export const supportsReferrerPolicy = supportsReferrerPolicy_imported;
export const supportsReportingObserver = supportsReportingObserver_imported;

/** @deprecated Import from `@sentry/core` instead. */
// eslint-disable-next-line deprecation/deprecation
export const _browserPerformanceTimeOriginMode = _browserPerformanceTimeOriginMode_imported;

/** @deprecated Import from `@sentry/core` instead. */
Expand Down
Loading