code: function(state) {
      if (state == self.LOADING || self.readyState !== state) {
        self.readyState = state;
  
        if (settings.async || self.readyState < self.OPENED || self.readyState === self.DONE) {
          self.dispatchEvent("readystatechange");
        }
  
        if (self.readyState === self.DONE && !errorFlag) {
          self.dispatchEvent("load");
          // @TODO figure out InspectorInstrumentation::didLoadXHR(cookie)
          self.dispatchEvent("loadend");
        }
      }
    }
docs: Changes readyState and calls onreadystatechange.
  
  @param int state New state