summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2011-05-27 13:50:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-27 18:00:39 (GMT)
commite8dd0e4063da6d0eecef1a6db99534e41f74b32e (patch)
treefa8cfddfcc0c34d0b3787b83f8de08aa4e5de5ac /gitweb
parent4510165934eba7be94dea822e2fb1cfa89e70ca3 (diff)
downloadgit-e8dd0e4063da6d0eecef1a6db99534e41f74b32e.zip
git-e8dd0e4063da6d0eecef1a6db99534e41f74b32e.tar.gz
git-e8dd0e4063da6d0eecef1a6db99534e41f74b32e.tar.bz2
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>
Diffstat (limited to 'gitweb')
-rw-r--r--gitweb/static/js/blame_incremental.js13
1 files changed, 4 insertions, 9 deletions
diff --git a/gitweb/static/js/blame_incremental.js b/gitweb/static/js/blame_incremental.js
index 4841805..27955ec 100644
--- a/gitweb/static/js/blame_incremental.js
+++ b/gitweb/static/js/blame_incremental.js
@@ -603,21 +603,16 @@ function handleResponse() {
return;
}
- // extract new whole (complete) lines, and process them
- while (xhr.prevDataLength !== xhr.responseText.length) {
- if (xhr.readyState === 4 &&
- xhr.prevDataLength === xhr.responseText.length) {
- break;
- }
+ // extract new whole (complete) lines, and process them
+ if (xhr.prevDataLength !== xhr.responseText.length) {
xhr.prevDataLength = xhr.responseText.length;
var unprocessed = xhr.responseText.substring(xhr.nextReadPos);
xhr.nextReadPos = processData(unprocessed, xhr.nextReadPos);
- } // end while
+ }
// did we finish work?
- if (xhr.readyState === 4 &&
- xhr.prevDataLength === xhr.responseText.length) {
+ if (xhr.readyState === 4) {
responseLoaded(xhr);
}
}