From 1eba237f64e8f08c3d98a8e4f2bbc562cd99fdd9 Mon Sep 17 00:00:00 2001 From: Antoine Guenet Date: Thu, 10 Feb 2022 09:33:26 +0000 Subject: [PATCH] [FIX] web_editor: prevent traceback on create and quick discard mailing In mass_mailing: 1. Click CREATE 2. As soon as it appears, click "DISCARD" 3. Wait a little bit -> A traceback appeared. That is because wysiwyg was still busy starting and, in that process, requested the window object of the iframe that was already removed. closes odoo/odoo#84358 X-original-commit: 48ce4f0f834b55692e32868194a635b817c6ed13 Signed-off-by: David Monjoie (dmo) --- addons/web_editor/static/src/js/wysiwyg/wysiwyg.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js index 99492df6aff..34330ec9a24 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg.js @@ -1232,6 +1232,10 @@ const Wysiwyg = Widget.extend({ const eventName = elem.dataset.eventName; let colorpicker = null; const mutex = new concurrency.MutexedDropPrevious(); + if (!elem.ownerDocument.defaultView) { + // In case the element is not in the DOM, don't do anything with it. + continue; + } // If the element is within an iframe, access the jquery loaded in // the iframe because it is the one who will trigger the dropdown // events (i.e hide.bs.dropdown and show.bs.dropdown).