fix(engine): defend macOS regular Chrome screenshots

Fixes #1699.
This commit is contained in:
Miguel Ángel
2026-06-24 19:21:46 -04:00
committed by GitHub
parent 821bf2921a
commit 89ff299a11
13 changed files with 819 additions and 15 deletions
@@ -19,6 +19,17 @@ export async function getCdpSession(page: Page): Promise<import("puppeteer-core"
return client;
}
export function shouldDefaultCaptureBeyondViewport(
browserVersion: string,
platform: NodeJS.Platform = process.platform,
): boolean {
// Regular Chrome's viewport-bound screenshot path can expose a compositor
// surface shorter than the page viewport on affected macOS builds. In that
// case Chrome fills the clipped area with the page background. Headless shell
// reports as HeadlessChrome and keeps the faster viewport-bound path.
return platform === "darwin" && browserVersion.startsWith("Chrome/");
}
/**
* BeginFrame result with screenshot data and damage detection.
*/