Did some more digging and found some semi-related bugs for additional context: Bug 1818971: this one relates more to bug 2035796, but trigger of this bug is the same issue where each window gets a `WM_CLOSE` and most windows are torn down without the "last window" logic branch due to a race condition Bug 1858782: same as above, different symptom of the simultaneous window closing issue Based on these discussions, it seems that our Enterprise Signout prompt not showing in some scenarios when multiple windows are closed is a manifestation of the same long-standing m-c issue. Each window gets a `WM_CLOSE`, and the per-window "am I the last?" check in `toolkit/content/globalOverlay.js` is racy because `.closed` doesn't flip until after the handler returns, while `CanCloseWindow` -> `browser.permitUnload()` continues processing events during its sync IPC and lets the next window's `WM_CLOSE` handler dispatch and run to completion before the first window's handler returns.
Bug 2040447 Comment 3 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Did some more digging and found some semi-related bugs for additional context: Bug 1818971: this one relates more to bug 2035796, but trigger of this bug is the same issue where each window gets a `WM_CLOSE` and most windows are torn down without the "last window" logic branch due to a race condition Bug 1858782: same as above, different symptom of the simultaneous window closing issue Based on these discussions, it seems that our Enterprise Signout prompt not showing in some scenarios when multiple windows are closed is a manifestation of the same long-standing m-c issue. Each window gets a `WM_CLOSE`, and the per-window ["am I the last?" check](https://searchfox.org/enterprise-main/source/toolkit/content/globalOverlay.js#11) in `toolkit/content/globalOverlay.js` is racy because `.closed` doesn't flip until after the handler returns, while [`CanCloseWindow` -> `browser.permitUnload()` ](https://searchfox.org/enterprise-main/source/browser/base/content/browser.js#3669)continues processing events during its sync IPC and lets the next window's `WM_CLOSE` handler dispatch and run to completion before the first window's handler returns.