fix(replay): Distinguish worker load failures from page-teardown aborts#22378
Draft
billyvg wants to merge 1 commit into
Draft
fix(replay): Distinguish worker load failures from page-teardown aborts#22378billyvg wants to merge 1 commit into
billyvg wants to merge 1 commit into
Conversation
The "Failed to load Replay compression worker: Unknown error" message is captured across Chrome, Edge and Firefox as well as Safari. On those engines the blob MIME type is irrelevant — the error comes from the worker fetch being aborted when the page navigates away or is backgrounded while the worker is still loading. `WorkerHandler.ensureReady()` now routes the worker `error` event through a helper that distinguishes an aborted load (document hidden/unloading) from a genuine load failure, so the captured message is accurate instead of always blaming CSP/network.
Contributor
size-limit report 📦
|
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
Follow-up to #22377 (the Safari MIME fix). This addresses the cross-browser occurrences of the same captured error:
The MIME fix only explains the Safari subset. The 90-day
browser.namebreakdown on the dogfood issue shows the error is cross-engine:Blink/Gecko don't reject the blob MIME type, so those events have a different cause: the worker fetch is aborted when the page navigates away / is backgrounded while the worker is still loading. The breadcrumbs consistently show
fetchaborts (status: None) plusTypeError: Load failed(Safari) /can't access dead object(Firefox) right before the failure — the signature of navigation-time teardown.WorkerHandler.ensureReady()'serrorhandler now routes through_getWorkerLoadError(), which distinguishes:ErrorEventwith a message → use it verbatim,This is a handled error (recording already falls back to the uncompressed buffer), so there's no behavior change beyond a more accurate captured message.
Risk
Higher than #22377 — it changes the error message for some genuine load failures that happen while a tab is hidden (they'll now read "page was hidden or unloaded" instead of the CSP/network catch-all). The hidden-document case is overwhelmingly teardown, but flagging for reviewer judgment. If we'd rather keep capturing those unchanged and only relabel navigation aborts, that's a small tweak.
Testing
ensureReadycases inWorkerHandler.test.tscover theErrorEvent.message, hidden-document (teardown), and visible-document (generic) branches.oxlint+oxfmtclean; eventBuffer suite (28) passes.