Opened 13 years ago
Closed 13 years ago
#8527 closed enhancement (duplicate)
the default registration of on*unload handlers breaks fastback caches
Reported by: | alex | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | 1.3 |
Component: | Core | Version: | 1.2.3 |
Keywords: | onunload, cache, fastback, addOnUnload | Cc: | James Burke, phiggins, wildbill, bill |
Blocked By: | Blocking: |
Description
On browsers that support "fast-back" (Safari, Firefox, etc.), Dojo's registration of a default handler on the beforeunload
and unload
events totally destorys the ability of dojo-using pages to be considered for this caching scheme, slowing down these pages for many users.
The proposed solution, as discussed with jburke and phiggins, is to only add the handler to the window object upon the first call to addOnUnload
or addOnBeforeunload
. This may affect behavior on pages which employ this pattern today:
dojo.connect(dojo, "unloaded", function(){ ... });
but which do not at any point call:
dojo.addOnUnload(...);
For these pages, the unloaded call will not happen since the window-level registration will not occur. Several strategies for handling this can be imagined, but none of them prevent the basic issue that some listeners to dojo.unloaded may not be called.
This is mitigated by noting that:
- no dojo code actually does this
- we will document the change in behavior
- that no browser for which fast-back caching is available also requires any default cleanup
Closing this bug requires:
- updating the release notes for 1.3: http://dojotoolkit.org/book/1-3-release-notes
- ensuring that the documentation for
dojo.unloaded
is updated - ensuring that docs are in place for
dojo.addOnLoad()
ugg, trac filed dupes since I thought it wasn't being responsive. See [8526] instead.