Closed Bug 1779538 Opened 3 years ago Closed 3 years ago

Convert ChromeUtils.importESModule at top-level in ESM to static import in ./mach esmify

Categories

(Core :: XPConnect, task, P1)

task

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

./mach esmify --imports detects ChromeUtils.import and Cu.import at the top-level and replace it with static import if the file is .sys.mjs.

This doesn't cover the following case:

  1. ./mach esmify --convert A.jsm converts A.jsm into A.sys.mjs
  2. ./mach esmify --imports . rewrites ChromeUtils.import("A.jsm") at top-level of B.jsm with ChromeUtils.importESModule("A.sys.mjs")
  3. ./mach esmify --convert B.jsm converts B.jsm into B.sys.mjs
  4. ./mach esmify --imports . to rewrite consumers in B.sys.mjs

At step 4, ChromeUtils.importESModule("A.sys.mjs") is not handled, but it should be replaced with static import, given it's at the top-level.

Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/aa33ade6d8e5 Rewrite ChromeUtils.importESModule with static import in sys.mjs. r=yulia
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Blocks: 1780301
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: