Skip to content

fix: prevent macOS about:blank popup#269

Merged
dimavedenyapin merged 1 commit intomainfrom
fix/about-blank-popup
Apr 25, 2026
Merged

fix: prevent macOS about:blank popup#269
dimavedenyapin merged 1 commit intomainfrom
fix/about-blank-popup

Conversation

@dimavedenyapin
Copy link
Copy Markdown
Contributor

Summary

  • Root cause: setWindowOpenHandler in src/main/index.ts unconditionally passed details.url to shell.openExternal() without validation. When a webview or renderer triggered window.open('about:blank'), macOS showed the OS-level error: "There is no application set to open the URL about:blank".
  • Fix: Added isExternalUrl() validation that rejects empty strings, about:blank, about:srcdoc, and non-http(s)/mailto protocols before calling shell.openExternal().
  • Additional hardening: Added setWindowOpenHandler on webview contents (via web-contents-created) so window.open() from embedded browser panels is also validated. Also added the same validation to the shell:openExternal IPC handler.

Changes

File Change
src/main/index.ts Added isExternalUrl() helper, guarded setWindowOpenHandler on main window, added setWindowOpenHandler on webview contents
src/main/ipc-handlers.ts Added URL validation to shell:openExternal IPC handler

Test plan

  • Launch 20x, open a browser panel, visit a page with target="_blank" links — valid URLs should still open in the default browser
  • Verify that about:blank navigation attempts no longer trigger the macOS popup
  • Verify markdown links with empty hrefs don't trigger the popup
  • Build passes (pnpm run build)

🤖 Generated with Claude Code

…openExternal

The setWindowOpenHandler and shell:openExternal IPC handler were passing
URLs to shell.openExternal without validation. When a webview or renderer
triggered window.open('about:blank'), macOS showed an OS-level error
dialog: "There is no application set to open the URL about:blank".

Added URL validation that rejects empty strings, about:blank, about:srcdoc,
and non-http(s)/mailto protocols. Also added setWindowOpenHandler for
webview contents so window.open from embedded webviews is handled
consistently.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dimavedenyapin dimavedenyapin merged commit 27d0a97 into main Apr 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant