diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /toolkit/components/extensions/ExtensionShortcuts.sys.mjs | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/ExtensionShortcuts.sys.mjs')
-rw-r--r-- | toolkit/components/extensions/ExtensionShortcuts.sys.mjs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/toolkit/components/extensions/ExtensionShortcuts.sys.mjs b/toolkit/components/extensions/ExtensionShortcuts.sys.mjs index 17cff67eb9..e800fcc22d 100644 --- a/toolkit/components/extensions/ExtensionShortcuts.sys.mjs +++ b/toolkit/components/extensions/ExtensionShortcuts.sys.mjs @@ -261,7 +261,24 @@ export class ExtensionShortcuts { if (storedCommand && storedCommand.value) { commands.set(name, { ...manifestCommands.get(name) }); + lazy.ExtensionSettingsStore.removeSetting(extension.id, "commands", name); + if ( + name === "_execute_action" && + extension.manifestVersion > 2 && + lazy.ExtensionSettingsStore.hasSetting( + extension.id, + "commands", + "_execute_browser_action" + ) + ) { + lazy.ExtensionSettingsStore.removeSetting( + extension.id, + "commands", + "_execute_browser_action" + ); + } + this.registerKeys(commands); } } @@ -285,6 +302,19 @@ export class ExtensionShortcuts { let savedCommands = await this.loadCommandsFromStorage(extension.id); savedCommands.forEach((update, name) => { let command = commands.get(name); + if ( + name === "_execute_browser_action" && + extension.manifestVersion > 2 + ) { + // Ignore the old _execute_browser_action if there is data stored for + // the new _execute_action command. Otherwise use the stored data for + // `_execute_action` (since we renamed `_execute_browser_action` to + // `_execute_action` in MV3). + command = savedCommands.has("_execute_action") + ? null + : commands.get("_execute_action"); + } + if (command) { // We will only update commands, not add them. Object.assign(command, update); @@ -419,7 +449,7 @@ export class ExtensionShortcuts { } doc.documentElement.appendChild(keyset); if (sidebarKey) { - window.SidebarUI.updateShortcut({ keyId: sidebarKey.id }); + window.SidebarController.updateShortcut({ keyId: sidebarKey.id }); } this.keysetsMap.set(window, keyset); } |