jnicklas/capybara — Issue #559: Synchronous ajax requests always time out in Internet Explorer
Author: rfletcher
Created: 2011-12-06 20:45:18+00:00
State: open

IE does not fire the readystatechange event for synchronous XHR requests. Capybara resynchronization relies on that event firing (with readyState == 4). In IE a synchronous XHR request results in window.capybaraRequestsOutstanding being incremented but never decremented, and eventually in a Capybara::TimeoutError error.

As a workaround, I'm manually decrementing window.capybaraRequestsOutstanding in my test page's javascript immediately after making any synchronous ajax request:

```javascript
jqhxr = $.ajax({
async: false,
dataType: "text",
type: "POST",
url: url,
data: params
});

if (window.capybaraRequestsOutstanding) {
window.capybaraRequestsOutstanding--;
}
```