community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1729499 - /comdev/projects.apache.org/site/js/projects.js
Date Tue, 09 Feb 2016 23:19:22 GMT
Author: sebb
Date: Tue Feb  9 23:19:22 2016
New Revision: 1729499

URL: http://svn.apache.org/viewvc?rev=1729499&view=rev
Log:
Don't hang if response code is not 200 or 404

Modified:
    comdev/projects.apache.org/site/js/projects.js

Modified: comdev/projects.apache.org/site/js/projects.js
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/site/js/projects.js?rev=1729499&r1=1729498&r2=1729499&view=diff
==============================================================================
--- comdev/projects.apache.org/site/js/projects.js (original)
+++ comdev/projects.apache.org/site/js/projects.js Tue Feb  9 23:19:22 2016
@@ -88,19 +88,20 @@ function GetAsyncJSONArray(urls, finalCa
         if (obj) { obj.innerHTML = "loading file #" + ( fetchCount - urls.length ) + " /
" + fetchCount + "<br>" + desc }
 
         xmlHttp.open("GET", URL, true);
-        xmlHttp.send(null);
         xmlHttp.onreadystatechange = function(state) {
-            if (xmlHttp.readyState == 4 && xmlHttp.status == 200 || xmlHttp.status
== 404) {
+            if (xmlHttp.readyState == 4) {
                 if (cb) {
-                    if (xmlHttp.status == 404) {
-                        cb({});
-                    } else {
+                    if (xmlHttp.status == 200) {
                         cb(JSON.parse(xmlHttp.responseText));
+                    } else {
+                        // TODO report error(s) back to user somehow
+                        cb({});
                     }
                 }
                 GetAsyncJSONArray(urls, finalCallback);
             }
         }
+        xmlHttp.send(null);
     }
     else {
         if (obj) { obj.innerHTML = "building page content..." }



Mime
View raw message