Closed Bug 1773747 Opened 2 years ago Closed 2 years ago

Detect lazy getter immediately used in the top-level script

Categories

(Developer Infrastructure :: Lint and Formatting, task)

Tracking

(firefox103 fixed)

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: arai, Assigned: arai)

References

(Blocks 1 open bug)

Details

Attachments

(6 files)

If lazy getter is immediately used at the top-level script unconditionally, it doesn't have to be lazy getter.

https://searchfox.org/mozilla-central/rev/97c13320e56884daf14016048e9d2182c880f8a9/remote/cdp/domains/content/Runtime.jsm#14-17,24,32-33

const lazy = {};

XPCOMUtils.defineLazyModuleGetters(lazy, {
  addDebuggerToGlobal: "resource://gre/modules/jsdebugger.jsm",
...
});
...
// Import the `Debugger` constructor in the current scope
lazy.addDebuggerToGlobal(globalThis);

this can be added to the rule in bug 1771173

Depends on: 1771173
Blocks: 1773829
Blocks: 1772358
No longer blocks: 1772358
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED

the patch is based on bug 1771173

Attachment #9282183 - Attachment description: WIP: Bug 1773747 - Add ESLint rule to check immediately-used lazy getter. r?Standard8! → Bug 1773747 - Add ESLint rule to check immediately-used lazy getter. r?Standard8!
Attachment #9282183 - Attachment description: Bug 1773747 - Add ESLint rule to check immediately-used lazy getter. r?Standard8! → Bug 1773747 - Part 6: Add ESLint rule to check immediately-used lazy getter. r?Standard8!
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/3956d4c17fa6
Part 1: Do not use lazy getter for immediately-used symbol in browser/components/. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/8095b64db691
Part 2: Do not use lazy getter for immediately-used symbol in services/. r=markh
https://hg.mozilla.org/integration/autoland/rev/e179ce03de58
Part 3: Do not use lazy getter for immediately-used symbol in toolkit/components/nimbus/. r=barret
https://hg.mozilla.org/integration/autoland/rev/8b5616c36e0f
Part 4: Do not use lazy getter for immediately-used symbol in toolkit/components/search/. r=Standard8
https://hg.mozilla.org/integration/autoland/rev/ea025a943cb5
Part 5: Do not use lazy getter for immediately-used symbol in XPIDatabase.jsm. r=kmag
https://hg.mozilla.org/integration/autoland/rev/060cc066304c
Part 6: Add ESLint rule to check immediately-used lazy getter. r=Standard8
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: