gitweb.js: No need for loop in blame_incremental's handleResponse()
JavaScript is single-threaded, so there is no need for protecting against changes to XMLHttpRequest object behind event handler back. Therefore there is no need for loop that was here in case `xhr' got new changes while processing current changes. This should make code a bit more clear. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
May 27, 2011 at 15:50 UTC
e8dd0e4063da6d0eecef1a6db99534e41f74b32e
1 file changed
+4
-9
gitweb/static/js/blame_incremental.js
+4
-9
@@ -603,21 +603,16 @@ function handleResponse() {
603
return;
604
}
605
606
- // extract new whole (complete) lines, and process them
607
- while (xhr.prevDataLength !== xhr.responseText.length) {
608
- if (xhr.readyState === 4 &&
609
- xhr.prevDataLength === xhr.responseText.length) {
610
- break;
611
- }
606
607
+ // extract new whole (complete) lines, and process them
608
+ if (xhr.prevDataLength !== xhr.responseText.length) {
609
xhr.prevDataLength = xhr.responseText.length;
610
var unprocessed = xhr.responseText.substring(xhr.nextReadPos);
611
xhr.nextReadPos = processData(unprocessed, xhr.nextReadPos);
616
- } // end while
612
+ }
613
614
// did we finish work?
619
- if (xhr.readyState === 4 &&
620
- xhr.prevDataLength === xhr.responseText.length) {
615
+ if (xhr.readyState === 4) {
616
responseLoaded(xhr);
617
}
618
}