mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-19 00:10:00 +00:00
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
This commit is contained in:
+6
-4
@@ -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}`);
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user