From b28ca11e57d933d2a5e1474cbafba9ed1ae81a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristijan=20Ribari=C4=87?= Date: Sat, 5 Oct 2024 19:54:08 +0200 Subject: [PATCH] fix(workspaces): Ensure ZenWorkspacesEngine is registered only once This commit prevents multiple registrations of the `ZenWorkspacesEngine`. Previously, the `ZenWorkspacesEngine` was registered unconditionally every time `ZenWorkspaces` was initialized. This could lead to issues if the engine was already registered. This commit adds a check to ensure that the engine is only registered if it is not already present. This prevents multiple registrations and ensures that the engine is only initialized once. --- src/ZenWorkspaces.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ZenWorkspaces.mjs b/src/ZenWorkspaces.mjs index 891e82a..f240aca 100644 --- a/src/ZenWorkspaces.mjs +++ b/src/ZenWorkspaces.mjs @@ -19,7 +19,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature { ); ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs')); await ZenWorkspacesStorage.init(); - Weave.Service.engineManager.register(ZenWorkspacesEngine); + if(!Weave.Service.engineManager.get("workspaces")) { + Weave.Service.engineManager.register(ZenWorkspacesEngine); + } await this.initializeWorkspaces(); console.info('ZenWorkspaces: ZenWorkspaces initialized');