Open Bug 581277 Opened 14 years ago Updated 14 years ago

browser-lastwindow-close* notifications firing in SeaMonkey for cases where it does not fire in Firefox

Categories

(SeaMonkey :: Session Restore, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

People

(Reporter: morac, Unassigned)

References

Details

While testing my Session Manager add-on in the latest SeaMonkey trunk load, I noticed a discrepancy with how the browser-lastwindow-close-requested and browser-lastwindow-close-granted notifications work in Firefox and how they work in SeaMonkey.

In Firefox they only fire if the last browser window is closed, but another non-browser window is open.  For example the error console or download window.  If no other window is open, the quit-application-* notifications are fired immediately on closing the window, even before the "onclose" even for the window fires.

I don't think the issue is in the session restore functionality per say, but that's the only place I could think of filing this.  The problem is technically caused by the differences in how Firefox and SeaMonkey close the window.

Firefox calls the global closeWindow function in http://mxr.mozilla.org/mozilla1.9.2/source/toolkit/content/globalOverlay.js which passes in the warnAboutClosingWindow function in http://mxr.mozilla.org/mozilla1.9.2/source/browser/base/content/browser.js#5748 as the aPromptFunction parameter.  The warnAboutClosingWindow function is what sends out the browser-lastwindow-close-* notifications in Firefox, but it's only called if the window count is not 1 (which it is, if there is only the browser window left).  All of this is kicked off from the windowIsClosing function in http://mxr.mozilla.org/mozilla1.9.2/source/browser/base/content/browser.js#5726

SeaMonkey doesn't have a closeWindow or warnAboutClosingWindow function and instead simply sends out the notifications in windowIsClosing http://mxr.mozilla.org/comm-central/source/suite/browser/navigator.js#2370 which results in the discrepancy.

I'm not sure which browser is correct, but since it was first implemented in Firefox, I would go with that version.
You need to log in before you can comment on or make changes to this bug.