Closed
      
        Bug 1160851
      
      
        Opened 10 years ago
          Closed 7 years ago
      
        
    
  
Make it easy for add-ons to add commands to GCLI
Categories
(DevTools Graveyard :: Graphic Commandline and Toolbar, defect)
        DevTools Graveyard
          
        
        
      
        
    
        Graphic Commandline and Toolbar
          
        
        
      
        
    Tracking
(Not tracked)
        RESOLVED
        INCOMPLETE
        
    
  
People
(Reporter: jwalker, Unassigned)
Details
In and e10s world, post the addition of runAt support, adding commands to GCLI isn't trivial. We should make it as easy as we can.
A simple `gcli.addItems()` call isn't possible because commands (and converters) may need to be added to different processes. Commands that are runAt:server need to be added to a different process to commands that are runAt:client, while converters need to be added to the client process whatever their command is, and types need to be added to both.
The modules built into Firefox get added to both processes, and GCLI works out what to do automatically, so we should extend the same thing to extensions.
I think we should add code so that an extension can do:
extension-commands.js
    exports.items = [
      {
        item: 'command',
        runAt: 'client',
        name: 'thing',
        exec: function(args, context) {
          console.log('thing command executed');
        }
      }
    ];
extension-main.js
    const gcli = require('toolkit/devtools/gcli/index');
    gcli.addItemsByModule('path/to/extension-commands.js');
| Reporter | ||
| Comment 1•10 years ago
           | ||
I know you've been thinking about this problem Irakli, and got hit by the runAt support. The description above explains the problem as I see it. I raised a new bug because there was discussion of this problem on IRC.
| Reporter | ||
| Updated•10 years ago
           | 
Summary: Make is easy for add-ons to add commands to GCLI → Make it easy for add-ons to add commands to GCLI
| Reporter | ||
| Comment 2•10 years ago
           | ||
The solution as I see it:
commands-index (which we're moving to toolkit in bug 1160361) has a WeakMap containing the fronts that we need to talk to. We should make the _testonly_addAllItemsByModule function 'public' (by removing the _testonly_ thing) and thus we can add to both all known processes. Since several fronts can share a process, we might need some way to reduce useless chatter.
| Updated•7 years ago
           | 
Product: Firefox → DevTools
| Comment 3•7 years ago
           | ||
Per bug 1491875, this component has been closed, and the affected code is being removed from Firefox. Closing this bug as incomplete.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
| Updated•7 years ago
           | 
Product: DevTools → DevTools Graveyard
          You need to log in
          before you can comment on or make changes to this bug.
        
Description
•