Open Bug 1519596 Opened 9 months ago Updated 2 months ago

Remove unused ChromeUtils.import calls

Categories

(Firefox :: General, enhancement, P3)

57 Branch
enhancement

Tracking

()

People

(Reporter: kmag, Assigned: kmag, NeedInfo)

References

Details

(Keywords: leave-open)

Attachments

(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
https://hg.mozilla.org/integration/mozilla-inbound/rev/1e1580db8a5a9d5165da3bc28e7d09a11bff013a
Bug 1519596: Part 1 - Remove several unnecessary/unused ChromeUtils.import() calls. r=Gijs
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/mozilla-central/rev/e3ba3ce79b84
Follow-up: Removes Services import because it's a redeclaration. a=merge
https://hg.mozilla.org/mozilla-central/rev/060d26e4a442
Follow-up: Update PerTestCoverageUtils import in executormarionette.py. a=merge
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/15155 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.