[cells-devel] [openair] recv function ?!
Frank Goenninger
frgo at mac.com
Mon Apr 14 21:01:55 UTC 2008
Am 14.04.2008 um 21:23 schrieb Ken Tilton:
> Frank Goenninger wrote:
>> Andy,
>> I am currently trying to figure out why I don't get any update on
>> my browser of, if any, just once.
>> When looking at the recv function in openair.js I see:
>> function recv (data) {
>> var response = eval("[" + data + "]");
>> for(var i=0; i<data.length; i++) {
>> eval(response[i]);
>> }
>> }
>> Kind of weird to me... I'd understand if it read:
>> function recv (data) {
>> var response = eval("[" + data + "]");
>> for(var i=0; i<response.length; i++) {
>> eval(response[i]);
>> }
>> }
>
> Hmmm, if that was a typo then the loop would iterate once for each
> character in the response evaluating (eventually) non-existent
> responses which should be fast but... we have been wondering my the
> thing was hugely slow at times, I will try this fix later.
>
> Nice catch, Frank! (It looks like a catch to me.) btw, JS goes into
> the loop even when the conditionis false initially? Hard to believe
> they got that wrong. I will add a preemptive strike anyway, cannot
> hurt.
Showed up in the Firebug Debugger (Firefox *really* is /the/ choice
for Web developers ...) - I will check again if this really happens -
wait a minute ... Yep - it is entering the for loop:
response.length is 0 and it executes the eval in the loop...
Cheers (that nice brown liquid right beside me is yelling "Drink me" -
well, it's been in the cask for 18 year so let's swallow it
sloooowly ... mmmmh ...)
Frank
More information about the cells-devel
mailing list