Closed Bug 1504479 Opened 1 year ago Closed 1 year ago

Drop second unwrapping argument to ChromeUtils.import

Categories

(Testing :: Marionette, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 obsolete file)

When we were previously using Cu.import, we had to pass a second
argument {} to which to temporarily assign the imported object.  We
would then destructure this to just the symbols we’d need:

> const {Foo} = Cu.import("somemodule.js", {});

With ChromeUtils.import we can drop the second argument, which looks
more similar to how ES modules work:

> const {Foo} = Cu.import("somemodule.js");
Assignee: nobody → ato
Status: NEW → ASSIGNED
Priority: -- → P1
The second assignment argument was previously needed with Cu.import
as a way to temporarily assign an imported object so only certain
symbols on it would be imported into the scope.  With ChromeUtils.import
the second argument is no longer required.
OK, according to the Phabricator linter I was wrong about this.
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → INVALID
Attachment #9022412 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.