From 7cc0d5769db18e20dbfe338e07a55fe6224f070e Mon Sep 17 00:00:00 2001 From: arookieofc Date: Tue, 10 Nov 2026 17:43:08 +0800 Subject: [PATCH] fix(boot): ignore ResizeObserver loop also when delivered as an Error (#2474) * fix(boot): ignore ResizeObserver loop also when delivered as an Error (#2468) WebKit (Tauri on Linux) can report the benign loop notification with an Error object attached, which bypassed the bare-message guard and showed a fatal startup dialog. Match on the engine-generated message instead; no genuine startup failure carries these strings. * chore: fix README formatting for oxfmt check --- public/boot.js | 10 ++++++---- src/platform/boot.test.ts | 14 ++++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/public/boot.js b/public/boot.js index d378132c5..b57005a10 100644 --- a/public/boot.js +++ b/public/boot.js @@ -90,11 +90,13 @@ if (target?.tagName === "SCRIPT" || (target?.tagName === "LINK" && target.rel === "modulepreload")) { show(`Could not load startup script: ${target.src || target.href}`); } else if (event.error || event.message) { - // ResizeObserver defers undelivered notifications to the next frame; startup can continue. + // ResizeObserver defers undelivered notifications to the next frame; startup can + // continue. Blink reports the loop as a bare message, WebKit (Tauri on Linux) as an + // Error object — ignore both. No genuine startup failure carries these engine strings. + const message = event.error?.message ?? event.message; if ( - !event.error && - (event.message === "ResizeObserver loop completed with undelivered notifications." || - event.message === "ResizeObserver loop limit exceeded") + message === "ResizeObserver loop completed with undelivered notifications." || + message === "ResizeObserver loop limit exceeded" ) return; show(event.error || `${event.message}\n${event.filename || ""}:${event.lineno || 0}:${event.colno || 0}`); diff --git a/src/platform/boot.test.ts b/src/platform/boot.test.ts index c4c7f1bf9..36be0168a 100644 --- a/src/platform/boot.test.ts +++ b/src/platform/boot.test.ts @@ -54,10 +54,16 @@ it.each(resizeObserverMessages)("still times out an unresolved startup after %s" expect(document.querySelector("textarea")?.value).toContain("Startup did not finish within 30 seconds."); }); -it.each(resizeObserverMessages)("keeps actual errors with the same message fatal: %s", (message) => { - window.dispatchEvent(new ErrorEvent("error", { message, error: new Error(message) })); - expect(document.getElementById("splash")).toBeNull(); - expect(document.querySelector("textarea")?.value).toContain(message); +it.each(resizeObserverMessages)("ignores the loop notification delivered as an Error: %s", (message) => { + // WebKit (Tauri on Linux) reports the loop with an Error object; Blink as a bare message. + // No genuine startup failure carries these engine-generated strings. + window.dispatchEvent(new ErrorEvent("error", { message, filename: "tauri://localhost", error: new Error(message) })); + expect(document.getElementById("splash")).not.toBeNull(); + expect(document.getElementById("boot-error")).toBeNull(); + expect(document.documentElement.dataset.boot).toBeUndefined(); + window.dispatchEvent(new Event("openidea:boot-ready")); + vi.advanceTimersByTime(30_000); + expect(document.getElementById("boot-error")).toBeNull(); }); it.each(resizeObserverMessages)("keeps rejections with the same message fatal: %s", (message) => {