Repository navigation
🐛 Preserve app state during Chromium screenshots - #31
Merged
Merged
Conversation
Pause only capture-owned JavaScript while Chromium renders beyond the viewport, preserving queued callbacks and debugger ownership. Keep capture emulation synchronized with managed sizing and restore execution before accepting pixels.
Robdel12
force-pushed
the
rd/capture-viewport-fix-20261112
branch
from
November 12, 2026 07:25
a929222 to
74d665e
Compare
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.
Why
Chromium briefly emulates a 1 × 1 viewport during captures beyond the visible page. Vizzly’s full suite caught genuine screenshot cancellations, and app resize handlers can consume that temporary size.
Approach
Pause app JavaScript with a capture-owned debugger marker, capture through Playwright’s CDP session API, then resume before returning pixels. Queued callbacks survive; an existing developer debugger pause stays owned by the developer. Restoration failures close the context. Simply disabling scripts would lose callbacks.
Keep the capture session’s viewport, screen, pixel ratio, mobile orientation and touch behavior synchronized with Playwright. The other engines and viewport screenshots keep their existing implementation. Interactor execution and the document, viewport, ownership and cancellation checks stay unchanged.
Evidence
The old provider fails the real renderer-pressure regression with a smallest viewport of 1 instead of 800. The fix passes on macOS and constrained Linux. Real browser cases also cover queued notifications, navigation startup, debugger ownership, responsive sizing, long-page pixels, fractional DPR and touch restoration after capture errors.
The complete framework run passes 243 tests with two WebKit-only skips. Capture checks pass in Chromium, Firefox and WebKit; the generated documentation builds and passes its seven tests.
Vizzly passes all 355 tests in 44.6 seconds locally, retaining all 328 images and 304 published visual captures. Comparing against the prior local run leaves only 32 changed pixels across six images with the existing comparison settings. No retries, masks or comparison thresholds were added.