Open Bug 1519596 Opened 9 months ago Updated 2 months ago

Remove unused ChromeUtils.import calls


(Firefox :: General, enhancement, P3)

57 Branch




(Reporter: kmag, Assigned: kmag, NeedInfo)



(Keywords: leave-open)


(1 file)

Bug 1514594 requires that we rewrite existing ChromeUtils.import() callers to destructure a returned exports object, rather than rely on properties automatically being defined on the global scope. The rewrite script, in turn, needs to only destructure properties which are actually used by the script, in order to avoid triggering unused variable warnings in ESLint.

Actually running the script turns up a lot of imports where none of the exported symbols are actually used (and several where scripts attempt to destructure symbols from the module global which don't actually exist). It would be best if we can deal with these before we do the rewrite, partly to cut down on noise, and partly so we can add an ESLint rule to warn about ChromeUtils.import calls which ignore the return value, and therefore have no effect other than loading the module.

I'm going to do this in multiple parts. The first part will deal with the obvious cases, mainly JSMs and XPCOM components which run in their own scopes. Follow-ups will deal with most of the unit tests, and scripts which are loaded into shared scopes, where exports may be used in non-obvious ways.

Keywords: leave-open
Priority: -- → P3
Bug 1519596: Part 1 - Remove several unnecessary/unused ChromeUtils.import() calls. r=Gijs
Pushed by
Follow-up: Removes Services import because it's a redeclaration. a=merge
Follow-up: Update PerTestCoverageUtils import in a=merge
Created web-platform-tests PR for changes under testing/web-platform/tests

The leave-open keyword is there and there is no activity for 6 months.
:kmag, maybe it's time to close this bug?

Flags: needinfo?(kmaglione+bmo)
You need to log in before you can comment on or make changes to this bug.