Closed Bug 1543023 Opened 6 months ago Closed 3 months ago

Cleanup usages of ChromeUtils.import

Categories

(DevTools :: General, task, P2)

task

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Bug 1540694 started cleaning up unnecessary complex usages of ChromeUtils.import().

In ancient times, this helper was called Components.utils.import() and used to pollute the global if the second argument was left empty. In order to prevent that we came up with unnecessary complex pattern where we passed an empty object or a temporary scope object.

ChromeUtils.import still supports the second argument in order to be able to refactor the codebase by pieces, but we should converge into a unified way of importing symbols. And it should look like this:

  const { Symbol } = ChromeUtils.import("resource://devtools/foo/bar.js");

or

  const Symbol = ChromeUtils.import("resource://devtools/foo/bar.js");
Priority: -- → P2

Bug 1531368 is on file that references the extension manager cleanups.

See Also: → 1531368
Assignee: nobody → poirot.alex

ChromeUtils.import still support a second argument as it used to do
when it was Components.utils.import. But this is deprecated and we should
instead always use the returned value.

Pushed by apoirot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1cb7ce6210d2
Use ChromeUtils.import only with one argument in all /devtools/ r=jdescottes
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.