From 20332c65b4b597d2ba04993fcdcc4ea81dd64fb9 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 5 Apr 2020 09:47:22 -0400 Subject: [PATCH] No need for "Shortcuts" pane in Firefox 74 and above Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/386 --- src/js/commands.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/js/commands.js b/src/js/commands.js index e72036a4f..8e7dfb4e9 100644 --- a/src/js/commands.js +++ b/src/js/commands.js @@ -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 } + ); +} /******************************************************************************/