Skip to content

Commit

Permalink
No need for "Shortcuts" pane in Firefox 74 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Apr 5, 2020
1 parent 34a2ef6 commit 20332c6
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/js/commands.js
Expand Up @@ -26,8 +26,21 @@
/******************************************************************************/

µBlock.canUseShortcuts = vAPI.commands instanceof Object;
µBlock.canUpdateShortcuts = µBlock.canUseShortcuts &&
typeof vAPI.commands.update === 'function';

// https://github.com/uBlockOrigin/uBlock-issues/issues/386
// Firefox 74 and above has complete shotcut assignment user interface.
µBlock.canUpdateShortcuts =
µBlock.canUseShortcuts &&
vAPI.webextFlavor.soup.has('firefox') &&
typeof vAPI.commands.update === 'function';

if ( µBlock.canUpdateShortcuts ) {
self.addEventListener(
'webextFlavor',
( ) => { µBlock.canUpdateShortcuts = vAPI.webextFlavor.major < 74; },
{ once: true }
);
}

/******************************************************************************/

Expand Down

0 comments on commit 20332c6

Please sign in to comment.