[web/data] Support Deferred objects outside XHR
JS tests actually use this. Related to #5533303.
--- a/web/data/cubicweb.ajax.js Mon Jun 22 14:27:37 2015 +0200
+++ b/web/data/cubicweb.ajax.js Wed May 13 15:58:21 2015 +0200
@@ -39,7 +39,7 @@
},
addCallback: function(callback) {
- if ((this._req.readyState == 4) && this._result) {
+ if (this._req && (this._req.readyState == 4) && this._result) {
var args = [this._result, this._req];
jQuery.merge(args, cw.utils.sliceList(arguments, 1));
callback.apply(null, args);
@@ -51,7 +51,7 @@
},
addErrback: function(callback) {
- if (this._req.readyState == 4 && this._error) {
+ if (this._req && this._req.readyState == 4 && this._error) {
callback.apply(null, [this._error, this._req]);
}
else {