comparison mercurial/templates/static/mercurial.js @ 35159:018aac6d7cb0

hgweb: rename an instance of XMLHttpRequest to xhr in mercurial.js "xhr" is a really widespread name for this kind of things, no idea where did "xfr" come from (the original 2228bd109706 doesn't explain that). Let's just change one letter so the name makes more sense.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 22 Nov 2017 21:32:18 +0800
parents 241da2de0e9f
children 69a865dc2ada
comparison
equal deleted inserted replaced
35158:241da2de0e9f 35159:018aac6d7cb0
295 return String(replacements[p1]); 295 return String(replacements[p1]);
296 }); 296 });
297 } 297 }
298 298
299 function makeRequest(url, method, onstart, onsuccess, onerror, oncomplete) { 299 function makeRequest(url, method, onstart, onsuccess, onerror, oncomplete) {
300 xfr = new XMLHttpRequest(); 300 xhr = new XMLHttpRequest();
301 xfr.onreadystatechange = function() { 301 xhr.onreadystatechange = function() {
302 if (xfr.readyState === 4) { 302 if (xhr.readyState === 4) {
303 try { 303 try {
304 if (xfr.status === 200) { 304 if (xhr.status === 200) {
305 onsuccess(xfr.responseText); 305 onsuccess(xhr.responseText);
306 } else { 306 } else {
307 throw 'server error'; 307 throw 'server error';
308 } 308 }
309 } catch (e) { 309 } catch (e) {
310 onerror(e); 310 onerror(e);
312 oncomplete(); 312 oncomplete();
313 } 313 }
314 } 314 }
315 }; 315 };
316 316
317 xfr.open(method, url); 317 xhr.open(method, url);
318 xfr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase()); 318 xhr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
319 xfr.send(); 319 xhr.send();
320 onstart(); 320 onstart();
321 return xfr; 321 return xhr;
322 } 322 }
323 323
324 function removeByClassName(className) { 324 function removeByClassName(className) {
325 var nodes = document.getElementsByClassName(className); 325 var nodes = document.getElementsByClassName(className);
326 while (nodes.length) { 326 while (nodes.length) {