Permalink
Browse files

Drop reference to xhr request when done.

  • Loading branch information...
1 parent 7bdad97 commit b6d7e1241e67dedcd9f3786bbdd82685fe257da0 @jdavisp3 jdavisp3 committed Jun 20, 2013
Showing with 7 additions and 2 deletions.
  1. +7 −2 priv/bullet.js
View
@@ -116,7 +116,7 @@
}
var timeout;
- var xhr;
+ var xhr = null;
var fake = {
readyState: CONNECTING,
@@ -148,7 +148,10 @@
},
close: function(){
this.readyState = CLOSED;
- xhr.abort();
+ if (xhr){
+ xhr.abort();
+ xhr = null;
+ }
clearTimeout(timeout);
fake.onclose();
},
@@ -169,6 +172,7 @@
data: {},
headers: {'X-Socket-Transport': 'xhrPolling'},
success: function(data){
+ xhr = null;
if (fake.readyState == CONNECTING){
fake.readyState = OPEN;
fake.onopen(fake);
@@ -182,6 +186,7 @@
}
},
error: function(xhr){
+ xhr = null;
fake.onerror();
}
});

0 comments on commit b6d7e12

Please sign in to comment.