Closed Bug 1776837 Opened 3 years ago Closed 3 years ago

Reject lazy getters that are already imported eagerly

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

enhancement

Tracking

(firefox104 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: mossop, Assigned: arai)

References

Details

Attachments

(2 files)

It can happen that a single jsm has multiple exports. If you're importing one of them eagerly then there is no point in doing lazy imports for the others. e.g. this pattern should be rejected:

const { UrlbarProvider } = ChromeUtils.import(
  "resource:///modules/UrlbarUtils.jsm"
);

const lazy = {};

XPCOMUtils.defineLazyModuleGetters(lazy, {
  UrlbarUtils: "resource:///modules/UrlbarUtils.jsm",
});

Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/176964039b97 Part 1: Do not use lazy getter for eagerly loaded modules. r=mossop,webdriver-reviewers,application-update-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/35fcac797332 Part 2: Reject defining lazy getter for module that is already loaded eagerly at top-level. r=mossop
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: