aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax/xhr.js
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-04-02 11:55:57 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-05-03 13:54:17 +0300
commita117dd05f638a078c21dc57f19966f4ae81f98f0 (patch)
tree20ac9765a094587b688d9ad3a5ceb3bfa75f7e5b /src/ajax/xhr.js
parent9db9316609c2881dbb6abc49efc3aa91a57a02ad (diff)
downloadjquery-a117dd05f638a078c21dc57f19966f4ae81f98f0.tar.gz
jquery-a117dd05f638a078c21dc57f19966f4ae81f98f0.zip
Ajax: remove "onunload" event handler
Remove hack for IE lost connections, update for it was released by Microsoft at November 12, 2013. See https://support.microsoft.com/en-us/kb/2905733 Ref trac-5280 Ref gh-2047
Diffstat (limited to 'src/ajax/xhr.js')
-rw-r--r--src/ajax/xhr.js21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js
index c1aceaa4a..545bb26c9 100644
--- a/src/ajax/xhr.js
+++ b/src/ajax/xhr.js
@@ -10,9 +10,7 @@ jQuery.ajaxSettings.xhr = function() {
} catch ( e ) {}
};
-var xhrId = 0,
- xhrCallbacks = {},
- xhrSuccessStatus = {
+var xhrSuccessStatus = {
// file protocol always yields status code 0, assume 200
0: 200,
// Support: IE9
@@ -21,17 +19,6 @@ var xhrId = 0,
},
xhrSupported = jQuery.ajaxSettings.xhr();
-// Support: IE9
-// Open requests must be manually aborted on unload (#5280)
-// See https://support.microsoft.com/kb/2856746 for more info
-if ( window.attachEvent ) {
- window.attachEvent( "onunload", function() {
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]();
- }
- });
-}
-
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;
@@ -43,8 +30,7 @@ jQuery.ajaxTransport(function( options ) {
return {
send: function( headers, complete ) {
var i,
- xhr = options.xhr(),
- id = ++xhrId;
+ xhr = options.xhr();
xhr.open(
options.type,
@@ -84,7 +70,6 @@ jQuery.ajaxTransport(function( options ) {
callback = function( type ) {
return function() {
if ( callback ) {
- delete xhrCallbacks[ id ];
callback = xhr.onload = xhr.onerror = null;
if ( type === "abort" ) {
@@ -117,7 +102,7 @@ jQuery.ajaxTransport(function( options ) {
xhr.onerror = callback("error");
// Create the abort callback
- callback = xhrCallbacks[ id ] = callback("abort");
+ callback = callback("abort");
try {
// Do send the request (this may raise an exception)