From 1121f011962a689165bdd7d66b985cd586a1554d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Wed, 8 May 2019 14:23:53 +0000 Subject: [PATCH] [FIX] bus: crashmanager popup if beep can't be played According to MDN, HTMLMediaElement returns > A Promise which is resolved when playback has been started, or is > rejected if for any reason playback cannot be started. > > Note: Older browsers may not return a value from play(). Since un-resolved un-handled promises re-raise and trigger the crash manager, this is extremely noticeable if the browser doesn't support the media type or is not currently allowed to play medias (e.g. configured to prevent auto-play). This just avoids the error, but eventually it might be useful to display a toast noting the user could allow sounds iff the rejection reason is NotAllowedError. This fix would probably be implementable / implemented on older revisions (which might have the issue, just not as prominent as unhandledrejection is not hooked into the crash manager). closes odoo/odoo#33260 Signed-off-by: Xavier Morel (xmo) --- addons/bus/static/src/js/services/bus_service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/bus/static/src/js/services/bus_service.js b/addons/bus/static/src/js/services/bus_service.js index 36eb496270f..f6ace6b869d 100644 --- a/addons/bus/static/src/js/services/bus_service.js +++ b/addons/bus/static/src/js/services/bus_service.js @@ -68,7 +68,7 @@ var BusService = CrossTab.extend(ServicesMixin, { var session = this.getSession(); this._audio.src = session.url("/mail/static/src/audio/ting" + ext); } - this._audio.play(); + Promise.resolve(this._audio.play()).catch(_.noop); } }, /**