[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) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2022-02-10 15:43:00 +00:00
parent 533bf1ee1e
commit 1eba237f64
@@ -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).