Fix: WidgetMessaging not properly closed causing side effects and bugs (#31598)

* test: Add a failing test reproducing the multi messaging leak bug

* fix: Missing widgetApi stop causing leaks
This commit is contained in:
Valere Fedronic
2025-12-24 10:23:04 +01:00
committed by GitHub
parent fe73a0358c
commit 3f472c8812
3 changed files with 136 additions and 0 deletions

View File

@@ -508,6 +508,8 @@ export class WidgetMessaging extends TypedEventEmitter<WidgetMessagingEvent, Wid
}
this.emit(WidgetMessagingEvent.Stop, this.widgetApi);
this.widgetApi?.stop();
// XXX is the removeAllListeners necessary here?
this.widgetApi?.removeAllListeners(); // Insurance against resource leaks
this.widgetApi = null;
this.iframe = null;