Ticket #3242 (closed defect: fixed)
IE: functions registered with dojo.addOnUnload are called or not called (race condition)
| Reported by: | guest | Owned by: | jburke |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | Core | Version: | 0.9 |
| Severity: | normal | Keywords: | |
| Cc: |
Description (last modified by sfoster) (diff)
Dojo version: 0.9 built from current sources, revision 8875
Browser: IE6, IE7;
does not occur with FireFox? 2.0
Problem: Functions, registered with dojo.addOnUnload() are sometimes not called in IE.
My investigation showed, that there is a race condition, caused by the following fragment of hostenv_browser.js
222 // IE WebControl hosted in an application can fire "beforeunload" and "unload"
223 // events when control visibility changes, causing Dojo to unload too soon. The
224 // following code fixes the problem
225 // Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
226 if(dojo.isIE){
227 dojo._handleNodeEvent(window, "beforeunload", function(){
228 dojo._unloading = true;
229 window.setTimeout(function() {
230 dojo._unloading = false;
231 }, 0);
232 });
233 }
234
235 dojo._handleNodeEvent(window, "unload", function(){
236 if((!dojo.isIE)||(dojo.isIE && dojo._unloading)){
237 dojo.unloaded();
238 }
239 });
The call on line 237 is skipped if the function 229-231 happens to be called too early.
This IE-specific behavior was introduced by changeset [6092].
I have a testcase, that will be attached below.
Best regards,
Konstantin Kolinko
Attachments
Change History
Note: See
TracTickets for help on using
tickets.