🔇 Discard expected navigator.locks errors from page teardown - #4691
Merged
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: cb5873a | Docs | Datadog PR Page | Give us feedback! |
Bundles Sizes Evolution
|
thomas-lebeau
marked this pull request as ready for review
May 28, 2026 08:58
When a tab is being torn down (pagehide, print dialog, bfcache), in-flight
`navigator.locks.request` callbacks reject with errors that simply mean the
browsing context is going away — there is nothing actionable to do. They
surface in different shapes across browsers:
- DOMException "AbortError: ... browsing context is going away"
- Error "Failed to execute '...' on 'LockManager': The provided callback
is no longer runnable."
Now that we know what these errors are (after the investigation telemetry
added in #4668), drop them on the floor instead of forwarding to telemetry.
This also removes the supporting machinery that only existed to enrich the
telemetry context: `buildLockErrorContext`, `queryLockSnapshot`, and the
entire `lifecycleTracker` module — whose only consumer was the lock error
telemetry.
Pairs with 🔊 (logging) — for commits that remove debug logs or telemetry rather than adding them.
thomas-lebeau
force-pushed
the
thomas.lebeau/session-lock-cleanup
branch
from
May 28, 2026 10:42
902e710 to
cb5873a
Compare
BeltranBulbarellaDD
approved these changes
May 28, 2026
mormubis
approved these changes
May 28, 2026
bdibon
approved these changes
May 28, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Motivation
In-flight
navigator.locks.requestcallbacks reject when the browsing context is torn down. These rejections aren't actionable — the page is going away — but they were being forwarded to telemetry as errors, generating noise. The investigation telemetry added in #4668 confirmed the cause; this PR acts on those findings.Changes
sessionInCookie.ts: catch and discard the two error shapes seen in the wild:AbortError: Promise was rejected because the browsing context is going awayError: Failed to execute 'request' on 'LockManager': The provided callback is no longer runnable.All other lock rejections still propagate.
Remove the
addTelemetryErrorcall on lock-request failures along with the supporting helpers that only existed to enrich its context:buildLockErrorContext,queryLockSnapshot,getNavigationType,isInIframe, theLockQuerySnapshotinterface, theLOCK_QUERY_TIMEOUTconstant, and theinitTimestamp/lockRequestedAtbookkeeping.Delete the
lifecycleTrackermodule (lifecycleTracker.ts+ spec). Its only consumer wasbuildLockErrorContext; with that gone,startLifecycleTrackerwas registering capture-phase listeners onpageshow/pagehide/visibilitychange/freeze/resume/beforeunload/prerenderingchangeonly to record state nobody read. ThestartLifecycleTracker(configuration)andresetLifecycleTracker()calls insessionManager.ts(and the corresponding test cleanup) are dropped.Test instructions
yarn typecheckandyarn lintpass.yarn test:unit --spec packages/core/src/domain/session/storeStrategies/sessionInCookie.spec.tsyarn test:unit --spec packages/core/src/domain/session/sessionManager.spec.tsChecklist