The CloseWatcher API landed in Firefox 149, making it easy to listen for platform-specific 'dismiss' signals. Here's how it works:
@firefoxwebdevs Oh hell yeah! I love this API, so great to see it land in Firefox