Address code review comments for #2758
- Use `commands.reset` insead of `commands.update` - Do not swallow errors
This commit is contained in:
parent
e96b275e02
commit
f1a24ed6fb
1 changed files with 11 additions and 15 deletions
|
@ -52,9 +52,9 @@ const backgroundLogic = {
|
||||||
*
|
*
|
||||||
* @param {{reason: runtime.OnInstalledReason, previousVersion?: string}} details
|
* @param {{reason: runtime.OnInstalledReason, previousVersion?: string}} details
|
||||||
*/
|
*/
|
||||||
_undoDefault820SortTabsKeyboardShortcut(details) {
|
async _undoDefault820SortTabsKeyboardShortcut(details) {
|
||||||
if (details.reason === "update" && details.previousVersion === "8.2.0") {
|
if (details.reason === "update" && details.previousVersion === "8.2.0") {
|
||||||
browser.commands.getAll().then((commands) => {
|
const commands = await browser.commands.getAll();
|
||||||
const sortTabsCommand = commands.find(command => command.name === "sort_tabs");
|
const sortTabsCommand = commands.find(command => command.name === "sort_tabs");
|
||||||
if (sortTabsCommand) {
|
if (sortTabsCommand) {
|
||||||
const previouslySuggestedKeys = [
|
const previouslySuggestedKeys = [
|
||||||
|
@ -62,13 +62,9 @@ const backgroundLogic = {
|
||||||
"MacCtrl+Comma", // "mac"
|
"MacCtrl+Comma", // "mac"
|
||||||
];
|
];
|
||||||
if (previouslySuggestedKeys.includes(sortTabsCommand.shortcut)) {
|
if (previouslySuggestedKeys.includes(sortTabsCommand.shortcut)) {
|
||||||
browser.commands.update({
|
browser.commands.reset("sort_tabs");
|
||||||
name: "sort_tabs",
|
|
||||||
shortcut: "",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(err => console.error(err));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue