From abdd1346da8011ad002edbe18dc8961138895b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Mon, 10 Jul 2023 06:04:07 +0200 Subject: [PATCH] extensionBase: Stop injecting extensionManager All extension lookups now happen through the dedicated Extension/ExtensionPreferences classes, so the shared code no longer has to access the extensionManager. Part-of: --- js/extensions/extension.js | 3 +-- js/extensions/prefs.js | 4 +--- js/extensions/sharedInternals.js | 12 ------------ 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/js/extensions/extension.js b/js/extensions/extension.js index cdbc33da7..2e06b3dfe 100644 --- a/js/extensions/extension.js +++ b/js/extensions/extension.js @@ -1,7 +1,6 @@ -import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js'; +import {ExtensionBase, GettextWrapper} from './sharedInternals.js'; const {extensionManager} = imports.ui.main; -setExtensionManager(extensionManager); export class Extension extends ExtensionBase { static lookupByUUID(uuid) { diff --git a/js/extensions/prefs.js b/js/extensions/prefs.js index ab0a74dd2..d60859a3d 100644 --- a/js/extensions/prefs.js +++ b/js/extensions/prefs.js @@ -1,10 +1,8 @@ import GObject from 'gi://GObject'; -import {ExtensionBase, GettextWrapper, setExtensionManager} from './sharedInternals.js'; +import {ExtensionBase, GettextWrapper} from './sharedInternals.js'; import {extensionManager} from '../extensionsService.js'; -setExtensionManager(extensionManager); - export class ExtensionPreferences extends ExtensionBase { static lookupByUUID(uuid) { return extensionManager.lookup(uuid)?.stateObj ?? null; diff --git a/js/extensions/sharedInternals.js b/js/extensions/sharedInternals.js index ac6d035a8..2f8e28710 100644 --- a/js/extensions/sharedInternals.js +++ b/js/extensions/sharedInternals.js @@ -6,18 +6,6 @@ import {bindtextdomain} from 'gettext'; const Config = imports.misc.config; -let _extensionManager = null; - -/** - * @param {object} extensionManager to use in utilities like `initTranslations()` - */ -export function setExtensionManager(extensionManager) { - if (_extensionManager) - throw new Error('Trying to override existing extension manager'); - - _extensionManager = extensionManager; -} - export class ExtensionBase { #gettextDomain;