FF ajax errors

FF ajax errors


Apologies if this is a question more suited to a Firefox/Mozilla list.
We're performing a recurring ajax call, wherein we use setTimeout to
recursively call a function an n'th time after the nth-1 invocation of
it has completed.
In using both Firefox (Linux, OSX), and Safari (OSX), performing
certain behaviors in Firefox causes the .ajax error handler to be
called.
So far I've found the following causes this problem:
1. Clicking a link to another page (unload gets called)
2. Pressing ESC repeatedly
3. Clicking on the refresh button (again, unload)
I understand that this might be getting caused by an incomplete ajax
call, and I've several approaches to fix the problem (setting a global
"ignore ajax errors if I've done anything that I know will cause this
problem" flag), however nothing entirely stops this.
Is there a generally accepted way of keeping this from happening?
thanks,
-lev