aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/caldav/xhr.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/caldav/xhr.js b/lib/caldav/xhr.js
index d49186b..77ecd5c 100644
--- a/lib/caldav/xhr.js
+++ b/lib/caldav/xhr.js
@@ -121,21 +121,23 @@
var last = 0;
if (useMozChunkedText) {
- xhr.onprogress = function onChunkedProgress(event) {
- this.ondata(xhr.responseText);
- }.bind(this);
+ xhr.onprogress = (function onChunkedProgress(event) {
+ if (this.ondata) {
+ this.ondata(xhr.responseText);
+ }
+ }.bind(this));
} else {
- xhr.onprogress = function onProgress(event) {
+ xhr.onprogress = (function onProgress(event) {
var chunk = xhr.responseText.substr(last, event.loaded);
last = event.loaded;
if (this.ondata) {
this.ondata(chunk);
}
- }.bind(this);
+ }.bind(this));
}
}
- xhr.onreadystatechange = function onReadyStateChange() {
+ xhr.onreadystatechange = (function onReadyStateChange() {
var data;
if (xhr.readyState === 4) {
data = xhr.responseText;
@@ -151,7 +153,7 @@
this.waiting = false;
callback(null, xhr);
}
- }.bind(this);
+ }.bind(this));
this.waiting = true;
xhr.send(this._seralize());