[FIX] website: gracefully reject events
Prior to this commit, the WysiwygAdapter would crash with a TB if an event reached the wysiwyg_adapter when the websiteRootInstance was no longer accessible (in case of a PageReload while an event in the mutex is still trying to fire events). Note that normally, events should not be sent when the websiteRootInstance is gone as the editor should be destroyed. But since "widgets_start_request" triggers also implement a "onFailure", it seems right to use that in such case. closes odoo/odoo#101687 X-original-commit: 0cc206f94151e2da646064e265e14a341daff58a Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
parent
05857f8d5c
commit
cc8e69d97c
@@ -427,6 +427,16 @@ export class WysiwygAdapterComponent extends ComponentAdapter {
|
||||
*/
|
||||
_websiteRootEvent(type, eventData = {}) {
|
||||
const websiteRootInstance = this.websiteService.websiteRootInstance;
|
||||
// If the websiteRootInstance is gone but an event still tries to reach it
|
||||
// prevent a traceback by denying the event.
|
||||
// TODO we should investigate if this is normal the websiteRootInstance
|
||||
// is being accessed while being dead following a wysiwyg adapter event.
|
||||
if (!websiteRootInstance) {
|
||||
if (eventData.onFailure) {
|
||||
return eventData.onFailure();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return websiteRootInstance.trigger_up(type, {...eventData});
|
||||
}
|
||||
_preventDefault(e) {
|
||||
|
||||
Reference in New Issue
Block a user