Closed Bug 581307 Opened 14 years ago Closed 13 years ago

XPCOMUtils should provide a convenient way to lazily import modules

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: neil, Assigned: neil)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Seeing as we're doing everything lazily these days, why not centalise the code to import modules lazily. This would replace ugly boilerplate code like this:
get _manager () {
  var temp = {};
  Cu.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
  delete this._manager;
  return this._manager = temp.LightweightThemeManager;
},
with a simple
XPCOMUtils.defineLazyModuleImporter(LightWeightThemeWebInstaller, "_manager", "resource://gre/modules/LightweightThemeManager.jsm", "LightweightThemeManager");
Attached patch Proposed patchSplinter Review
Assignee: nobody → neil
Status: NEW → ASSIGNED
Attachment #459762 - Flags: review?(sayrer)
Comment on attachment 459762 [details] [diff] [review]
Proposed patch

Looks fine, assuming we get coverage on this in short order.
Attachment #459762 - Flags: review?(sayrer) → review+
Depends on: post2.0
http://hg.mozilla.org/projects/cedar/rev/05a641e12c82
Flags: in-testsuite-
Whiteboard: fixed-in-cedar
http://hg.mozilla.org/mozilla-central/rev/05a641e12c82
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
No longer depends on: post2.0
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar
Target Milestone: --- → mozilla2.2
Blocks: 649002
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: