From ef67615e9756ec660ef958fb8fc3c7847bb15f22 Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Tue, 24 Jan 2023 12:00:16 +0000 Subject: [PATCH] [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) Signed-off-by: Samuel Degueldre --- addons/web/static/tests/webclient/helpers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/web/static/tests/webclient/helpers.js b/addons/web/static/tests/webclient/helpers.js index b5717e4d3a1..0c65109b77c 100644 --- a/addons/web/static/tests/webclient/helpers.js +++ b/addons/web/static/tests/webclient/helpers.js @@ -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);