ref: Drop Safari 14 support - remove navigationStart fallback and pagehide listeners#21293
Open
eddie333016 wants to merge 1 commit into
Open
ref: Drop Safari 14 support - remove navigationStart fallback and pagehide listeners#21293eddie333016 wants to merge 1 commit into
eddie333016 wants to merge 1 commit into
Conversation
…rt fallback and pagehide listeners Safari 15+ has full performance.timeOrigin support and reliable visibilitychange events. This removes: - performance.timing?.navigationStart fallback in getBrowserTimeOrigin() - pagehide event listeners in web-vitals vendored code (onHidden, getVisibilityWatcher, whenIdleOrHidden) - isPageHidden() helper that checked for pagehide event type - Updated integration tests to use visibilitychange instead of pagehide This saves ~100 bytes of unnecessary browser compatibility code. Closes getsentry#18707
logaretm
requested changes
Jun 2, 2026
Member
logaretm
left a comment
There was a problem hiding this comment.
The Safari 14/pagehide removal is fine for v11, but the PR needs to clean up the stale tests.
At any case, this PR won't be merged at the moment until v11 is being prepared for release given its breaking changes nature.
Comment on lines
-117
to
-123
| const navigationStart = performance.timing?.navigationStart; | ||
| if (typeof navigationStart === 'number') { | ||
| const navigationStartDelta = Math.abs(navigationStart + performanceNow - dateNow); | ||
| if (navigationStartDelta < threshold) { | ||
| return navigationStart; | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Some tests still assert the navigationStart. Those tests will fail.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #18707
Drops Safari 14 compatibility code by removing the
performance.timing.navigationStartfallback andpagehideevent listeners from the vendored web-vitals code.Changes
Core timing (
packages/core/src/utils/time.ts):performance.timing?.navigationStartfallback ingetBrowserTimeOrigin()— Safari 15+ supportsperformance.timeOriginnativelyWeb-vitals vendored code (
packages/browser-utils/src/metrics/web-vitals/lib/):onHidden.ts: Removedpagehideevent listener, now only listens tovisibilitychangegetVisibilityWatcher.ts: Removedpagehideevent listener, removedisPageHidden()helper, simplifiedonVisibilityUpdateto only checkdocument.visibilityStatewhenIdleOrHidden.ts: Removedpagehideadd/remove listener pairsIntegration tests:
hidePage()helpers to dispatchvisibilitychange(withdocument.visibilityState = 'hidden') instead ofpagehidepagehidedispatches to use the same patternsentry.report_event: 'pagehide'data labels unchanged (backend-facing API contract)Bundle size impact
Saves ~100 bytes by removing unnecessary fallback code paths and event listeners.