Skip to content

Write HTML. Render video. Built for agents.

fix(cli): macOS 12 users get Chrome 150 automatically and can render (#4185)

Miguel Ángel0cde88433071
diff --git a/packages/cli/src/browser/macosOldChromeCrash.ts b/packages/cli/src/browser/macosOldChromeCrash.ts
index 031caa7e24..1e5c4c63f0 100644
--- a/packages/cli/src/browser/macosOldChromeCrash.ts
+++ b/packages/cli/src/browser/macosOldChromeCrash.ts
@@ -58,16 +58,16 @@ export function macosOldChromeCrashRemediation(errorMessage: string): string | u
if (!isMacosOldChromeCrashError(errorMessage)) return undefined;
return [
"chrome-headless-shell crashed at launch (macOS dyld: Symbol not found in VideoToolbox).",
- "The pinned Chromium build requires macOS 13+; on macOS 12 or older, install an older",
- "chrome-headless-shell and point hyperframes at it:",
+ "The pinned Chromium build requires macOS 13+. HyperFrames installs Chrome 150 on macOS 12 by",
+ "itself, so this crash means a newer browser was supplied. Unset the override, or point it at",
+ "an older chrome-headless-shell:",
"",
" npx @puppeteer/browsers install chrome-headless-shell@150",
- ' export HYPERFRAMES_BROWSER_PATH="$HOME/.cache/puppeteer/chrome-headless-shell/mac-150.0.7422.0/chrome-headless-shell-mac-x64/chrome-headless-shell"',
+ ' export HYPERFRAMES_BROWSER_PATH="$HOME/.cache/puppeteer/chrome-headless-shell/mac-150.0.7871.124/chrome-headless-shell-mac-x64/chrome-headless-shell"',
"",
"(PRODUCER_HEADLESS_SHELL_PATH works as an alias for the same override.)",
- "Any working chrome-headless-shell build resolves this — the exact version above is one",
- "known-good macOS-12 combination. Alternatively, point HYPERFRAMES_BROWSER_PATH at your",
- 'installed Google Chrome ("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")',
- "to fall back to the screenshot capture path.",
+ "Alternatively, point HYPERFRAMES_BROWSER_PATH at your installed Google Chrome",
+ '("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome") to fall back to the screenshot',
+ "capture path.",
].join("\n");
}
diff --git a/packages/cli/src/browser/manager.test.ts b/packages/cli/src/browser/manager.test.ts
index c1de8c84c0..0490996773 100644
--- a/packages/cli/src/browser/manager.test.ts
+++ b/packages/cli/src/browser/manager.test.ts
@@ -23,7 +23,9 @@
*/
import { join, sep } from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { CHROME_VERSION } from "./manager.js";
+import { managedChromeVersion } from "./manager.js";
+
+const CHROME_VERSION = managedChromeVersion();
// Use `path.join` so the fake paths line up with whatever separator Node's
// real `path.join` produces in `manager.ts` on the host running the test
@@ -63,9 +65,17 @@ interface FsMockOptions {
dirs?: Record<string, string[]>;
touchError?: Error;
initialMtimeMs?: number;
+ /** what node:os reports; defaults to a Linux host */
+ osHost?: { platform: string; release: string };
}
-function installFsMocks({ existing, dirs, touchError, initialMtimeMs = 0 }: FsMockOptions) {
+function installFsMocks({
+ existing,
+ dirs,
+ touchError,
+ initialMtimeMs = 0,
+ osHost = { platform: "linux", release: "24.0.0" },
+}: FsMockOptions) {
// Mutable, and returned, so tests can pre-seed a "lock already held" path or
// assert the lock dir doesn't leak after ensureBrowser resolves.
const paths = new Set(existing);
@@ -132,7 +142,8 @@ function installFsMocks({ existing, dirs, touchError, initialMtimeMs = 0 }: FsMo
}));
vi.doMock("node:os", () => ({
homedir: () => FAKE_HOME,
- platform: () => "linux",
+ platform: () => osHost.platform,
+ release: () => osHost.release,
arch: () => "x64",
}));
return paths;
@@ -150,7 +161,7 @@ function installPuppeteerBrowsersMock(
browserPlatform?: string;
installedInHfCacheError?: Error;
installResult?: { executablePath: string };
- installImpl?: () => Promise<{ executablePath: string }>;
+ installImpl?: (options: { buildId: string }) => Promise<{ executablePath: string }>;
} = {},
) {
vi.doMock("@puppeteer/browsers", () => ({
@@ -190,8 +201,14 @@ describe("findBrowser — cache resolution", () => {
// Force Linux for the system-fallback warning assertions. The
// `Object.defineProperty` dance is needed because `process.platform` is a
// getter on Node — direct assignment is silently a no-op.
- Object.defineProperty(process, "platform", { value: "linux", configurable: true });
- Object.defineProperty(process, "arch", { value: "x64", configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: "linux",
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: "x64",
+ configurable: true,
+ });
delete process.env["HYPERFRAMES_BROWSER_PATH"];
delete process.env["PRODUCER_HEADLESS_SHELL_PATH"];
installChildProcessMocks();
@@ -199,8 +216,14 @@ describe("findBrowser — cache resolution", () => {
afterEach(() => {
vi.useRealTimers();
- Object.defineProperty(process, "platform", { value: origPlatform, configurable: true });
- Object.defineProperty(process, "arch", { value: origArch, configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: origPlatform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: origArch,
+ configurable: true,
+ });
vi.restoreAllMocks();
vi.doUnmock("node:fs");
vi.doUnmock("node:os");
@@ -215,7 +238,11 @@ describe("findBrowser — cache resolution", () => {
installFsMocks({ existing: new Set([HF_CACHE, HF_BINARY]) });
installPuppeteerBrowsersMock({
installedInHfCache: [
- { browser: "chrome-headless-shell", executablePath: HF_BINARY, buildId: CHROME_VERSION },
+ {
+ browser: "chrome-headless-shell",
+ executablePath: HF_BINARY,
+ buildId: CHROME_VERSION,
+ },
],
});
@@ -226,7 +253,10 @@ describe("findBrowser — cache resolution", () => {
});
it("hides the Windows console used by the where lookup", async () => {
- Object.defineProperty(process, "platform", { value: "win32", configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: "win32",
+ configurable: true,
+ });
installFsMocks({ existing: new Set() });
installPuppeteerBrowsersMock();
const execSync = vi.fn((command: string) =>
@@ -237,7 +267,10 @@ describe("findBrowser — cache resolution", () => {
const { findBrowser } = await import("./manager.js");
const result = await findBrowser();
- expect(result).toEqual({ executablePath: "C:\\Chrome\\chrome.exe", source: "system" });
+ expect(result).toEqual({
+ executablePath: "C:\\Chrome\\chrome.exe",
+ source: "system",
+ });
expect(execSync).toHaveBeenCalledWith(
"where google-chrome",
expect.objectContaining({ windowsHide: true }),
@@ -245,7 +278,10 @@ describe("findBrowser — cache resolution", () => {
});
it("finds Chrome in the standard Windows Program Files location", async () => {
- Object.defineProperty(process, "platform", { value: "win32", configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: "win32",
+ configurable: true,
+ });
const windowsChrome = join(
"C:\\Program Files",
"Google",
@@ -258,7 +294,10 @@ describe("findBrowser — cache resolution", () => {
const { findSystemBrowser } = await import("./manager.js");
- expect(findSystemBrowser()).toEqual({ executablePath: windowsChrome, source: "system" });
+ expect(findSystemBrowser()).toEqual({
+ executablePath: windowsChrome,
+ source: "system",
+ });
});
it("does not resolve to a hyperframes-cache build from an older CHROME_VERSION pin", async () => {
@@ -269,7 +308,11 @@ describe("findBrowser — cache resolution", () => {
installFsMocks({ existing: new Set([HF_CACHE, HF_BINARY, SYSTEM_CHROME]) });
installPuppeteerBrowsersMock({
installedInHfCache: [
- { browser: "chrome-headless-shell", executablePath: HF_BINARY, buildId: "131.0.6778.85" },
+ {
+ browser: "chrome-headless-shell",
+ executablePath: HF_BINARY,
+ buildId: "131.0.6778.85",
+ },
],
});
@@ -281,8 +324,14 @@ describe("findBrowser — cache resolution", () => {
});
it("ignores a current-version HyperFrames cache entry for another platform", async () => {
- Object.defineProperty(process, "platform", { value: "darwin", configurable: true });
- Object.defineProperty(process, "arch", { value: "arm64", configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: "darwin",
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: "arm64",
+ configurable: true,
+ });
const macArm64Binary = join(
HF_CACHE,
"chrome-headless-shell",
@@ -290,7 +339,9 @@ describe("findBrowser — cache resolution", () => {
"chrome-headless-shell-mac-arm64",
"chrome-headless-shell",
);
- installFsMocks({ existing: new Set([HF_CACHE, HF_BINARY, macArm64Binary]) });
+ installFsMocks({
+ existing: new Set([HF_CACHE, HF_BINARY, macArm64Binary]),
+ });
installPuppeteerBrowsersMock({
browserPlatform: "mac_arm",
installedInHfCache: [
@@ -327,7 +378,9 @@ describe("findBrowser — cache resolution", () => {
// The stale install DIR is present (extraction got partway through, e.g. an
// ABOUT/LICENSE-only extract) even though the exe itself is missing —
// exercises the purge-before-redownload fix, not just the redownload path.
- const paths = installFsMocks({ existing: new Set([HF_CACHE, staleInstallDir]) });
+ const paths = installFsMocks({
+ existing: new Set([HF_CACHE, staleInstallDir]),
+ });
installPuppeteerBrowsersMock({
installedInHfCache: [
{
@@ -344,7 +397,10 @@ describe("findBrowser — cache resolution", () => {
const { findBrowser } = await import("./manager.js");
const result = await findBrowser();
- expect(result).toEqual({ executablePath: redownloadedBinary, source: "download" });
+ expect(result).toEqual({
+ executablePath: redownloadedBinary,
+ source: "download",
+ });
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("Cached binary missing"));
// The stale directory must be gone before @puppeteer/browsers' install()
// sees it — otherwise install() throws "folder exists but exe missing"
@@ -364,7 +420,11 @@ describe("findBrowser — cache resolution", () => {
});
installPuppeteerBrowsersMock({
installedInHfCache: [
- { browser: "chrome-headless-shell", executablePath: HF_BINARY, path: staleInstallDir },
+ {
+ browser: "chrome-headless-shell",
+ executablePath: HF_BINARY,
+ path: staleInstallDir,
+ },
],
installResult: { executablePath: downloadedBinary },
});
@@ -372,7 +432,10 @@ describe("findBrowser — cache resolution", () => {
const { ensureBrowser } = await import("./manager.js");
const result = await ensureBrowser({ force: true });
- expect(result).toEqual({ executablePath: downloadedBinary, source: "download" });
+ expect(result).toEqual({
+ executablePath: downloadedBinary,
+ source: "download",
+ });
// clearBrowser() wipes prior contents; withInstallLock uses a sibling lock
// outside CACHE_DIR, so assert the purge on what was actually INSIDE it,
// not the directory's own existence.
@@ -382,7 +445,9 @@ describe("findBrowser — cache resolution", () => {
it("serializes concurrent force downloads so one purge cannot delete another installer's lock", async () => {
const downloadedBinary = join(HF_CACHE, "chrome-headless-shell", "force-downloaded");
- const paths = installFsMocks({ existing: new Set([CACHE_ROOT, HF_CACHE, HF_BINARY]) });
+ const paths = installFsMocks({
+ existing: new Set([CACHE_ROOT, HF_CACHE, HF_BINARY]),
+ });
let activeInstalls = 0;
let maxActiveInstalls = 0;
installPuppeteerBrowsersMock({
@@ -429,7 +494,10 @@ describe("findBrowser — cache resolution", () => {
const { ensureBrowser } = await import("./manager.js");
const result = await ensureBrowser();
- expect(result).toEqual({ executablePath: downloadedBinary, source: "download" });
+ expect(result).toEqual({
+ executablePath: downloadedBinary,
+ source: "download",
+ });
expect(paths.has(HF_LOCK)).toBe(false);
});
@@ -582,7 +650,10 @@ describe("findBrowser — cache resolution", () => {
const { findBrowser } = await import("./manager.js");
const result = await findBrowser();
- expect(result).toEqual({ executablePath: PUPPETEER_BINARY, source: "cache" });
+ expect(result).toEqual({
+ executablePath: PUPPETEER_BINARY,
+ source: "cache",
+ });
});
it.each([
@@ -619,8 +690,14 @@ describe("findBrowser — cache resolution", () => {
])(
"selects only the host-compatible cached shell on $hostPlatform/$hostArch when every platform is present",
async ({ hostPlatform, hostArch, expectedDirectory, expectedExecutable }) => {
- Object.defineProperty(process, "platform", { value: hostPlatform, configurable: true });
- Object.defineProperty(process, "arch", { value: hostArch, configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: hostPlatform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: hostArch,
+ configurable: true,
+ });
const version = "host-148.0.7778.97";
const candidates = [
["chrome-headless-shell-linux64", "chrome-headless-shell"],
@@ -642,7 +719,10 @@ describe("findBrowser — cache resolution", () => {
const { findBrowser } = await import("./manager.js");
const result = await findBrowser();
- expect(result).toEqual({ executablePath: expectedBinary, source: "cache" });
+ expect(result).toEqual({
+ executablePath: expectedBinary,
+ source: "cache",
+ });
},
);
@@ -652,8 +732,14 @@ describe("findBrowser — cache resolution", () => {
])(
"does not select a foreign cached shell on unsupported $hostPlatform/$hostArch",
async ({ hostPlatform, hostArch }) => {
- Object.defineProperty(process, "platform", { value: hostPlatform, configurable: true });
- Object.defineProperty(process, "arch", { value: hostArch, configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: hostPlatform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: hostArch,
+ configurable: true,
+ });
const version = "host-148.0.7778.97";
const binaries = [
join(PUPPETEER_CACHE, version, "chrome-headless-shell-linux64", "chrome-headless-shell"),
@@ -701,7 +787,9 @@ describe("findBrowser — cache resolution", () => {
);
installFsMocks({
existing: new Set([PUPPETEER_CACHE, PUPPETEER_BINARY, olderBinary]),
- dirs: { [PUPPETEER_CACHE]: ["linux-131.0.6778.85", "linux-148.0.7778.97"] },
+ dirs: {
+ [PUPPETEER_CACHE]: ["linux-131.0.6778.85", "linux-148.0.7778.97"],
+ },
});
installPuppeteerBrowsersMock();
@@ -727,7 +815,9 @@ describe("findBrowser — cache resolution", () => {
existing: new Set([PUPPETEER_CACHE, PUPPETEER_BINARY, linux99Binary]),
// Intentionally list the entries in an order that would expose the bug
// under naive `.sort().reverse()` (which puts `linux-99...` first).
- dirs: { [PUPPETEER_CACHE]: ["linux-99.0.6533.123", "linux-148.0.7778.97"] },
+ dirs: {
+ [PUPPETEER_CACHE]: ["linux-99.0.6533.123", "linux-148.0.7778.97"],
+ },
});
installPuppeteerBrowsersMock();
@@ -824,7 +914,10 @@ describe("findBrowser — cache resolution", () => {
// macOS Chrome still works fine for the screenshot path and the perf
// claims around BeginFrame are Linux-only — keep the warning Linux-scoped
// so darwin users don't get spammed about a "fix" that doesn't apply.
- Object.defineProperty(process, "platform", { value: "darwin", configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: "darwin",
+ configurable: true,
+ });
const darwinChrome = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
installFsMocks({ existing: new Set([darwinChrome]) });
vi.doMock("@puppeteer/browsers", () => ({
@@ -948,8 +1041,14 @@ describe("downloadBrowser — install failure surfaces HYPERFRAMES_BROWSER_PATH
});
afterEach(() => {
- Object.defineProperty(process, "platform", { value: origPlatform, configurable: true });
- Object.defineProperty(process, "arch", { value: origArch, configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: origPlatform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: origArch,
+ configurable: true,
+ });
vi.restoreAllMocks();
vi.doUnmock("node:fs");
vi.doUnmock("node:os");
@@ -984,8 +1083,14 @@ describe("downloadBrowser — install failure surfaces HYPERFRAMES_BROWSER_PATH
])(
"rethrows a non-corrupt install failure with an HYPERFRAMES_BROWSER_PATH hint and preserves the original via cause ($label)",
async ({ platform, arch, expectedPathHint }) => {
- Object.defineProperty(process, "platform", { value: platform, configurable: true });
- Object.defineProperty(process, "arch", { value: arch, configurable: true });
+ Object.defineProperty(process, "platform", {
+ value: platform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: arch,
+ configurable: true,
+ });
// No cache, no system Chrome — forces the download-of-last-resort path
// that ends in @puppeteer/browsers install().
@@ -1059,3 +1164,158 @@ describe("@puppeteer/browsers pin (HF#2103 extractor-hang regression guard)", ()
expect(deps["yauzl"]).toBeUndefined();
});
});
+
+describe("browser resolution on macOS 12 (Darwin < 22)", () => {
+ const MAC_12 = { platform: "darwin", release: "21.6.0" };
+ const MAC_13 = { platform: "darwin", release: "22.1.0" };
+ const OLD_BUILD = "150.0.7871.124";
+ const MAC_HF_BINARY = join(HF_CACHE, "chrome-headless-shell", "mac-x", "chrome-headless-shell");
+ const macPuppeteerBinary = (dir: string) =>
+ join(PUPPETEER_CACHE, dir, "chrome-headless-shell-mac-x64", "chrome-headless-shell");
+
+ const origPlatform = process.platform;
+ const origArch = process.arch;
+
+ beforeEach(() => {
+ vi.resetModules();
+ delete process.env["HYPERFRAMES_BROWSER_PATH"];
+ delete process.env["PRODUCER_HEADLESS_SHELL_PATH"];
+ installChildProcessMocks();
+ Object.defineProperty(process, "platform", {
+ value: "darwin",
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: "x64",
+ configurable: true,
+ });
+ });
+
+ afterEach(() => {
+ Object.defineProperty(process, "platform", {
+ value: origPlatform,
+ configurable: true,
+ });
+ Object.defineProperty(process, "arch", {
+ value: origArch,
+ configurable: true,
+ });
+ vi.unstubAllEnvs();
+ vi.doUnmock("node:fs");
+ vi.doUnmock("node:os");
+ vi.doUnmock("node:child_process");
+ vi.doUnmock("@puppeteer/browsers");
+ });
+
+ it.each([
+ { host: MAC_12, expected: OLD_BUILD },
+ { host: MAC_13, expected: "152.0.7977.30" },
+ ])("downloads $expected on $host.release", async ({ host, expected }) => {
+ installFsMocks({ existing: new Set(), osHost: host });
+ const install = vi.fn(async () => ({ executablePath: MAC_HF_BINARY }));
+ installPuppeteerBrowsersMock({
+ installImpl: install,
+ browserPlatform: "mac",
+ });
+ const { ensureBrowser } = await import("./manager.js");
+
+ await ensureBrowser({ preferManagedChrome: true });
+
+ expect(install).toHaveBeenCalledWith(expect.objectContaining({ buildId: expected }));
+ });
+
+ it("ignores a cached newer managed build on macOS 12", async () => {
+ installFsMocks({
+ existing: new Set([HF_CACHE, MAC_HF_BINARY]),
+ osHost: MAC_12,
+ });
+ installPuppeteerBrowsersMock({
+ browserPlatform: "mac",
+ installedInHfCache: [
+ {
+ browser: "chrome-headless-shell",
+ executablePath: MAC_HF_BINARY,
+ buildId: "152.0.7977.30",
+ },
+ ],
+ });
+ const { findBrowser } = await import("./manager.js");
+
+ await expect(findBrowser()).resolves.toBeUndefined();
+ });
+
+ it("uses the cached macOS 12 build on macOS 12", async () => {
+ installFsMocks({
+ existing: new Set([HF_CACHE, MAC_HF_BINARY]),
+ osHost: MAC_12,
+ });
+ installPuppeteerBrowsersMock({
+ browserPlatform: "mac",
+ installedInHfCache: [
+ {
+ browser: "chrome-headless-shell",
+ executablePath: MAC_HF_BINARY,
+ buildId: OLD_BUILD,
+ },
+ ],
+ });
+ const { findBrowser } = await import("./manager.js");
+
+ await expect(findBrowser()).resolves.toEqual({
+ executablePath: MAC_HF_BINARY,
+ source: "cache",
+ });
+ });
+
+ it("skips a puppeteer-cache build newer than 150 on macOS 12 but keeps 150", async () => {
+ installFsMocks({
+ existing: new Set([
+ PUPPETEER_CACHE,
+ macPuppeteerBinary("mac-152.0.7977.30"),
+ macPuppeteerBinary("mac-150.0.7871.124"),
+ ]),
+ dirs: { [PUPPETEER_CACHE]: ["mac-152.0.7977.30", "mac-150.0.7871.124"] },
+ osHost: MAC_12,
+ });
+ installPuppeteerBrowsersMock({ browserPlatform: "mac" });
+ const { findBrowser } = await import("./manager.js");
+
+ await expect(findBrowser()).resolves.toEqual({
+ executablePath: macPuppeteerBinary("mac-150.0.7871.124"),
+ source: "cache",
+ });
+ });
+
+ it("keeps the newest puppeteer-cache build on macOS 13", async () => {
+ installFsMocks({
+ existing: new Set([
+ PUPPETEER_CACHE,
+ macPuppeteerBinary("mac-152.0.7977.30"),
+ macPuppeteerBinary("mac-150.0.7871.124"),
+ ]),
+ dirs: { [PUPPETEER_CACHE]: ["mac-152.0.7977.30", "mac-150.0.7871.124"] },
+ osHost: MAC_13,
+ });
+ installPuppeteerBrowsersMock({ browserPlatform: "mac" });
+ const { findBrowser } = await import("./manager.js");
+
+ await expect(findBrowser()).resolves.toEqual({
+ executablePath: macPuppeteerBinary("mac-152.0.7977.30"),
+ source: "cache",
+ });
+ });
+
+ it("lets HYPERFRAMES_BROWSER_PATH win on macOS 12", async () => {
+ const envBinary = join("/", "opt", "my-chrome");
+ vi.stubEnv("HYPERFRAMES_BROWSER_PATH", envBinary);
+ installFsMocks({ existing: new Set([envBinary]), osHost: MAC_12 });
+ installPuppeteerBrowsersMock({ browserPlatform: "mac" });
+ const { ensureBrowser } = await import("./manager.js");
+
+ await expect(ensureBrowser({ preferManagedChrome: true })).resolves.toEqual({
+ executablePath: envBinary,
+ source: "env",
+ });
+ vi.unstubAllEnvs();
+ });
+});
diff --git a/packages/cli/src/browser/manager.ts b/packages/cli/src/browser/manager.ts
index e8ed9973ff..6ed2cfd578 100644
--- a/packages/cli/src/browser/manager.ts
+++ b/packages/cli/src/browser/manager.ts
@@ -14,6 +14,7 @@ import {
import { basename } from "node:path";
import { homedir } from "node:os";
import { join } from "node:path";
+import { chromeMajorCeiling, exceedsChromeCeiling } from "@hyperframes/engine/chrome-host-ceiling";
import { normalizeErrorMessage } from "../utils/errorMessage.js";
import { runRenderSetupWorker } from "../utils/cancellableProcess.js";
@@ -47,6 +48,14 @@ async function loadPuppeteerBrowsers(): Promise<PuppeteerBrowsers> {
// Deliberately Beta, not Canary. 153.0.8000.0 measured identical to this build
// on every probe variant, so crossing a major buys nothing measurable.
const CHROME_VERSION = "152.0.7977.30";
+// Last headless-shell milestone that launches on macOS 12 (Darwin < 22); Chrome 151 dropped it.
+// Measured: this build exposes canvas.drawElementImage under --enable-features=CanvasDrawElement.
+const MACOS_12_CHROME_VERSION = "150.0.7871.124";
+
+/** The one place that decides which build HyperFrames installs and matches in its own cache. */
+function managedChromeVersion(): string {
+ return chromeMajorCeiling() === undefined ? CHROME_VERSION : MACOS_12_CHROME_VERSION;
+}
const CACHE_ROOT_DIR = join(homedir(), ".cache", "hyperframes");
const CACHE_DIR = join(homedir(), ".cache", "hyperframes", "chrome");
// Puppeteer's managed cache — where `@puppeteer/browsers install
@@ -244,10 +253,10 @@ export interface EnsureBrowserOptions {
// arbitrary version, doesn't get updated in lockstep with this codebase).
// Rendering behavior should not vary with whatever Chrome happens to be
// sitting on the machine: it's the version we've actually tested against,
- // and the one that implements `canvas.drawElementImage` (Dev/Canary-only —
- // Stable doesn't have it, so system Chrome used to crash drawElement-
- // eligible renders outright; HF#2060). `HYPERFRAMES_BROWSER_PATH` still
- // wins over this — an explicit override is still an explicit override.
+ // and the one known to implement `canvas.drawElementImage`. A build without
+ // it no longer crashes (the engine probes and falls back to screenshot
+ // capture), it just renders slower. `HYPERFRAMES_BROWSER_PATH` still wins
+ // over this — an explicit override is still an explicit override.
preferManagedChrome?: boolean;
signal?: AbortSignal;
}
@@ -383,7 +392,7 @@ async function findFromHyperframesCache(): Promise<CacheLookupResult> {
const match = installed.find(
(b) =>
b.browser === Browser.CHROMEHEADLESSSHELL &&
- b.buildId === CHROME_VERSION &&
+ b.buildId === managedChromeVersion() &&
b.platform === hostPlatform,
);
if (match && existsSync(match.executablePath)) {
@@ -500,7 +509,9 @@ function findFromPuppeteerCache(): BrowserResult | undefined {
} catch {
return undefined;
}
+ const ceiling = chromeMajorCeiling();
for (const version of versions) {
+ if (exceedsChromeCeiling(version, ceiling)) continue;
// Same shape as `resolveHeadlessShellPath` in engine/browserManager.ts —
// keep them aligned. If puppeteer ever changes the on-disk layout the two
// need to move together.
@@ -804,7 +815,7 @@ function wrapDownloadFailureWithBrowserPathHint(cause: unknown): Error {
const original = normalizeErrorMessage(cause);
const example = browserPathHintForPlatform();
const message =
- `Failed to download chrome-headless-shell ${CHROME_VERSION}: ${original}\n\n` +
+ `Failed to download chrome-headless-shell ${managedChromeVersion()}: ${original}\n\n` +
`Point hyperframes at an already-installed Chrome/Chromium instead:\n\n` +
` export HYPERFRAMES_BROWSER_PATH="${example}"\n\n` +
`Then re-run your command. Any Chrome build works for the screenshot ` +
@@ -830,7 +841,7 @@ async function downloadBrowser(options?: EnsureBrowserOptions): Promise<BrowserR
install({
cacheDir: CACHE_DIR,
browser: Browser.CHROMEHEADLESSSHELL,
- buildId: CHROME_VERSION,
+ buildId: managedChromeVersion(),
platform,
downloadProgressCallback: options?.onProgress,
});
@@ -871,4 +882,4 @@ export function isLinuxArm(): boolean {
return process.platform === "linux" && process.arch === "arm64";
}
-export { CHROME_VERSION, CACHE_DIR };
+export { CACHE_DIR, managedChromeVersion };
diff --git a/packages/cli/src/commands/browser.ts b/packages/cli/src/commands/browser.ts
index 6be367d3ae..041e16c5aa 100644
--- a/packages/cli/src/commands/browser.ts
+++ b/packages/cli/src/commands/browser.ts
@@ -15,7 +15,7 @@ import {
ensureBrowser,
findBrowser,
clearBrowser,
- CHROME_VERSION,
+ managedChromeVersion,
CACHE_DIR,
isLinuxArm,
} from "../browser/manager.js";
@@ -78,7 +78,7 @@ async function runEnsure(options?: { force?: boolean }): Promise<void> {
if (pct > lastPct) {
lastPct = pct;
s.message(
- `Downloading Chrome Headless Shell ${c.dim("v" + CHROME_VERSION)} — ${c.progress(pct + "%")} ${c.dim("(" + formatBytes(downloaded) + " / " + formatBytes(total) + ")")}`,
+ `Downloading Chrome Headless Shell ${c.dim("v" + managedChromeVersion())} — ${c.progress(pct + "%")} ${c.dim("(" + formatBytes(downloaded) + " / " + formatBytes(total) + ")")}`,
);
}
},
@@ -97,7 +97,9 @@ async function runEnsure(options?: { force?: boolean }): Promise<void> {
s.start("Purging cached download and re-downloading...");
const downloadSpinner = clack.spinner();
- downloadSpinner.start(`Downloading Chrome Headless Shell ${c.dim("v" + CHROME_VERSION)}...`);
+ downloadSpinner.start(
+ `Downloading Chrome Headless Shell ${c.dim("v" + managedChromeVersion())}...`,
+ );
let lastPct = -1;
const result = await ensureBrowser({
@@ -108,7 +110,7 @@ async function runEnsure(options?: { force?: boolean }): Promise<void> {
if (pct > lastPct) {
lastPct = pct;
downloadSpinner.message(
- `Downloading Chrome Headless Shell ${c.dim("v" + CHROME_VERSION)} — ${c.progress(pct + "%")} ${c.dim("(" + formatBytes(downloaded) + " / " + formatBytes(total) + ")")}`,
+ `Downloading Chrome Headless Shell ${c.dim("v" + managedChromeVersion())} — ${c.progress(pct + "%")} ${c.dim("(" + formatBytes(downloaded) + " / " + formatBytes(total) + ")")}`,
);
}
},
diff --git a/packages/cli/tsup.config.ts b/packages/cli/tsup.config.ts
index 801642efae..50365fb20f 100644
--- a/packages/cli/tsup.config.ts
+++ b/packages/cli/tsup.config.ts
@@ -91,7 +91,11 @@ var __dirname = __hf_dirname(__filename);`,
// Exact subpaths are generated from the same contracts as package
// exports, avoiding esbuild's root-alias prefix substitution trap.
...sourceAliases(resolve(__dirname, "../producer"), [".", "./distributed"]),
- ...sourceAliases(resolve(__dirname, "../engine"), [".", "./shader-transitions"]),
+ ...sourceAliases(resolve(__dirname, "../engine"), [
+ ".",
+ "./chrome-host-ceiling",
+ "./shader-transitions",
+ ]),
};
options.loader = { ...options.loader, ".browser.js": "text" };
},
diff --git a/packages/engine/package-subpaths.json b/packages/engine/package-subpaths.json
index 285d44f41d..6c3390f6be 100644
--- a/packages/engine/package-subpaths.json
+++ b/packages/engine/package-subpaths.json
@@ -13,6 +13,12 @@
"types": "./dist/utils/alphaBlit.d.ts",
"environments": ["bun", "node"]
},
+ "./chrome-host-ceiling": {
+ "source": "./src/services/chromeHostCeiling.ts",
+ "runtime": "./dist/services/chromeHostCeiling.js",
+ "types": "./dist/services/chromeHostCeiling.d.ts",
+ "environments": ["bun", "node"]
+ },
"./shader-transitions": {
"source": "./src/utils/shaderTransitions.ts",
"runtime": "./dist/utils/shaderTransitions.js",
diff --git a/packages/engine/package.json b/packages/engine/package.json
index 00feb90850..cff78a0d82 100644
--- a/packages/engine/package.json
+++ b/packages/engine/package.json
@@ -25,6 +25,11 @@
"import": "./src/utils/alphaBlit.ts",
"types": "./src/utils/alphaBlit.ts"
},
+ "./chrome-host-ceiling": {
+ "bun": "./src/services/chromeHostCeiling.ts",
+ "import": "./src/services/chromeHostCeiling.ts",
+ "types": "./src/services/chromeHostCeiling.ts"
+ },
"./shader-transitions": {
"bun": "./src/utils/shaderTransitions.ts",
"import": "./src/utils/shaderTransitions.ts",
@@ -43,6 +48,10 @@
"import": "./dist/utils/alphaBlit.js",
"types": "./dist/utils/alphaBlit.d.ts"
},
+ "./chrome-host-ceiling": {
+ "import": "./dist/services/chromeHostCeiling.js",
+ "types": "./dist/services/chromeHostCeiling.d.ts"
+ },
"./shader-transitions": {
"import": "./dist/utils/shaderTransitions.js",
"types": "./dist/utils/shaderTransitions.d.ts"
diff --git a/packages/engine/src/config.test.ts b/packages/engine/src/config.test.ts
index 55b83f2848..4098b4cc87 100644
--- a/packages/engine/src/config.test.ts
+++ b/packages/engine/src/config.test.ts
@@ -256,6 +256,24 @@ describe("resolveConfig", () => {
describe("explainDrawElementDisabled (names the silent refusals)", () => {
const base = { browserGpuMode: "hardware" as const, workerEncode: true };
+ it("turns fast capture off by default on a host capped at Chrome 150, unless opted in", () => {
+ const args = {
+ useDrawElement: true,
+ platform: "darwin" as const,
+ browserGpuMode: "hardware" as const,
+ workerEncode: true,
+ chromeCeiling: 150,
+ };
+ expect(resolveDefaultDrawElement({ ...args, explicitOptIn: false })).toBe(false);
+ expect(resolveDefaultDrawElement({ ...args, explicitOptIn: true })).toBe(true);
+ expect(
+ resolveDefaultDrawElement({ ...args, chromeCeiling: undefined, explicitOptIn: false }),
+ ).toBe(true);
+ expect(explainDrawElementDisabled({ ...base, platform: "darwin", chromeCeiling: 150 })).toBe(
+ "old_chrome",
+ );
+ });
+
it("names each refusal", () => {
expect(explainDrawElementDisabled({ ...base, platform: "linux" })).toBe(
"unsupported_platform",
diff --git a/packages/engine/src/config.ts b/packages/engine/src/config.ts
index 2c7c98472c..fd6c4af07f 100644
--- a/packages/engine/src/config.ts
+++ b/packages/engine/src/config.ts
@@ -7,6 +7,7 @@
*/
import { tmpdir } from "node:os";
+import { chromeMajorCeiling } from "./services/chromeHostCeiling.js";
import { join } from "node:path";
import {
getSystemTotalMb,
@@ -745,9 +746,12 @@ export function resolveDefaultDrawElement(args: {
platform: NodeJS.Platform;
browserGpuMode: EngineConfig["browserGpuMode"];
workerEncode: boolean;
+ /** Set on hosts that cannot run Chrome 151+; Chrome <=150 damages video and stacked fades. */
+ chromeCeiling?: number;
}): boolean {
if (!args.useDrawElement) return false;
if (args.explicitOptIn) return true;
+ if (args.chromeCeiling !== undefined) return false;
if (!isDrawElementPlatform(args.platform) || args.browserGpuMode === "software") return false;
return args.workerEncode;
}
@@ -777,9 +781,11 @@ export function explainDrawElementDisabled(args: {
platform: NodeJS.Platform;
browserGpuMode: EngineConfig["browserGpuMode"];
workerEncode: boolean;
-}): "unsupported_platform" | "software_gpu" | "worker_encode_off" | "disabled" {
+ chromeCeiling?: number;
+}): "unsupported_platform" | "old_chrome" | "software_gpu" | "worker_encode_off" | "disabled" {
// Platform first: on an unsupported host the GPU mode is beside the point.
if (!isDrawElementPlatform(args.platform)) return "unsupported_platform";
+ if (args.chromeCeiling !== undefined) return "old_chrome";
if (args.browserGpuMode === "software") return "software_gpu";
if (!args.workerEncode) return "worker_encode_off";
return "disabled";
@@ -970,6 +976,7 @@ export function resolveConfig(overrides?: Partial<EngineConfig>): EngineConfig {
platform: process.platform,
browserGpuMode: merged.browserGpuMode,
workerEncode: merged.enableDrawElementWorkerEncode,
+ chromeCeiling: chromeMajorCeiling(),
});
// Software GPU implies screenshot capture.
diff --git a/packages/engine/src/index.ts b/packages/engine/src/index.ts
index a9e8874818..6806092c03 100644
--- a/packages/engine/src/index.ts
+++ b/packages/engine/src/index.ts
@@ -74,6 +74,7 @@ export {
} from "./services/systemMemory.js";
// ── Browser management ─────────────────────────────────────────────────────────
+export { chromeMajorCeiling } from "./services/chromeHostCeiling.js";
export {
acquireBrowser,
releaseBrowser,
diff --git a/packages/engine/src/services/browserManager.test.ts b/packages/engine/src/services/browserManager.test.ts
index e6543efe0e..d3f1af385a 100644
--- a/packages/engine/src/services/browserManager.test.ts
+++ b/packages/engine/src/services/browserManager.test.ts
@@ -525,6 +525,44 @@ describe("resolveBrowserGpuMode", () => {
});
});
+// CodeQL js/bad-code-sanitization: values must never be woven into the eval
+// string itself. This script is a fixed constant; every variable (module
+// URL, faked platform/arch, faked os.release) crosses as an env var instead.
+const RESOLVE_HEADLESS_SHELL_SUBPROCESS_SCRIPT = `
+ if (process.env.HF_TEST_PLATFORM) {
+ Object.defineProperty(process, "platform", { value: process.env.HF_TEST_PLATFORM });
+ }
+ if (process.env.HF_TEST_ARCH) {
+ Object.defineProperty(process, "arch", { value: process.env.HF_TEST_ARCH });
+ }
+ if (process.env.HF_TEST_OS_RELEASE) {
+ const os = require("node:os");
+ os.release = () => process.env.HF_TEST_OS_RELEASE;
+ require("node:module").syncBuiltinESMExports();
+ }
+ import(process.env.HF_TEST_MODULE_URL).then(({ resolveHeadlessShellPath }) => {
+ process.stdout.write(resolveHeadlessShellPath({}) ?? "");
+ });
+`;
+
+/** Runs resolveHeadlessShellPath in a subprocess with a faked platform/arch/os.release. */
+function resolveHeadlessShellInSubprocess(
+ env: NodeJS.ProcessEnv,
+ fakes: { platform?: string; arch?: string; osRelease?: string } = {},
+): string {
+ const moduleUrl = new URL("./browserManager.ts", import.meta.url).href;
+ return execFileSync("bun", ["--eval", RESOLVE_HEADLESS_SHELL_SUBPROCESS_SCRIPT], {
+ encoding: "utf8",
+ env: {
+ ...env,
+ HF_TEST_MODULE_URL: moduleUrl,
+ ...(fakes.platform ? { HF_TEST_PLATFORM: fakes.platform } : {}),
+ ...(fakes.arch ? { HF_TEST_ARCH: fakes.arch } : {}),
+ ...(fakes.osRelease ? { HF_TEST_OS_RELEASE: fakes.osRelease } : {}),
+ },
+ });
+}
+
describe("resolveHeadlessShellPath", () => {
const originalHeadlessShellPath = process.env.PRODUCER_HEADLESS_SHELL_PATH;
const originalHyperframesBrowserPath = process.env.HYPERFRAMES_BROWSER_PATH;
@@ -618,18 +656,11 @@ describe("resolveHeadlessShellPath", () => {
const env = { ...process.env, HOME: home, USERPROFILE: home };
delete env.PRODUCER_HEADLESS_SHELL_PATH;
delete env.HYPERFRAMES_BROWSER_PATH;
- const moduleUrl = new URL("./browserManager.ts", import.meta.url).href;
- const label = `execFileSync(bun --eval) ${hostPlatform}/${hostArch} [compatible]`;
- console.time(label);
- const stdout = execFileSync(
- "bun",
- [
- "--eval",
- `Object.defineProperty(process, "platform", { value: ${JSON.stringify(hostPlatform)} }); Object.defineProperty(process, "arch", { value: ${JSON.stringify(hostArch)} }); import(${JSON.stringify(moduleUrl)}).then(({ resolveHeadlessShellPath }) => process.stdout.write(resolveHeadlessShellPath({}) ?? ""))`,
- ],
- { encoding: "utf8", env },
- );
- console.timeEnd(label);
+ const stdout = resolveHeadlessShellInSubprocess(env, {
+ platform: hostPlatform,
+ arch: hostArch,
+ osRelease: "24.0.0",
+ });
expect(stdout).toBe(expectedBinary);
} finally {
@@ -665,18 +696,11 @@ describe("resolveHeadlessShellPath", () => {
const env = { ...process.env, HOME: home, USERPROFILE: home };
delete env.PRODUCER_HEADLESS_SHELL_PATH;
delete env.HYPERFRAMES_BROWSER_PATH;
- const moduleUrl = new URL("./browserManager.ts", import.meta.url).href;
- const label = `execFileSync(bun --eval) ${hostPlatform}/${hostArch} [unsupported]`;
- console.time(label);
- const stdout = execFileSync(
- "bun",
- [
- "--eval",
- `Object.defineProperty(process, "platform", { value: ${JSON.stringify(hostPlatform)} }); Object.defineProperty(process, "arch", { value: ${JSON.stringify(hostArch)} }); import(${JSON.stringify(moduleUrl)}).then(({ resolveHeadlessShellPath }) => process.stdout.write(resolveHeadlessShellPath({}) ?? ""))`,
- ],
- { encoding: "utf8", env },
- );
- console.timeEnd(label);
+ const stdout = resolveHeadlessShellInSubprocess(env, {
+ platform: hostPlatform,
+ arch: hostArch,
+ osRelease: "24.0.0",
+ });
expect(stdout).toBe("");
} finally {
@@ -708,23 +732,46 @@ describe("resolveHeadlessShellPath", () => {
const env = { ...process.env, HOME: home, USERPROFILE: home };
delete env.PRODUCER_HEADLESS_SHELL_PATH;
delete env.HYPERFRAMES_BROWSER_PATH;
- const moduleUrl = new URL("./browserManager.ts", import.meta.url).href;
- console.time("execFileSync(bun --eval) reuse-cache");
- const stdout = execFileSync(
- "bun",
- [
- "--eval",
- `Object.defineProperty(process, "platform", { value: "linux" }); Object.defineProperty(process, "arch", { value: "x64" }); import(${JSON.stringify(moduleUrl)}).then(({ resolveHeadlessShellPath }) => process.stdout.write(resolveHeadlessShellPath({}) ?? ""))`,
- ],
- { encoding: "utf8", env },
- );
- console.timeEnd("execFileSync(bun --eval) reuse-cache");
+ const stdout = resolveHeadlessShellInSubprocess(env, { platform: "linux", arch: "x64" });
expect(stdout).toBe(binary);
} finally {
rmSync(home, { recursive: true, force: true });
}
});
+
+ it("skips managed-cache builds newer than Chrome 150 on macOS 12", () => {
+ const home = mkdtempSync(join(tmpdir(), "hyperframes-engine-browser-macos12-"));
+ try {
+ const shell = (version: string) =>
+ join(
+ home,
+ ".cache",
+ "hyperframes",
+ "chrome",
+ "chrome-headless-shell",
+ `mac-${version}`,
+ "chrome-headless-shell-mac-x64",
+ "chrome-headless-shell",
+ );
+ for (const version of ["152.0.7977.30", "150.0.7871.124"]) {
+ mkdirSync(join(shell(version), ".."), { recursive: true });
+ writeFileSync(shell(version), "");
+ }
+ const env = { ...process.env, HOME: home, USERPROFILE: home };
+ delete env.PRODUCER_HEADLESS_SHELL_PATH;
+ delete env.HYPERFRAMES_BROWSER_PATH;
+ const stdout = resolveHeadlessShellInSubprocess(env, {
+ platform: "darwin",
+ arch: "x64",
+ osRelease: "21.6.0",
+ });
+
+ expect(stdout).toBe(shell("150.0.7871.124"));
+ } finally {
+ rmSync(home, { recursive: true, force: true });
+ }
+ });
});
describe("forceReleaseBrowser", () => {
diff --git a/packages/engine/src/services/browserManager.ts b/packages/engine/src/services/browserManager.ts
index 43f63f1a04..96c358b354 100644
--- a/packages/engine/src/services/browserManager.ts
+++ b/packages/engine/src/services/browserManager.ts
@@ -11,6 +11,7 @@ import { execSync } from "child_process";
import { existsSync, readdirSync } from "fs";
import { join } from "path";
import { homedir } from "os";
+import { chromeMajorCeiling, exceedsChromeCeiling } from "./chromeHostCeiling.js";
import { DEFAULT_CONFIG, type EngineConfig } from "../config.js";
import { getSystemTotalMb, LOW_MEMORY_TOTAL_MB_THRESHOLD } from "./systemMemory.js";
import {
@@ -162,8 +163,10 @@ function findCachedHeadlessShell(baseDir: string): string | undefined {
const executable = cachedHeadlessShellExecutable();
if (!executable) return undefined;
try {
+ const ceiling = chromeMajorCeiling();
const versions = readdirSync(baseDir).sort(compareBrowserVersionsDescending);
for (const version of versions) {
+ if (exceedsChromeCeiling(version, ceiling)) continue;
const binary = join(baseDir, version, ...executable);
if (existsSync(binary)) return binary;
}
diff --git a/packages/engine/src/services/chromeHostCeiling.test.ts b/packages/engine/src/services/chromeHostCeiling.test.ts
new file mode 100644
index 0000000000..76d16d3c17
--- /dev/null
+++ b/packages/engine/src/services/chromeHostCeiling.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from "vitest";
+import { chromeMajorCeiling, exceedsChromeCeiling } from "./chromeHostCeiling.js";
+
+describe("chromeMajorCeiling", () => {
+ it.each([
+ ["darwin", "21.6.0", 150],
+ ["darwin", "22.1.0", undefined],
+ ["linux", "21.0.0", undefined],
+ ["win32", "10.0.19045", undefined],
+ ])("%s %s -> %s", (platform, release, expected) => {
+ expect(chromeMajorCeiling(platform, release)).toBe(expected);
+ });
+});
+
+describe("exceedsChromeCeiling", () => {
+ it.each([
+ ["mac-152.0.7977.30", 150, true],
+ ["mac_arm-150.0.7871.124", 150, false],
+ ["151.0.1.2", 150, true],
+ ["mac-152.0.7977.30", undefined, false],
+ ])("%s with ceiling %s -> %s", (name, ceiling, expected) => {
+ expect(exceedsChromeCeiling(name, ceiling)).toBe(expected);
+ });
+});
diff --git a/packages/engine/src/services/chromeHostCeiling.ts b/packages/engine/src/services/chromeHostCeiling.ts
new file mode 100644
index 0000000000..55d93f267b
--- /dev/null
+++ b/packages/engine/src/services/chromeHostCeiling.ts
@@ -0,0 +1,20 @@
+import { release } from "node:os";
+
+/** Chrome 151 dropped macOS 12 and older (Darwin < 22); 150 is the last major that launches there. */
+const MACOS_12_LAST_CHROME_MAJOR = 150;
+
+/** Newest Chrome major this host can run, or undefined when it has no ceiling. */
+export function chromeMajorCeiling(
+ hostPlatform: string = process.platform,
+ hostRelease: string = release(),
+): number | undefined {
+ if (hostPlatform !== "darwin") return undefined;
+ return Number.parseInt(hostRelease, 10) < 22 ? MACOS_12_LAST_CHROME_MAJOR : undefined;
+}
+
+/** True when a cache dir name (`mac-152.0.1.2`) or build id (`152.0.1.2`) is newer than the ceiling. */
+export function exceedsChromeCeiling(versionName: string, ceiling: number | undefined): boolean {
+ if (ceiling === undefined) return false;
+ const major = Number.parseInt(versionName.slice(versionName.indexOf("-") + 1), 10);
+ return major > ceiling;
+}
diff --git a/packages/engine/src/services/frameCapture.ts b/packages/engine/src/services/frameCapture.ts
index ff8ee709d7..6ad52404b8 100644
--- a/packages/engine/src/services/frameCapture.ts
+++ b/packages/engine/src/services/frameCapture.ts
@@ -931,8 +931,8 @@ async function initDrawElementOrTransparentBackground(
}
}
// Capability gate: `canvas.drawElementImage` is an unlaunched Blink feature
- // that only exists on recent Dev/Canary Chrome builds (~151+); it is absent
- // from Stable and from most pinned/system Chrome installs. The
+ // that only exists on recent Chrome builds (150+ behind a flag); it is absent
+ // from Stable and from most system Chrome installs. The
// `--enable-features=CanvasDrawElement` flag no-ops silently on a build that
// doesn't implement it, so without this probe the first drawElementImage()
// call throws `TypeError: ... is not a function` deep inside the capture
@@ -955,7 +955,7 @@ async function initDrawElementOrTransparentBackground(
console.log(
`[engine] fast capture: falling back to ${session.launchCaptureMode} capture — ` +
"this Chrome build does not implement canvas.drawElementImage (Dev/Canary-only " +
- "feature, ~151+); run `hyperframes browser ensure --force` to fetch a supported " +
+ "feature); run `hyperframes browser ensure --force` to fetch a supported " +
"build, or set HYPERFRAMES_BROWSER_PATH to one.",
);
await routeToFallback();
diff --git a/packages/producer/src/services/renderOrchestrator.ts b/packages/producer/src/services/renderOrchestrator.ts
index bee5355d1e..388192d6ac 100644
--- a/packages/producer/src/services/renderOrchestrator.ts
+++ b/packages/producer/src/services/renderOrchestrator.ts
@@ -88,6 +88,7 @@ import {
compositionRequiresWebGpu,
applyConcreteGpuScreenshotClamp,
explainDrawElementDisabled,
+ chromeMajorCeiling,
scaleProtocolTimeoutForComposition,
classifyCaptureFailure,
type CaptureFailureKind,
@@ -3088,6 +3089,7 @@ async function executeRenderPipeline(input: {
platform: process.platform,
browserGpuMode: cfg.browserGpuMode,
workerEncode: cfg.enableDrawElementWorkerEncode,
+ chromeCeiling: chromeMajorCeiling(),
});
// "inverted" = fired and held; "reverted" = fired but the self-verify
// retry rolled back to the parallel path; undefined = never fired.