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>
This commit is contained in:

committed by
Junio C Hamano

parent
4510165934
commit
e8dd0e4063
@ -603,21 +603,16 @@ function handleResponse() {
|
|||||||
return;
|
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;
|
xhr.prevDataLength = xhr.responseText.length;
|
||||||
var unprocessed = xhr.responseText.substring(xhr.nextReadPos);
|
var unprocessed = xhr.responseText.substring(xhr.nextReadPos);
|
||||||
xhr.nextReadPos = processData(unprocessed, xhr.nextReadPos);
|
xhr.nextReadPos = processData(unprocessed, xhr.nextReadPos);
|
||||||
} // end while
|
}
|
||||||
|
|
||||||
// did we finish work?
|
// did we finish work?
|
||||||
if (xhr.readyState === 4 &&
|
if (xhr.readyState === 4) {
|
||||||
xhr.prevDataLength === xhr.responseText.length) {
|
|
||||||
responseLoaded(xhr);
|
responseLoaded(xhr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user