Closed Bug 437182 Opened 16 years ago Closed 16 years ago

Filter dialog calls window.close() in onclose handler

Categories

(Thunderbird :: General, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 441220
Thunderbird 3

People

(Reporter: philor, Assigned: philor)

References

()

Details

Absolutely no good can come from calling window.close() in a window's onclose handler. SeaMonkey cleaned up what we forked from in bug 183419, but I'm reluctant to just directly port that, since I don't really follow the onunload bits - that's maybe possibly supposed to deal with a File - Quit, but when I first looked at it in Venkman, I didn't get very persuasive results.
Priority: -- → P2
Target Milestone: --- → Thunderbird 3
(In reply to comment #0) > Absolutely no good can come from calling window.close() in a window's onclose > handler. SeaMonkey cleaned up what we forked from in bug 183419, but I'm > reluctant to just directly port that, since I don't really follow the onunload > bits - that's maybe possibly supposed to deal with a File - Quit, but when I > first looked at it in Venkman, I didn't get very persuasive results. > onunload is meant to be fired any time the window is closed. If I remember correctly, there is a difference between window.close() and the "x" button to close the window, and an onclose wouldn't pick the "x" button up. So onunload is the safest option to catch all possibilities. Anyway, SearchDialog.xul is being covered in bug 441220, ABSearchDialog.xul is covered in bug 441135.
Hardly a thorough test, but: in SM/Mac, I open the filter window (to load the script, because I'm lazy like that), close it, set breakpoints in Venkman in both onFilterUnload and onFilterClose. Then when I open it again, first onFilterUnload, then onFilterClose gets called, then the window appears (and I scratch my head about onclose being called onopen). Whether I close it with cmd+w or the x button, onFilterClose is called, the window goes away, then onFilterUnload is called.
hmm strange, maybe Neil can assist with the difference between onclose/onunload?
onclose is an event caused by attempting to close the window through the OS. Hitting Ctrl+W should *not* trigger the onclose event handler, however for instance in SeaMonkey Browser the onclose event handler directly calls WindowIsClosing while Ctrl+W calls if (WindowIsClosing()) window.close(); onunload is an event caused by closing the window, either as the default action of close event, or through calling window.close() in script.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
V.Duplicate
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.