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/tests/helpers/test_utils.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/tests/helpers/test_utils.js')
| -rw-r--r-- | addons/web/static/tests/helpers/test_utils.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/helpers/test_utils.js index 4720d166a4c..beb39687364 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/helpers/test_utils.js @@ -407,15 +407,15 @@ function addMockEnvironment(widget, params) { var services = {ajax: null}; // mocked ajax service already loaded intercept(widget, 'call_service', function (ev) { var args, result; - if (ev.data.service === 'ajax') { + if (services[ev.data.service]) { + var service = services[ev.data.service]; + args = (ev.data.args || []); + result = service[ev.data.method].apply(service, args); + } else if (ev.data.service === 'ajax') { // ajax service is already mocked by the server var route = ev.data.args[0]; args = ev.data.args[1]; result = mockServer.performRpc(route, args); - } else if (services[ev.data.service]) { - var service = services[ev.data.service]; - args = (ev.data.args || []); - result = service[ev.data.method].apply(service, args); } ev.data.callback(result); }); |
