[PATCH 4 of 7] hgweb: rename an instance of XMLHttpRequest to xhr in mercurial.js

Anton Shestakov av6 at dwimlabs.net
Mon Nov 27 04:28:11 EST 2017


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1511357538 -28800
#      Wed Nov 22 21:32:18 2017 +0800
# Node ID a9b86add287cf05dc212fdde9d84d952fbdbf676
# Parent  fd4a726a386dee3181007fc948513af7f7ae028c
# EXP-Topic hgweb-cleanup
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.

diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js
+++ b/mercurial/templates/static/mercurial.js
@@ -297,12 +297,12 @@ function format(str, replacements) {
 }
 
 function makeRequest(url, method, onstart, onsuccess, onerror, oncomplete) {
-    xfr = new XMLHttpRequest();
-    xfr.onreadystatechange = function() {
-        if (xfr.readyState === 4) {
+    xhr = new XMLHttpRequest();
+    xhr.onreadystatechange = function() {
+        if (xhr.readyState === 4) {
             try {
-                if (xfr.status === 200) {
-                    onsuccess(xfr.responseText);
+                if (xhr.status === 200) {
+                    onsuccess(xhr.responseText);
                 } else {
                     throw 'server error';
                 }
@@ -314,11 +314,11 @@ function makeRequest(url, method, onstar
         }
     };
 
-    xfr.open(method, url);
-    xfr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
-    xfr.send();
+    xhr.open(method, url);
+    xhr.overrideMimeType("text/xhtml; charset=" + document.characterSet.toLowerCase());
+    xhr.send();
     onstart();
-    return xfr;
+    return xhr;
 }
 
 function removeByClassName(className) {


More information about the Mercurial-devel mailing list