diff --git a/src/all/background_page/service/extension/onExtensionUpdateAvailableService.js b/src/all/background_page/service/extension/onExtensionUpdateAvailableService.js index cdfc3928..a8cf83f9 100644 --- a/src/all/background_page/service/extension/onExtensionUpdateAvailableService.js +++ b/src/all/background_page/service/extension/onExtensionUpdateAvailableService.js @@ -20,6 +20,8 @@ import WebIntegrationPagemod from "../../pagemod/webIntegrationPagemod"; import WorkerService from "../worker/workerService"; import PublicWebsiteSignInPagemod from "../../pagemod/publicWebsiteSignInPagemod"; +const PASSBOLT_EXTENSION_UPDATE = "passboltExtensionUpdate"; + class OnExtensionUpdateAvailableService { /** * Execute the OnExtensionUpdateAvailableService process @@ -27,7 +29,7 @@ class OnExtensionUpdateAvailableService { */ static async exec() { if (await isUserAuthenticated()) { - this.shouldReload = true; + await browser.storage.session.set({[PASSBOLT_EXTENSION_UPDATE]: true}); } else { await this.cleanAndReload(); } @@ -47,8 +49,9 @@ class OnExtensionUpdateAvailableService { * It triggers a runtime reload if an extension update was available while the user was signed in. */ static async handleUserLoggedOut() { - if (this.shouldReload) { - this.shouldReload = false; + const shouldUpdate = await browser.storage.session.get(PASSBOLT_EXTENSION_UPDATE); + if (shouldUpdate && shouldUpdate[PASSBOLT_EXTENSION_UPDATE]) { + await browser.storage.session.remove(PASSBOLT_EXTENSION_UPDATE); await this.cleanAndReload(); } }