Cleanup usages of ChromeUtils.import
Categories
(DevTools :: General, task, P2)
Tracking
(firefox70 fixed)
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: ochameau, Assigned: ochameau)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
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");
Assignee | ||
Comment 1•6 years ago
|
||
Here is a couple of searchfox queries to find a few places to refactor:
https://searchfox.org/mozilla-central/search?q=ChromeUtils%5C.import%5C(%22%5B%5E%22%5D%2B%22%2C.*null&case=false®exp=true&path=devtools
https://searchfox.org/mozilla-central/search?q=ChromeUtils%5C.import%5C(%22%5B%5E%22%5D%2B%22%2C.*%5C%7B%5C%7D&case=false®exp=true&path=devtools
https://searchfox.org/mozilla-central/search?q=ChromeUtils%5C.import%5C(%22%5B%5E%22%5D%2B%22%2C.*tempScope&case=false®exp=true&path=devtools
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Bug 1531368 is on file that references the extension manager cleanups.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
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.
Comment 5•5 years ago
|
||
bugherder |
Description
•