[FIX] web_editor: fix ResizeObserver error in FF
The error "ResizeObserver loop limit exceeded" was catch by the browser error global listener. this error was wrongly flagged as a CORS error. This error is well known to be useless and can safely be ignored. We do so. Task-2670745 closes odoo/odoo#79645 X-original-commit: 1c21e2d6fa3c25d2a920902ebecd19f6229b56d8 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> Signed-off-by: Antoine Guenet <age@odoo.com>
This commit is contained in:
@@ -19,7 +19,16 @@ const MassMailingFullWidthFormController = FormController.extend({
|
||||
this._super(...arguments);
|
||||
this._boundOnDomUpdated = this._onDomUpdated.bind(this);
|
||||
bus.on('DOM_updated', this, this._onDomUpdated);
|
||||
this._resizeObserver = new ResizeObserver(this._onResizeIframeContents.bind(this));
|
||||
this._resizeObserver = new ResizeObserver(entries => {
|
||||
// We wrap this in requestAnimationFrame to greatly mitigate
|
||||
// the "ResizeObserver loop limit exceeded" error.
|
||||
window.requestAnimationFrame(() => {
|
||||
if (!Array.isArray(entries) || !entries.length) {
|
||||
return;
|
||||
}
|
||||
this._onResizeIframeContents(entries);
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
|
||||
@@ -97,6 +97,15 @@ export const errorService = {
|
||||
|
||||
browser.addEventListener("error", async (ev) => {
|
||||
const { colno, error: originalError, filename, lineno, message } = ev;
|
||||
const errorsToIgnore = [
|
||||
// Ignore some unnecessary "ResizeObserver loop limit exceeded" error in Firefox.
|
||||
"ResizeObserver loop completed with undelivered notifications.",
|
||||
// ignore Chrome video internal error: https://crbug.com/809574
|
||||
"ResizeObserver loop limit exceeded"
|
||||
]
|
||||
if (!originalError && errorsToIgnore.includes(message)) {
|
||||
return;
|
||||
}
|
||||
let uncaughtError;
|
||||
if (!filename && !lineno && !colno) {
|
||||
uncaughtError = new UncaughtCorsError();
|
||||
@@ -107,10 +116,6 @@ export const errorService = {
|
||||
`(Opening your browser console might give you a hint on the error.)`
|
||||
);
|
||||
} else {
|
||||
// ignore Chrome video internal error: https://crbug.com/809574
|
||||
if (!originalError && message === "ResizeObserver loop limit exceeded") {
|
||||
return;
|
||||
}
|
||||
uncaughtError = new UncaughtClientError();
|
||||
await completeUncaughtError(env, uncaughtError, originalError);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user