From 005164d237d07f2ad8fe3528b9d4eb64a2a21efb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 31 Jan 2019 09:21:39 +0000 Subject: [PATCH] [FIX] web: AbstractStorageService should destroy its storage If that storage is destroy-able (aka RamStorage), storage objects are created "inline" without attachment (as they may or may not be parented) and this means those created implicitly in tests can't be tracked and cleanly destroyed even by destroying the storage service object. closes odoo/odoo#30790 --- .../static/src/js/core/abstract_storage_service.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/web/static/src/js/core/abstract_storage_service.js b/addons/web/static/src/js/core/abstract_storage_service.js index 34dd24b2be6..ef828b5dd5c 100644 --- a/addons/web/static/src/js/core/abstract_storage_service.js +++ b/addons/web/static/src/js/core/abstract_storage_service.js @@ -13,6 +13,17 @@ var AbstractStorageService = AbstractService.extend({ // this abstraction storage: null, + /** + * @override + */ + destroy: function () { + // storage can be permanent or transient, destroy transient ones + if ((this.storage || {}).destroy) { + this.storage.destroy(); + } + this._super.apply(this, arguments); + }, + //-------------------------------------------------------------------------- // Public //--------------------------------------------------------------------------