Stop the native run loop on quit, not will-quit - #24
Merged
Merged
Conversation
…t keeps the app alive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
bootstrap.tsstopped the native run-loop pump onwill-quit. That event is cancelable, and the pump stop ran before the veto was honoured, so an app that calledevent.preventDefault()onwill-quitkept running with a dead run loop: no more delegate callbacks,executeJavaScriptnever settles.The same ordering is what made the macOS
window-eventsintegration file hang when run alone: its first tests closed the last window, the default quit fired, the test exit stub swallowed the exit, and every later native callback was lost. It only passed in the full suite by accident of ordering.Fix
quit, which fires only afterbefore-quitandwill-quitpassed without a veto.bootstrap.test.ts: awill-quitveto leaves the native app running; a completed quit stops it once. Verified red on the old line, green on the new.window-all-closedkeep-alive listener (keepAppAlivehelper), the way a real macOS app does, and drop it inafterAll.app.mdand the changelog describe the sequence.Verification
bun run validategreen locally;window-events.test.tspasses alone; all integration suites pass (209).