Handle XHR timeouts in API (bug 981647)