extensionSystem: Check if mode is supported when loading

Don't try to initialize and then enable an extension if it is not supported
in the current mode. Otherwise the extension will not be initialized, and the
initial ERROR state is not cleared. Once it is in ERROR state we can't enable
it anymore when we switch mode. Instead, leave the extension in INITIALIZED
state, so that it will be initialized when appropriate. This happens for
extensions that support the unlock-dialog mode but not the user mode.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2378>
This commit is contained in:
Alessandro Bono 2022-07-14 15:37:42 +02:00 committed by Marge Bot
parent 317fa8222e
commit d01d38e1e9

View File

@ -376,7 +376,8 @@ var ExtensionManager = class extends Signals.EventEmitter {
this.logExtensionError(extension.uuid, new Error(
'A different version was loaded previously. You need to log out for changes to take effect.'));
} else {
let enabled = this._enabledExtensions.includes(extension.uuid);
let enabled = this._enabledExtensions.includes(extension.uuid) &&
this._extensionSupportsSessionMode(extension.uuid);
if (enabled) {
if (!this._callExtensionInit(extension.uuid))
return;