Skip to content

🐛 Preserve app state during Chromium screenshots - #31

Merged
Robdel12 merged 1 commit into
mainfrom
rd/capture-viewport-fix-20261112
Nov 12, 2026
Merged

Robdel12 merged 1 commit into
mainfrom
rd/capture-viewport-fix-20261112

Conversation

@Robdel12

Copy link
Copy Markdown
Owner

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.

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
Robdel12 force-pushed the rd/capture-viewport-fix-20261112 branch from a929222 to 74d665e Compare November 12, 2026 07:25
@Robdel12
Robdel12 merged commit 6abdbfa into main Nov 12, 2026
82 of 84 checks passed
@Robdel12
Robdel12 deleted the rd/capture-viewport-fix-20261112 branch November 12, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant