Repository navigation
fix(windows): keep browser close marker URL absolute - #12038
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe browser close-policy preload marker now uses an absolute Windows file URL with a 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes an all-black Windows window regression introduced in
Confidence Score: 5/5Safe to merge. The change is a minimal, targeted fix that restores Windows startup to a working state without altering any macOS/Linux behaviour or security boundaries. The one-line constant change is correct: adding C: gives Windows fileURLToPath() the drive letter it requires while leaving the macOS/Linux resolved path as /C:/orca_window_close_allowed, which the dual URL/path comparison in createMainWindow.ts already handles. The regression test cleanly pins Windows semantics via the { windows: true } flag. No logic, security model, or cross-platform policy path was broken. Files Needing Attention: No files require special attention.
|
| Filename | Overview |
|---|---|
| src/shared/browser-window-close-policy.ts | One-line fix: adds a Windows drive letter to the synthetic marker URL so fileURLToPath() no longer throws ERR_INVALID_FILE_URL_PATH on Windows. macOS/Linux behaviour remains correct because the policy comparison in createMainWindow.ts checks both URL and path forms. |
| src/main/window/createMainWindow.test.ts | Adds a regression test that pins the Windows path form using fileURLToPath with { windows: true }. Clean addition; no existing tests were modified. |
Reviews (1): Last reviewed commit: "fix(windows): keep browser close marker ..." | Re-trigger Greptile
(cherry picked from commit 9db4cde)
Summary
v1.4.164-rc.0by making the synthetic browser close-policy preload marker absolute under Windows file-URL rules.createMainWindow()previously constructed theBrowserWindow, then threwERR_INVALID_FILE_URL_PATHwhile convertingfile:///__orca_window_close_allowed__, before the renderer document could load.fileURLToPath()with Windows semantics and pins the resulting absolute path.ELI5
The previous browser fix needed a pretend “special permission sticker” for certain browser pages. It used the fake file address
file:///__orca_window_close_allowed__as that sticker.Mac accepts that address as an absolute path. Windows requires a drive letter such as
C:/, so it threw an error while reading the sticker. Orca had already created its window but had not loaded the UI yet, leaving a real but completely empty black window.This PR makes the sticker Windows-valid (
file:///C:/__orca_window_close_allowed__) and adds a test that reads it using Windows URL rules.Screenshots
No visual change.
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation completed:
pnpm exec vitest run --config config/vitest.config.ts src/main/window/createMainWindow.test.ts src/preload/browser-window-close.test.ts src/renderer/src/components/browser-pane/BrowserPane.webview-preferences.test.tspnpm run typecheck:nodepnpm run check:code-quality:changedpnpm run check:reliability-gatespnpm run build:electron-viteAI Review Report
No findings remain. The review traced startup from
BrowserWindowconstruction through the close-policy marker conversion and renderer load, and verified both raw-URL and normalized-path policy comparisons. Cross-platform review confirmed the marker converts toC:\\__orca_window_close_allowed__under Windows rules and remains a valid absolute POSIX path on macOS/Linux; no shortcuts, labels, shell behavior, SSH routing, or workspace-path behavior changes.Security Audit
The synthetic URL remains a policy marker only and is removed before the guest preload can run. The change does not broaden accepted navigation origins, add command execution, alter IPC authority, process user-controlled paths, touch auth or secrets, or add dependencies. The existing fail-closed webview policy remains intact.
Notes
The cause was confirmed from
main.trace.ndjson:fileURLToPath()raisedERR_INVALID_FILE_URL_PATHingetPathFromURLWin32immediately after the RC update. This is unrelated to GPU capability; the renderer was never loaded.