This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
$http promise does not settle when the connection attempt times out on current Safari #14969
Closed
Description
When using $http to connect to a server which does no react to the TCP connection attempts at all on a current Safari browser, the promise never gets settled. On other browsers it gets rejected after some time as expected.
It can be reproduced using angular 1.5.8 and the following code on Safari 9.1.2, OS X 10.11.6:
$http({
method: "GET",
url: "http://github.com:12345/"
}).finally(function (result) {
console.log("settled");
});
The cause seems to be that the current Safari version invokes the ontimeout handler on the XHR object in this case even though no timeout has been set on it. (https://xhr.spec.whatwg.org/#the-timeout-attribute). Attaching the ontimeout handler in addition to onerror and onabort in $httpBackend fixes the issue.