From 7290ee68c3e1607b8cead5bb8394e39c679204c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 5 Nov 2026 18:51:19 +0000 Subject: [PATCH] fix(engine): name a failed script's origin and error before the free text of its warning (#7256) --- .../src/services/frameCapture-scriptLoadCause.test.ts | 8 +++++--- packages/engine/src/services/frameCapture.ts | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/engine/src/services/frameCapture-scriptLoadCause.test.ts b/packages/engine/src/services/frameCapture-scriptLoadCause.test.ts index be546fbd94..71db78e3d7 100644 --- a/packages/engine/src/services/frameCapture-scriptLoadCause.test.ts +++ b/packages/engine/src/services/frameCapture-scriptLoadCause.test.ts @@ -29,7 +29,7 @@ describe("classifyScriptLoadCause", () => { }); describe("the script-failure warning", () => { - it("ends with the closed origin and code of each failed script, and never their URL", () => { + it("names the closed origin and code of each failed script before the free text, so a cut message keeps them", () => { vi.spyOn(console, "warn").mockImplementation(() => {}); const session = { subTimelineWaitOutcome: "script_failure", @@ -38,13 +38,15 @@ describe("the script-failure warning", () => { { origin: "local", code: "net::ERR_CONNECTION_RESET" }, { origin: "cdn", code: "http-503" }, ], - pageErrors: [], + pageErrors: ["runtime-error:TypeError: " + "x".repeat(600)], warnings: [], } as unknown as CaptureSession; recordSubTimelineWarning(session, 45_000); const [warning] = session.warnings; expect( - warning.message.endsWith(" [script_load: local/net::ERR_CONNECTION_RESET, cdn/http-503]"), + warning.message.startsWith( + "A sub-composition timeline script failed to load [script_load: local/net::ERR_CONNECTION_RESET, cdn/http-503] (", + ), ).toBe(true); }); }); diff --git a/packages/engine/src/services/frameCapture.ts b/packages/engine/src/services/frameCapture.ts index 8a92e1c868..5786aaf333 100644 --- a/packages/engine/src/services/frameCapture.ts +++ b/packages/engine/src/services/frameCapture.ts @@ -2559,8 +2559,8 @@ export function recordSubTimelineWarning(session: CaptureSession, timeoutMs: num `${pendingSuffix} (${sources.join(", ")}). Fix the error; a composition animated by ` + `CSS or rAF rather than a GSAP timeline must mark its host with data-no-timeline.` : scriptFailure - ? `A sub-composition timeline script failed to load (${sources.join(", ")})` + - scriptLoadCauseSuffix(loadCauses) + ? `A sub-composition timeline script failed to load${scriptLoadCauseSuffix(loadCauses)} ` + + `(${sources.join(", ")})` : `Sub-composition timelines did not become ready within ${timeoutMs}ms${pendingSuffix}. ` + `This can be intentional: a composition driven by CSS animations or rAF never registers ` + `window.__timelines[id], and marking its host with data-no-timeline skips the wait entirely. ` +