diff options
| author | Lucas Perais (lpe) <lpe@odoo.com> | 2020-08-24 06:18:48 +0000 |
|---|---|---|
| committer | Lucas Perais (lpe) <lpe@odoo.com> | 2020-08-24 06:26:48 +0000 |
| commit | 59e0dbab98466a23792af4a10003142614bda676 (patch) | |
| tree | e344d3e0657664a68f837281da2ec9785a498141 /addons/web/static/src/js/services | |
| parent | 42e7c01024dcc8f5d0d0ee13c120bd31374837cd (diff) | |
[FIX] web: crash_manager uses BrowserDetection
Before this commit, the crash manager used a copy of the browser detection isBrowserChrome method
because it was not possible to to register the proper dependency in stable version
This commit makes the crash manager use the module BrowserDetection for that purpose, with the proper
registered dependency before hand
closes odoo/odoo#56360
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/services')
| -rw-r--r-- | addons/web/static/src/js/services/crash_manager.js | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/js/services/crash_manager.js index 65e15df59ea..00cf4ae5620 100644 --- a/addons/web/static/src/js/services/crash_manager.js +++ b/addons/web/static/src/js/services/crash_manager.js @@ -11,6 +11,7 @@ odoo.define('web.CrashManager', function (require) { const AbstractService = require('web.AbstractService'); var ajax = require('web.ajax'); +const BrowserDetection = require('web.BrowserDetection'); var core = require('web.core'); var Dialog = require('web.Dialog'); var ErrorDialogRegistry = require('web.ErrorDialogRegistry'); @@ -27,14 +28,6 @@ window.addEventListener('unhandledrejection', ev => let active = true; -// Note: we already have this function in browser_detection.js but browser_detection.js -// is in assets_backend while crash_managere.js is in common so it will have dependency -// of file browser_detection.js which will not be available in frontend, so copy function here -const isBrowserChrome = function () { - return $.browser.chrome && // depends on jquery 1.x, removed in jquery 2 and above - navigator.userAgent.toLocaleLowerCase().indexOf('edge') === -1; // as far as jquery is concerned, Edge is chrome -}; - /** * An extension of Dialog Widget to render the warnings and errors on the website. * Extend it with your template of choice like ErrorDialog/WarningDialog @@ -103,6 +96,7 @@ var CrashManager = AbstractService.extend({ 'odoo.exceptions.ValidationError': _lt("Validation Error"), }; + this.browserDetection = new BrowserDetection(); this._super.apply(this, arguments); // crash manager integration @@ -155,7 +149,7 @@ var CrashManager = AbstractService.extend({ // In particular, Chrome formats the contents of Error.stack // https://v8.dev/docs/stack-trace-api#compatibility let traceback; - if (isBrowserChrome()) { + if (self.browserDetection.isBrowserChrome()) { traceback = ev.reason.stack; } else { traceback = `${_t("Error:")} ${ev.reason.message}\n${ev.reason.stack}`; |
