Ticket #1640 (closed defect: fixed)
sync XmlHttpRequest freeze Firefox 1.5
| Reported by: | arnaud.andrillon@… | Owned by: | alex |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | IO | Version: | 0.3 |
| Severity: | blocker | Keywords: | |
| Cc: |
Description
Browser : Firefox 1.5 (config : default [keep-alive activated, network.http.max-persistent-connections-per-server : 2])
DOJO version : HEAD
Using a synchronous XMLHttpRequest while loading a big enough document ( greater than 65536 bytes) create a dead-lock : FF wait for server response for its XMLHttpRequest and the server waits for FF to read the content (document data)
This code helps to reproduce the bug <html> <head> <script src="dojo/dojo.js.uncompressed.js"></script> <script> function docLoaded() { var http = dojo.hostenv.getXmlhttpObject(); http.open('GET',"document.xml", false);
alert("Calling sync XMLHttpRequest - it's gonna freeze ..."); http.send(null); alert("Well, i guess they've fixed it, response (first fragment ) is " + http.responseText.substring(0, 255)); }
if (document.addEventListener) document.addEventListener("DOMContentLoaded", docLoaded, false);
</script> </head> <body> <img src="img/Sunset.jpg" width="100" /> <img src="img/Sunset1.jpg" width="100" /> <img src="img/Sunset2.jpg" width="100" /> <img src="img/Sunset3.jpg" width="100" /> <img src="img/Sunset4.jpg" width="100" /> </body> </html>
This is not only a DOJO problem, but you can reproduce it with DOJO : DOJO loads "required JS files" (and HTML templates) synchronously,
Ex : Try to load an HTML page (using dojo) with 2 images (the number corresponds to the number of persistent connections allowed by firefox) whom size are greater than 65536 bytes (because FF loads 64Kb before allowing the server to send other response) , you will freeze FF
This bug only appears on the HEAD version because 0.3 version does not seem to use DOMContentLoaded, and window.onLoad wait for images complete loading. (which is bad for DOJO perf.)
However I think we can reproduce it with another test case in 0.3 (maybe loading dynamically big images after FF page loading)