[FIX] web: correctly destroy apps created for legacy MockServer

A recent change in owl exposes live (non-destroyed) apps on the window.
This change causes the memory used by the QUnit test suite to balloon
out of control. The reason is that when creating a mock environment, we
create a standaloneAdapter to serve as the legacy MockServer's parent,
but this standaloneAdapter creates a dummy owl application and this
application is never destroyed. This commit fixes the problem by
registering a cleanup to destroy the application at the end of the
running test.

closes odoo/odoo#110889

X-original-commit: 27ff522cd6b0c3be32be623e375052e63bb1a04f
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: Samuel Degueldre <sad@odoo.com>
This commit is contained in:
Samuel Degueldre
2023-01-25 08:18:04 +01:00
parent a9d3cc036f
commit ef67615e97
@@ -210,6 +210,7 @@ export async function addLegacyMockEnvironment(env, legacyParams = {}) {
if (legacyParams.withLegacyMockServer) {
const adapter = standaloneAdapter({ Component });
registerCleanup(() => adapter.__owl__.app.destroy());
adapter.env = legacyEnv;
const W = Widget.extend({ do_push_state() {} });
const widget = new W(adapter);