# HG changeset patch # User Sylvain Thénault # Date 1287490072 -7200 # Node ID 256725d4e3eca2ab5e53322156134a1ad0c74dcb # Parent 9c38218854432cc7d8b1bd139eb84b1538df8e1b [js/ajax] fix deferred race condition diff -r 9c3821885443 -r 256725d4e3ec web/data/cubicweb.ajax.js --- a/web/data/cubicweb.ajax.js Tue Oct 19 10:04:50 2010 +0200 +++ b/web/data/cubicweb.ajax.js Tue Oct 19 14:07:52 2010 +0200 @@ -36,12 +36,10 @@ }, addCallback: function(callback) { - if (this._req.readyState == 4) { - if (this._result) { - var args = [this._result, this._req]; - jQuery.merge(args, cw.utils.sliceList(arguments, 1)); - callback.apply(null, args); - } + if ((this._req.readyState == 4) & this._result) { + var args = [this._result, this._req]; + jQuery.merge(args, cw.utils.sliceList(arguments, 1)); + callback.apply(null, args); } else { this._onSuccess.push([callback, cw.utils.sliceList(arguments, 1)]); @@ -332,7 +330,7 @@ }); // check result.responseText instead of result to avoid error encountered with IE if (result.responseText) { - // XXX no good reason to force json here, + // XXX no good reason to force json here, // it should depends on request content-type result = cw.evalJSON(result.responseText); }