Repository navigation
A capture's progress survives the popup being closed - #65
Open
vhladiienko wants to merge 1 commit into
Open
vhladiienko wants to merge 1 commit into
vhladiienko wants to merge 1 commit into
Conversation
A full-page capture runs in the service worker for as long as the page is tall, and the popup that started it does not survive a click outside itself - MV3 tears a popup down the moment it loses focus. The popup a user reopened mid-capture was a new instance that never heard the capture begin: it sat on "No capture yet" while the page visibly scrolled, and nothing showed progress until the capture finished. The running capture now records how far it is - module state in the orchestrator, whose lifetime is exactly the capture's, since the capture in flight is what keeps the worker alive. A worker evicted mid-capture wakes blank and truthfully answers "nothing running"; no stored flag to go stale. The handler answers a captureState question with it, and a captureFinished broadcast tells an attached popup when it is over: after setLastCaptureUi on success, so the popup restores this capture rather than the one before it, and carrying the classified failure on error, so "the active tab changed" reaches the user instead of a bar that silently never fills. A popup now asks about a running capture before rendering the last one's result, attaches to it when it finds one (bar, count, disabled buttons), and hands over to the result - or the error - when the broadcast lands.
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
A full-page capture runs in the service worker for seconds, but the popup that started it is destroyed the moment it loses focus (MV3). When reopened mid-capture, the popup sat on "No capture yet" while the page visibly scrolled. The running capture is now queryable, and its end is broadcast:
orchestrator.tskeepscaptureProgressas module state — its lifetime is exactly the capture's, because the capture in flight is what keeps the worker alive. A worker evicted mid-capture wakes blank and truthfully answers "nothing running"; there is no stored flag to go stale. Cleared in afinally, so a capture that died halfway does not answer as if it were still going.background/index.tsanswerscaptureState, and broadcastscaptureFinishedaftersetLastCaptureUion success (so an attached popup restores this capture, not the one before it) and with the classified failure in the message listener's catch.popup.tsasks about a running capture before rendering the last one's result — the restore path reads tens of megabytes of preview out of blob-store and would flash the previous capture under the bar. If a capture is running it attaches; the existingcaptureProgressmessage listener then drives the bar as before. The popup that started the capture is untouched: it still learns the outcome from its own awaited reply.A side effect of the failure broadcast: a capture that fails while no popup is listening (e.g. the active tab changed) no longer loses the reason — a popup reopened afterwards shows what happened instead of silently reverting.
Evidence
New e2e tests in
e2e/progress.spec.ts(drive the realhandleRequestpath):Merge Danger
Door: two-way
Additive message types and a changed popup-open order; reverting restores prior behaviour. Nothing persisted, no schema, no permissions.
Blast Radius: popup + background messaging
The only behaviour change beyond the reopen fix: any failed capture request now emits a
captureFinishedbroadcast that non-attached popups ignore (guarded by an adopt flag), and a popup opened onto a running capture disables its buttons until the broadcast lands — which is what the original popup already did while its own capture ran.