I think I have same problem :
Browser : Firefox 1.5 (config : default [keep-alive activated,
network.http.max-persistent-connections-per-server : 2])
DOJO version : HEAD [10-11-06]
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 a DOJO problem, but you can reproduce this problem 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
Other example on Dean Edwards Blog :
Try to open the link
http://dean.edwards.name/weblog/2005/09/busted/ in
the news " Dean Edwards’ DOMContentLoaded
<
http://dean.edwards.name/weblog/2006/06/again/> " with FireFox 1.5 (or
2.0 RC2)
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.)
Ariel Falduto a écrit :
> Why this chunk of code freezes all mi firefox ???
>
> anybody knows ... im currently trying to put some animated gif when
> this file is loading but nothings happen cos' firefox locks everyting
> =(
>
> what can i do ??
>
> NOTE: the size of "tab3.html" is 1 mb
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "
http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> <script type="text/javascript">
> var djConfig = {isDebug: true};
> </script>
> <script type="text/javascript"
> src="scripts/dojo-0.3.1-ajax/dojo.js"></script>
> <script type="text/javascript">
> dojo.require("dojo.widget.ContentPane");
>
> function init() {
> var pane = dojo.widget.byId("Pane1");
> var status = dojo.byId("status");
>
> dojo.event.connect(dojo.byId("load"), "onclick", function(evt){
> // load a new url into contentPane
> pane.setUrl("tab3.html");
> });
>
> dojo.event.connect(pane, "onDownloadStart", function(evt){
> evt.preventDefault();
> dojo.debug("Download started");
> status.style.display = "block";
> });
>
> dojo.event.connect(pane, "onDownloadEnd", function(evt){
> // not defaultPrevent()'able
> dojo.debug("Download finished");
> status.style.display = "none"
> });
>
> dojo.event.connect(pane, "onDownloadError", function(evt){
> dojo.debug("Download error");
> //evt.preventDefault(); // or
> evt.returnValue = false;
> status.style.display = "none";
> })
> }
> dojo.addOnLoad(init);
> </script>
> </head>
> <body>
> <div id="status" style="position: absolute; top: 400px; left: 400px;
> display:
> none; background-color:yellow;">
> Downloading new content, please wait...
> </div>
>
> <a href="#" id="load">load some url into contentpane</a>
>
> <div dojoType="ContentPane" id="Pane1" style="border: 1px dotted
> gray;width:
> 200px; height:200px;">
> Initial content in contentpane
> </div>
> </body>
> </html>
> _______________________________________________
> Dojo FAQ:
http://dojo.jot.com/FAQ> Dojo Book:
http://manual.dojotoolkit.org/DojoDotBook>
Dojo-interest@...
>
http://dojotoolkit.org/mailman/listinfo/dojo-interest>
_______________________________________________
Dojo FAQ:
http://dojo.jot.com/FAQDojo Book:
http://manual.dojotoolkit.org/DojoDotBookDojo-interest@...
http://dojotoolkit.org/mailman/listinfo/dojo-interest