[FIX] web: ignore incorrect Safari errors

Steps to reproduce: (on Safari only)
1. Install Email Marketing and Mass mailing on sale orders
2. Open Email Marketing and try to open 'Our last promotions, just for
   you!'
3. An error is thrown

Solution:
Ignore errors raised in Safari

Problem:
Error "ResizeObserver loop completed with undelivered notifications." is
raised by the ResizeObserver in
`mailing_mailing_view_form_full_width.js`. However in Safari (and
desipte the ResizeObserver flow being exactly the same than in other
browsers), the error message is "Script error." so we are not able to
correctly discard it in the error listener of `error_service.js`

opw-3339673

closes odoo/odoo#130389

X-original-commit: d00144d1198131ba7c68466b514518ca056ceef0
Signed-off-by: Francois Georis (fge) <fge@odoo.com>
Signed-off-by: Guillaume Merlin (megu) <megu@odoo.com>
This commit is contained in:
MerlinGuillaume
2023-08-02 06:18:32 +02:00
parent 2e35ae4194
commit 86399fc785
2 changed files with 11 additions and 3 deletions
@@ -17,6 +17,15 @@ export function isBrowserFirefox() {
return /Firefox/i.test(browser.navigator.userAgent);
}
/**
* true if the browser is based on Safari (Safari, Epiphany)
*
* @returns {boolean}
*/
export function isBrowserSafari() {
return !isBrowserChrome() && browser.navigator.userAgent.includes("Safari");
}
export function isAndroid() {
return /Android/i.test(browser.navigator.userAgent);
}
@@ -4,8 +4,7 @@ import { browser } from "../browser/browser";
import { _t } from "@web/core/l10n/translation";
import { registry } from "../registry";
import { completeUncaughtError, getErrorTechnicalName } from "./error_utils";
import { isIOS } from "@web/core/browser/feature_detection";
import { session } from "@web/session";
import { isIOS, isBrowserSafari } from "@web/core/browser/feature_detection";
/**
* Uncaught Errors have 4 properties:
@@ -86,7 +85,7 @@ export const errorService = {
}
let uncaughtError;
if (!filename && !lineno && !colno) {
if (isIOS() && session.is_frontend && odoo.debug !== "assets") {
if ((isIOS() || isBrowserSafari()) && odoo.debug !== "assets") {
// In Safari 16.4+ (as of Jun 14th 2023), an error occurs
// when going back and forward through the browser when the
// cache is enabled. A feedback has been reported but in the