diff options
| author | Christophe Matthieu <chm@odoo.com> | 2018-09-10 10:26:45 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2018-09-10 16:36:43 +0200 |
| commit | dabe5bfbae10de983bd1cbdba38949f17a62562e (patch) | |
| tree | 94731f1082ec869af188a805007bf9409274a4b4 /addons/web/static/src/js/core/session.js | |
| parent | 1199451606cab7342e34fc9c41a2085b8beb1243 (diff) | |
[FIX] web: ajax must return a promise with abort method
Remove part in service_mixins who hide this error. Queries must be able
to be canceled for better performance. Also in the case of longpolling,
if the request is not canceled, wait for a server message or the maximum
time (30 sec) to add or delete channels.
Diffstat (limited to 'addons/web/static/src/js/core/session.js')
| -rw-r--r-- | addons/web/static/src/js/core/session.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/js/core/session.js index 09b65357404..694285cccdc 100644 --- a/addons/web/static/src/js/core/session.js +++ b/addons/web/static/src/js/core/session.js @@ -344,9 +344,11 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { } }; - return deferred.then(function () { + var promise = deferred.then(function () { if (aborted) { - return $.Deferred().reject('communication', $.Event(), 'abort', 'abort'); + var def = $.Deferred().reject({message: "XmlHttpRequestError abort"}, $.Event('abort')); + def.abort = function () {}; + return def; } // TODO: remove if (! _.isString(url)) { @@ -374,6 +376,9 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { xhrDef = fct(url, "call", params, options); return xhrDef; }); + + promise.abort = deferred.abort; + return promise; }, url: function (path, params) { params = _.extend(params || {}); |
