Ajax: Don't let onreadystatechange preempt exceptions from xhr.send

Ref 0a6e1c4b19
This commit is contained in:
Richard Gibson 2015-10-23 12:42:40 -04:00
parent 3680689165
commit b5c6fc7ebb

View File

@ -174,8 +174,12 @@ if ( xhrSupported ) {
callback();
} else {
// Add to the list of active xhr callbacks
xhr.onreadystatechange = callback;
// Register the callback, but delay it in case `xhr.send` throws
xhr.onreadystatechange = function() {
if ( callback ) {
window.setTimeout( callback );
}
};
xhr.send( ( options.hasContent && options.data ) || null );
}