Skip to content

Commit 20332c6

Browse files
committed
No need for "Shortcuts" pane in Firefox 74 and above
Related issue: - uBlockOrigin/uBlock-issues#386
1 parent 34a2ef6 commit 20332c6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/js/commands.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@
2626
/******************************************************************************/
2727

2828
µBlock.canUseShortcuts = vAPI.commands instanceof Object;
29-
µBlock.canUpdateShortcuts = µBlock.canUseShortcuts &&
30-
typeof vAPI.commands.update === 'function';
29+
30+
// https://github.com/uBlockOrigin/uBlock-issues/issues/386
31+
// Firefox 74 and above has complete shotcut assignment user interface.
32+
µBlock.canUpdateShortcuts =
33+
µBlock.canUseShortcuts &&
34+
vAPI.webextFlavor.soup.has('firefox') &&
35+
typeof vAPI.commands.update === 'function';
36+
37+
if ( µBlock.canUpdateShortcuts ) {
38+
self.addEventListener(
39+
'webextFlavor',
40+
( ) => { µBlock.canUpdateShortcuts = vAPI.webextFlavor.major < 74; },
41+
{ once: true }
42+
);
43+
}
3144

3245
/******************************************************************************/
3346

0 commit comments

Comments
 (0)