Closed Bug 1156682 Opened 10 years ago Closed 7 years ago

Load commands in the server GCLI using _testOnly_addItemsByModule

Categories

(DevTools Graveyard :: Graphic Commandline and Toolbar, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jwalker, Unassigned)

References

Details

Currently the GcliActor loads commands as follows: * GcliActor._getRequisition() does the following: (see gcli.js:245) const gcliInit = require("devtools/commandline/commands-index"); gcliInit.addAllItemsByModule(this._system); The GCLI running in the client process does something similar. The Toolbox or DeveloperToolbar calls CommandsUtils.createRequisition which also uses commands-index and calls addAllItemsByModule. There are several problems with this: * We're calling from toolbox code into browser code, and people complain about this. * There isn't one place that's in control of what modules are loaded. * It's hard for addons to add commands. There is a better solution that isn't that hard: GcliActor can already load command modules dynamically. This already happens for unit testing where the mock commands are injected. Here's what we need to do: * Rename GcliActor._testOnly_addItemsByModule to GcliActor.addItemsByModule and similarly for the 'remove' version. * Have GcliFront call GcliActor.addItemsByModule (IIRC it takes an array) * There's a custom loader system to allow us to load commands from a user file. Perhaps this is a special case which stays server side. See addAllItemsByModule: const { mozDirLoader } = require("gcli/commands/cmd"); system.addItemsByModule("mozcmd", { delayedLoad: true, loader: mozDirLoader }); * Also we should make it so that addItemsByModule returns a promise that this resolved when the commands are actually loaded. There is a work-around for lack of this in helpers.runTestModule, where we check for the addition of a specific command. Being able to `yield front.addItemsByModule(...)` properly would be a big help.
Depends on: 1128988
This isn't a particularly useful bug to have on file. It's esoteric, and we don't need to track it given the current level of investment in GCLI. Closing
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.