title: Chrome XMLHttpRequest readyState===4 returns empty responseText
body: <p>I'm having a problem where <code>httpReq.responseText</code> is empty after <code>readyState</code> is <code>4</code> in Chrome (Version 33.0.1750.149 m). When I debug through and stop on the <code>console.log(url)</code> line, <code>readyState</code> is an empty string, and looking in the Network tab, chrome shows an empty response in the "Response" section for the url. Nothing surprising there.</p>
  
  <p>What's surprising is that as soon as I let the javascript continue from that breakpoint, the Network tab populates the response section. I know for certain my server is returning data, and the url is from the same domain (localhost). When I tested in firefox, it works fine.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>    var httpReq = new XMLHttpRequest();
  
      httpReq.onreadystatechange = function() {
          if( httpReq.readyState === 4 ) {
              if( httpReq.status === 200 ) {
                  console.log(url)
                  result.return(httpReq.responseText)
              } else {
                  if(!result.isResolved)
                      result.throw(new Error('Error in request'))
              }
          }
      }
  
      httpReq.open('GET', url, true);
      httpReq.send(null);
  </code></pre>
  
  <p>Any ideas what might be going on?</p>
  
  <p><strong>Update</strong>: if I change the <code>.open</code> call to <code>httpReq.open('GET', url, false);</code> it works. Something must be going wrong with the <code>onreadystatechange</code> function - is this a bug in chrome?</p>
  
  <p><strong>Update</strong>: I made a minimal repro of this. I have two separate ajax functions in my code (one from a module I don't control). One of them seems to be doing a synchronous http request. Here's a repro:</p>
  
  <pre><code>var url = '/'
  var httpReq = new XMLHttpRequest();
  var httpReq2 = new XMLHttpRequest();
  
  httpReq.onreadystatechange = function() {
      console.log('a '+httpReq.readyState+":"+httpReq.status+' - '+httpReq.responseText.substring(0,40))
  };
  httpReq2.onreadystatechange = function() {
      console.log('b '+httpReq.readyState+":"+httpReq.status+' - '+httpReq.responseText.substring(0,40))
  };
  
  httpReq.open('GET', url ); // asynchronous *first*
  httpReq.send();
  httpReq2.open('GET', url, false); // synchronous *second*
  httpReq2.send();
  </code></pre>
  
  <p>Its pretty clear to me now that this is a bug in chrome. I'll file a ticket with them.</p>