Closed Bug 996596 Opened 10 years ago Closed 7 years ago

Convert devtools import blocks to use "require" instead of Cu.import

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1182194

People

(Reporter: Paolo, Unassigned)

References

(Blocks 1 open bug)

Details

As a follow-up to bug 995170 comment 8, this bug is about converting existing devtools code to use "require" instead of Cu.import as far as possible.

This can also be a good opportunity to unify everything to use the same pattern, with a global "require" function instead of "devtools.require", and consistent spacing and styling.
Thanks for raising this bug Paolo.

Some related things - if I was hacking on this then I'd do these at the same time, but it's up to whoever does the work:

* Convert from jsm to js (that way no imports are needed for 'require' to exist)
* Add "use strict" were it doesn't break anything
* Remove emacs/vi modelines
* Remove Makefiles (they often disappear as a result of removing the last jsm in a directory)

When we complete the transition to *.js, then our developer tools will be dynamically reloadable.
(In reply to :Paolo Amadini from comment #0)
> 
> This can also be a good opportunity to unify everything to use the same
> pattern, with a global "require" function instead of "devtools.require", and
> consistent spacing and styling.

Yes please!
We could do with a decent way to do this lazily:
const { x, y, z } = Cu.import("...");
ES6 modules might be a better bet in the long run.
This bug could become a dependency to bug 1308512 for the devtools code.
In order to get rid of Cu.import, we have to convert the few .jsm files we still have in devtools to .js.
Bug 1182194 already tracks this progress and the few jsm already converted.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.