New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ajax request timeout doesn't trigger fail() or always() in Safari #3586
Comments
The default in all versions of jQuery is no timeout. Where did you set the timeout? I have a feeling that a complete example might show some other cause. |
Oh, but this timeout is coming from Safari? It would definitely be useful to see a running example to understand what is happening. Is it only Safari? |
Yes, this timeout is coming from Safari (I guess some sane default xhr request timeout). It works as you would expect in Chrome (as shown in the screenshot) and Firefox. Trying the same code with jQuery 1.x (in Safari, same browser) the timeout "Failed to load resource" is caught and triggers the callbacks, which makes me think it's jQuery related and jQuery could catch it in 3.x as well. |
We still don't have a complete code example so we can't debug it. |
Here is a test case. For me, it takes about 80 seconds minute until the timeout is triggered in Safari. Doesn't work:
It works with
|
This patch seems to solve this issue. |
Interesting! It seems our assumption might have been that the underlying XHR never had a timeout, I wonder if this is specific to Safari? |
Interesting... That would mean Safari has extracted timeout handling from @eriklax Would you like to prepare a PR? I wonder how to test it; we have a native abort test but that can be triggered via |
@mgol How about settings timeout to 1ms and use the wait url? xhr.timeout https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout |
Seems to me that Safari is violating the XHR spec if they have a default timeout:
|
@eriklax Good idea. We can't test the native timeout happening after a long wait, that would take too long but if we correctly hook up to the |
Ajax request timeout (due to server being offline) doesn't trigger fail() or always() in Safari (macOS) in latest jQuery. In jQuery 1.x timeout errors trigged both fail() and always().
"Failed to load resource: The request timed out."
And then this script stops.
This shows the console in Safari.
The text was updated successfully, but these errors were encountered: