fix for broken closeTimeout and 'IE + xhr' goes into infinite loop on disconnection

This commit is contained in:
vedratna-velani
2011-12-21 11:21:13 +05:30
parent 7155d84af9
commit 816bf1d19c
2 changed files with 9 additions and 3 deletions

View File

@@ -45,7 +45,7 @@
// If the connection in currently open (or in a reopening state) reset the close
// timeout since we have just received data. This check is necessary so
// that we don't reset the timeout on an explicitly disconnected connection.
if (this.connected || this.connecting || this.reconnecting) {
if (this.socket.connected || this.socket.connecting || this.socket.reconnecting) {
this.setCloseTimeout();
}

View File

@@ -88,14 +88,20 @@
function onload () {
this.onload = empty;
this.onerror = empty;
self.onData(this.responseText);
self.get();
};
function onerror () {
self.onClose();
};
this.xhr = this.request();
if (global.XDomainRequest && this.xhr instanceof XDomainRequest) {
this.xhr.onload = this.xhr.onerror = onload;
this.xhr.onload = onload;
this.xhr.onerror = onerror;
} else {
this.xhr.onreadystatechange = stateChange;
}
@@ -113,7 +119,7 @@
io.Transport.XHR.prototype.onClose.call(this);
if (this.xhr) {
this.xhr.onreadystatechange = this.xhr.onload = empty;
this.xhr.onreadystatechange = this.xhr.onload = this.xhr.onerror = empty;
try {
this.xhr.abort();
} catch(e){}