|
@@ -13,6 +13,7 @@ import { getStore, removeStoreFile } from "./store"
|
|
|
import { PINCH_ZOOM_ENABLED_KEY, WINDOW_IDS_KEY } from "./store-keys"
|
|
import { PINCH_ZOOM_ENABLED_KEY, WINDOW_IDS_KEY } from "./store-keys"
|
|
|
import { createUnresponsiveSampler } from "./unresponsive"
|
|
import { createUnresponsiveSampler } from "./unresponsive"
|
|
|
import { createWindowRegistry } from "./window-registry"
|
|
import { createWindowRegistry } from "./window-registry"
|
|
|
|
|
+import { safeWindowURL } from "./window-state"
|
|
|
|
|
|
|
|
const root = dirname(fileURLToPath(import.meta.url))
|
|
const root = dirname(fileURLToPath(import.meta.url))
|
|
|
const rendererRoot = join(root, "../renderer")
|
|
const rendererRoot = join(root, "../renderer")
|
|
@@ -364,7 +365,7 @@ function wireWindowRecovery(win: BrowserWindow, name: string) {
|
|
|
errorCode,
|
|
errorCode,
|
|
|
errorDescription,
|
|
errorDescription,
|
|
|
validatedURL,
|
|
validatedURL,
|
|
|
- currentURL: win.webContents.getURL(),
|
|
|
|
|
|
|
+ currentURL: safeWindowURL(win),
|
|
|
isMainFrame,
|
|
isMainFrame,
|
|
|
},
|
|
},
|
|
|
"error",
|
|
"error",
|
|
@@ -386,12 +387,7 @@ function wireWindowRecovery(win: BrowserWindow, name: string) {
|
|
|
})
|
|
})
|
|
|
win.webContents.on("render-process-gone", (_event, details) => {
|
|
win.webContents.on("render-process-gone", (_event, details) => {
|
|
|
sampler.stopAndFlush()
|
|
sampler.stopAndFlush()
|
|
|
- writeLog(
|
|
|
|
|
- "window",
|
|
|
|
|
- "renderer process gone",
|
|
|
|
|
- { window: name, currentURL: win.webContents.getURL(), details },
|
|
|
|
|
- "error",
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ writeLog("window", "renderer process gone", { window: name, currentURL: safeWindowURL(win), details }, "error")
|
|
|
void show(
|
|
void show(
|
|
|
"OpenCode window terminated unexpectedly",
|
|
"OpenCode window terminated unexpectedly",
|
|
|
[`Window: ${name}`, `Reason: ${details.reason}`, `Code: ${details.exitCode ?? "<unknown>"}`].join("\n"),
|
|
[`Window: ${name}`, `Reason: ${details.reason}`, `Code: ${details.exitCode ?? "<unknown>"}`].join("\n"),
|
|
@@ -399,12 +395,12 @@ function wireWindowRecovery(win: BrowserWindow, name: string) {
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
win.on("unresponsive", () => {
|
|
win.on("unresponsive", () => {
|
|
|
- writeLog("window", "renderer unresponsive", { window: name, currentURL: win.webContents.getURL() }, "error")
|
|
|
|
|
|
|
+ writeLog("window", "renderer unresponsive", { window: name, currentURL: safeWindowURL(win) }, "error")
|
|
|
sampler.start()
|
|
sampler.start()
|
|
|
void show("OpenCode is not responding", "You can relaunch the app, open the logs, or keep waiting.", true)
|
|
void show("OpenCode is not responding", "You can relaunch the app, open the logs, or keep waiting.", true)
|
|
|
})
|
|
})
|
|
|
win.on("responsive", () => {
|
|
win.on("responsive", () => {
|
|
|
- writeLog("window", "renderer responsive", { window: name, currentURL: win.webContents.getURL() }, "error")
|
|
|
|
|
|
|
+ writeLog("window", "renderer responsive", { window: name, currentURL: safeWindowURL(win) }, "error")
|
|
|
sampler.stopAndFlush()
|
|
sampler.stopAndFlush()
|
|
|
})
|
|
})
|
|
|
win.webContents.on("console-message", (_event, level, message, line, sourceId) => {
|
|
win.webContents.on("console-message", (_event, level, message, line, sourceId) => {
|