diff options
author | James Lal <james@lightsofapollo.com> | 2013-01-07 18:39:12 +0100 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2013-01-07 18:39:12 +0100 |
commit | 843b96d1822a28cee8eed1776aa37b6322432249 (patch) | |
tree | d39a4be437ce1d0042bca92517ae674d219611b4 /lib | |
parent | 3170505852bbb6379a712ff816e1715f512516ad (diff) | |
download | jsCalDAV-843b96d1822a28cee8eed1776aa37b6322432249.tar.gz |
don't hold onto .xhr in request
Diffstat (limited to 'lib')
-rw-r--r-- | lib/caldav/request/abstract.js | 3 | ||||
-rw-r--r-- | lib/caldav/request/errors.js | 8 | ||||
-rw-r--r-- | lib/caldav/xhr.js | 13 |
3 files changed, 7 insertions, 17 deletions
diff --git a/lib/caldav/request/abstract.js b/lib/caldav/request/abstract.js index eb6297b..7116217 100644 --- a/lib/caldav/request/abstract.js +++ b/lib/caldav/request/abstract.js @@ -65,8 +65,7 @@ }; // in the future we may stream data somehow - req.send(function xhrResult() { - var xhr = req.xhr; + req.send(function xhrResult(err, xhr) { if (xhr.status > 199 && xhr.status < 300) { // success self.sax.close(); diff --git a/lib/caldav/request/errors.js b/lib/caldav/request/errors.js index c3c166e..700cfba 100644 --- a/lib/caldav/request/errors.js +++ b/lib/caldav/request/errors.js @@ -16,26 +16,26 @@ default: message = this.code; } - Error.call(this, message); } + CaldavHttpError.prototype = { __proto__: Error.prototype, constructor: CaldavHttpError } - + // Unauthenticated error for // Google Calendar function UnauthenticatedError() { var message = "Wrong username or/and password"; Error.call(this, message); } - + UnauthenticatedError.prototype = { __proto__: Error.prototype, constructor: UnauthenticatedError } - + module.exports = { CaldavHttpError: CaldavHttpError, UnauthenticatedError: UnauthenticatedError diff --git a/lib/caldav/xhr.js b/lib/caldav/xhr.js index abeae79..230f656 100644 --- a/lib/caldav/xhr.js +++ b/lib/caldav/xhr.js @@ -58,15 +58,6 @@ }, /** - * Aborts request if its in progress. - */ - abort: function abort() { - if (this.xhr) { - this.xhr.abort(); - } - }, - - /** * @param {String} user basic auth user. * @param {String} password basic auth pass. * @return {String} basic auth token. @@ -96,8 +87,6 @@ xhr = new this.xhrClass(); } - this.xhr = xhr; - // This hack is in place due to some platform // bug in gecko when using mozSystem xhr // the credentials only seem to work as expected @@ -154,6 +143,8 @@ this.waiting = true; xhr.send(this._seralize()); + + return xhr; } }; |