]> source.dussan.org Git - jquery.git/commitdiff
jquery.ajax: fix for beforeSend-cancelling-sideeffects
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 22 Apr 2008 22:18:11 +0000 (22:18 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Tue, 22 Apr 2008 22:18:11 +0000 (22:18 +0000)
src/ajax.js

index 4b84538df33345549d6bc3332ed77c6931f9e200..ca17f4f0d807fd411a3d9bc3031e4c6a6e9133fe 100644 (file)
@@ -291,8 +291,13 @@ jQuery.extend({
                } catch(e){}
 
                // Allow custom headers/mimetypes
-               if ( s.beforeSend && s.beforeSend(xml, s) === false )
+               if ( s.beforeSend && s.beforeSend(xml, s) === false ) {
+                       // cleanup active request counter
+                       s.global && jQuery.active--;
+                       // close opended socket
+                       xml.abort();
                        return false;
+               }
                
                if ( s.global )
                        jQuery.event.trigger("ajaxSend", [xml, s]);