[dojo-contributors] Unload, disconnect, leaks

Scott J. Miles sjmiles at turboajax.com
Tue Jun 26 16:15:24 EDT 2007

Reviewing http://trac.dojotoolkit.org/ticket/3531 has brought a couple 
of issues to my attention.

It looks to me like Firefox is in an unpredictable state at 
window.unload. Firebug doesn't work correctly, and various objects are 
already released. I wonder if dojo.addOnUnload events should be firing 
at "beforeunload" instead of "unload" (at least on FF)?

Also, it looks like various Dijit entities are doing cleanup at unload 
time, and I wanted to ask about the rationale for that. This may be 
naiive, but (with the exception of leaky constructs in IE<7) won't the 
browser simply blast away everything by itself at unload time? Any code 
built with dojo.connect/subscribe already has leak-protection.

The bug above looks to me to be an interaction of these two things. 
Setting addOnUnload to fire with "beforeunload" and/or removing Dijit 
manager's "unload" processing makes the problem go away.

Scott J. Miles
TurboAjax Group

More information about the dojo-contributors mailing list