Synchonous requests failing, possible fix may introducde more memory leaks

Synchonous requests failing, possible fix may introducde more memory leaks

Hi devs,
when I added the async option to $.ajax at first, my tests for sync
requests failed. I figured that it was due to my badly written tests,
but now found the real issue: At the end of the readystatechange event
handler, the xml reference is set to null, according to the comment
above it, to prevent memory leaks.
What happens on sync requests: The xml is set to null, and null is
returned, instead of the XMLHttpRequest object. While the normal
handling via callback may work, the example as posted in the 1.0.4
release notes fails.
I added a check to fix this:
if(s.async)
xml = null;
This fixes the problem for FF, but not for IE: In IE, it is possible
that the readystatechange event handler is invoked and completed after
the call to send, but before the "return xml". It's weird, but at least
that is the behaviour the Microsoft Script Debugger showed me. So I had
to exclude IE:
if(s.asny && !jQuery.browser.msie)
xml = null
It is rather ugly, but works.
Any idea on the impact of not setting xml to null?
--
Jörn Zaefferer
http://bassistance.de
_______________________________________________
Jquery-dev mailing list
Jquery-dev@bassistance.de
http://lists.bassistance.de/mailman/listinfo/jquery-dev