[Pkg-javascript-commits] [sockjs-client] 110/434: In some circumstances the xhr during 'cleanup' is already nulled.
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:07 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 70dc2ffd45f66908a820483b71251df391ffd347
Author: Marek Majkowski <majek04 at gmail.com>
Date: Thu Sep 1 17:18:42 2011 +0100
In some circumstances the xhr during 'cleanup' is already nulled.
---
lib/utils.js | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/utils.js b/lib/utils.js
index e4cdafe..c5aa481 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -173,16 +173,18 @@ utils.createXHR = function(method, url, payload, callback) {
var cleanup = function() {
// IE needs this field to be a function
- try{
- xhr.onreadystatechange = null;
- } catch (x) {
- xhr.onreadystatechange = function(){};
+ if (xhr) {
+ try{
+ xhr.onreadystatechange = null;
+ } catch (x) {
+ xhr.onreadystatechange = function(){};
+ }
+ // Explorer tends to keep connection open, even after the
+ // tab is closed: http://bugs.jquery.com/ticket/5280
+ try {
+ xhr.abort();
+ } catch(e) {};
}
- // Explorer tends to keep connection open, even after the
- // tab is closed: http://bugs.jquery.com/ticket/5280
- try {
- xhr.abort();
- } catch(e) {};
callback = xhr = null;
};
@@ -344,4 +346,4 @@ utils.arrIndexOf = function(arr, obj){
}
}
return -1;
-};
\ No newline at end of file
+};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list