Closed
Bug 1517952
Opened 5 years ago
Closed 5 years ago
Make all Cu.imports explicit in WE code
Categories
(WebExtensions :: General, defect, P3)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1514594
People
(Reporter: zombie, Assigned: zombie)
References
Details
Attachments
(3 obsolete files)
As a side-effect of bug 1514594, I now have an accurate list of exports for each module, so an automatic mass-rewrite seems easily doable. The plan is to do this across m-c, but this is the first step to test how it works out, in code I'm familiar with.
Updated•5 years ago
|
Priority: -- → P3
Assignee | ||
Comment 1•5 years ago
|
||
Web Extension API scripts share the global, so we can't use an explicit imoport in one, and a lazy import in another script: var {Foo} = Cu.import("Foo.jsm", null); // ext-a.js Cu.defineModuleGetter(this, "Foo", "Foo.jsm"); // ext-b.js The above throws because `var` defines a non-configurable property on the global. For similar reasons, two `const` imports in two api scripts don't work either. This solution modifies `XPCOMUtils.defineLazyModuleGetter` to bail early if the imported property already exists on the global, and switch all WE api scripts to use that instead the `ChromeUtils.defineModuleGetter`. (This is all temporary until we can move to ES6 modules, but also required before we can do that, Bug 1308512)
Assignee | ||
Comment 2•5 years ago
|
||
To be able to explicitly import them using: var {Foo} = Cu.import("Foo.jsm", null); Depends on D16083
Assignee | ||
Comment 3•5 years ago
|
||
Depends on D16084
Updated•5 years ago
|
Attachment #9035421 -
Attachment is obsolete: true
Updated•5 years ago
|
Attachment #9035422 -
Attachment is obsolete: true
Updated•5 years ago
|
Attachment #9035424 -
Attachment is obsolete: true
Assignee | ||
Updated•5 years ago
|
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•