See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
stats: task.stats.times,
      });
      this._send("/submit_task_results", result, callback);
    },
    _send: function Driver_send(url, message, callback) {
      var self = this;
      var r = new XMLHttpRequest();
      r.open("POST", url, true);
      r.setRequestHeader("Content-Type", "application/json");
      r.onreadystatechange = function (e) {
        if (r.readyState === 4) {
          self.inFlightRequests--;
          
          if (r.status !== 200) {
            setTimeout(function () {
              self._send(url, message);
            });
          }
          if (callback) {
            callback();
          }
        }
      };
      this.inflight.textContent = this.inFlightRequests++;
      r.send(message);
    },
  };
  return Driver;
})();