From: Jorge on
On Dec 12, 4:48 am, Mike Duffy <resp...(a)invalid.invalid> wrote:
> (...)
> function doBrowserEvents(msecs)
> {var i=0; var j5timerXH = initXmlHttpTimer(); var j5UTC = new Date();
> while ((new Date()) - j5UTC < msecs)
>   {i++; j5timerXH.open("GET","/doesnotexist",false); j5timerXH.send
> (null);};
> return i;}

Hmm, nice try, but the synchronous XHR blocks everything else (as
expected)... see:

http://jorgechamorro.com/cljs/059/

Create an [incremetator or decrementator or bubbles] and a sleeper,
and click on the "Sleep for 5s" button... :-(

The code is:

btnSleep.onclick= function (time, time2, xhr, kmiliSegundos) {
kmiliSegundos= 5e3;
time= +new Date();
do {
xhr= new XMLHttpRequest();
xhr.open("GET", "/rAnDoM_"+ rndStr(12), false); //SYNC !!
xhr.send(null);
time2= +new Date();
btnSleep.innerHTML= ((time2- time)/ 1e3) | 0;
} while (time2 < (time+ kmiliSegundos));
btnSleep.innerHTML= "Sleep for 5s";
};

It's not exactly the same algorithm because in the code you posted the
same XHR is reused again and again, but I tried it both ways and it
makes no difference.

Tested in Safari 4, FF 3.6, Opera 10, Chrome ß, in a Mac with OSX.
Cheers,
--
Jorge.