Skip to content

Fix Cmd+W crash in About window - #1149

Merged
SawyerHood merged 2 commits into
mainfrom
bb/fix-javascript-main-process-error-thr_5yttk55wxp
Aug 7, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
bb/fix-javascript-main-process-error-thr_5yttk55wxp

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Closes #1100.

Summary

  • handle the null window value that Electron sends for native panels
  • send the native macOS close action for the About panel
  • preserve the existing app-window and detached DevTools close paths
  • add a regression test for the null window case

Tests

  • pnpm exec turbo run test typecheck --filter=@bb/desktop --force
  • 230 desktop tests passed
  • desktop type check passed

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am SlopCop. I will review this pull request now.

I will check security, code quality, performance, architecture, duplication, and practical test coverage. I will follow the stated review rules.

const submenu = fileMenu?.submenu as MenuItemConstructorOptions[];
const closeWindow = submenu.find((item) => item.label === "Close Window");

closeWindow?.click?.({} as never, null as never, {} as never);

@SawyerHood SawyerHood Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Add a test for the existing undefined route.

This new branch must keep null separate from undefined. The undefined value reaches closeWindowOrSideTab, which closes detached DevTools. This test covers only null. Add a second call with undefined. Assert that the callback receives undefined. Also assert that the native action does not run.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in b746744. The new regression test verifies that undefined reaches the detached DevTools callback and does not use the native panel action.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

ELI5

The About box received the wrong close message. This change sends the normal Mac close message. It is like using the correct key.

Review result

I found one low-risk test gap. I found no blocking problem.

  • Security: The fixed native selector accepts no user input. The change adds no permission, process, storage, network, or IPC boundary.
  • Code quality: The test covers null, but it does not protect the existing undefined route for detached DevTools. I left an inline comment.
  • Performance: The normal route adds one constant-time check. The change adds no listener, timer, loop, retained object, or repeated allocation.
  • Architecture: A project search found no duplicate native-close action. The direct native action fits this small Mac-only boundary.
  • Validation: The desktop suite passed all 32 files and 230 tests. The forced desktop type check passed. git diff --check passed.
  • CI: All active GitHub checks passed, including the macOS package smoke check.

Dev-browser cannot control the native macOS About panel. A web dev server cannot exercise this route, so I did not claim browser E2E coverage.

A manual native check should open About, press Cmd+W, and confirm the app stays open.

@SawyerHood
SawyerHood merged commit b64cb85 into main Aug 7, 2026
10 checks passed
@SawyerHood
SawyerHood deleted the bb/fix-javascript-main-process-error-thr_5yttk55wxp branch August 7, 2026 18:07
amadad pushed a commit to amadad/bb that referenced this pull request Aug 14, 2026
Closes get-bb#1100.

## Summary
- handle the null window value that Electron sends for native panels
- send the native macOS close action for the About panel
- preserve the existing app-window and detached DevTools close paths
- add a regression test for the null window case

## Tests
- pnpm exec turbo run test typecheck --filter=@bb/desktop --force
- 230 desktop tests passed
- desktop type 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.

A JavaScript error occurred in the main process

1 participant