XHR.onreadystatechange = function()

in scomp.js [341:367]


  XHR.onreadystatechange = function () {
    if (XHR.readyState == 4) {
      /*
      gLog.appendChild(document.createElement("li"))
          .appendChild(document.createTextNode(aURL + " - " + XHR.status +
                                               " " + XHR.statusText));*/
    }
    if (
      XHR.readyState == 4 &&
      (XHR.status == 200 || (XHR.status == 401 && aAccept401))
    ) {
      // so far so good
      if (
        XHR.responseXML != null &&
        aFormat == "xml" &&
        XHR.responseXML.getElementById("test").firstChild.data
      )
        aCallback(aXHR.responseXML.getElementById("test").firstChild.data);
      else if (XHR.responseText != null && aFormat == "json")
        aCallback(JSON.parse(XHR.responseText));
      else aCallback(XHR.responseText);
    } else if (XHR.readyState == 4 && XHR.status != 200) {
      // fetched the wrong page or network error...
      console.log("ERROR: XHR status " + XHR.status + " - " + aURL);
      aCallback(null);
    }
  };