Closed
Description
If the native XMLHttpRequest is aborted (eg. calling abort(), suspending the computer or unloading the page) jqXHR does not fire any callbacks. Expected: fire error and complete callbacks.
Test code to reproduce:
var wrappedXhr;
$.ajax({
xhr: function() {
wrappedXhr = jQuery.ajaxSettings.xhr();
return wrappedXhr;
},
url: '/echo/json/?delay=100',
complete: console.log.bind(console, 'jQuery complete'),
error: console.log.bind(console, 'jQuery error'),
success: console.log.bind(console, 'jQuery success')
})
.progress(console.log.bind(console, 'jQuery progress'))
.fail(console.log.bind(console, 'jQuery fail'))
.always(console.log.bind(console, 'jQuery always'));
wrappedXhr.abort();
Note: the bug is not present in 1.11.x and 3.0 (master) versions.