Fix mac-only enter key regression

This CL [1] changed the way certain actions are handled, including
sources.rename, which is bound to the enter key on mac. An unintended
consequence of this is that ShortcutRegistry now calls event.consume()
on all enter keydown events, preventing them from activating buttons.
The solution is to mark those actions as disabled when they are
registered and exclude them from ShortcutRegistry's search for
applicable actions.

[1] https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2121565

Bug: 1070143
Change-Id: I6e73a00412f9df6163c0f587b66e2488ba8ac4f0
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2147716
Reviewed-by: Brandon Goddard <[email protected]>
Reviewed-by: Kalon Hinds <[email protected]>
Reviewed-by: Leo Lee <[email protected]>
Commit-Queue: Jack Lynch <[email protected]>
diff --git a/front_end/ui/ActionRegistry.js b/front_end/ui/ActionRegistry.js
index 291ca49..3d013f2 100644
--- a/front_end/ui/ActionRegistry.js
+++ b/front_end/ui/ActionRegistry.js
@@ -33,6 +33,9 @@
       } else {
         console.error(`Category actions require a title for command menu: ${actionId}`);
       }
+      if (!extension.canInstantiate()) {
+        action.setEnabled(false);
+      }
     }
   }
 
@@ -59,7 +62,7 @@
     const extensions = [];
     actionIds.forEach(function(actionId) {
       const action = this._actionsById.get(actionId);
-      if (action) {
+      if (action && action.enabled()) {
         extensions.push(action.extension());
       }
     }, this);