From a90a5cba08fdf6c0ceb95101c275108a152a3aed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:37 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../extensions/ExtensionShortcuts.sys.mjs | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'toolkit/components/extensions/ExtensionShortcuts.sys.mjs') 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); } -- cgit v1.2.3