[js/ajax] fix deferred race condition (errback case) stable
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 20 Oct 2010 12:28:11 +0200
branchstable
changeset 6560 48ba5069e051
parent 6556 64b39aa0b047
child 6562 34be5986bca0
[js/ajax] fix deferred race condition (errback case)
web/data/cubicweb.ajax.js
--- a/web/data/cubicweb.ajax.js	Wed Oct 20 10:35:52 2010 +0200
+++ b/web/data/cubicweb.ajax.js	Wed Oct 20 12:28:11 2010 +0200
@@ -48,10 +48,8 @@
     },
 
     addErrback: function(callback) {
-        if (this._req.readyState == 4) {
-            if (this._error) {
-                callback.apply(null, [this._error, this._req]);
-            }
+        if (this._req.readyState == 4 && this._error) {
+            callback.apply(null, [this._error, this._req]);
         }
         else {
             this._onFailure.push([callback, cw.utils.sliceList(arguments, 1)]);