Closed Bug 1004885 Opened 12 years ago Closed 8 years ago

Add a helper API for the pattern of using a JSM only once it has been forcibly loaded by other code

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: Unfocused, Unassigned)

References

Details

Over in bug 1001131 we're needing to only use a JSM if/when it has been forcibly loaded by some other code. So we're needing to check if it's already loaded (using an API to be added in bug 1004487), and if it isn't then wait for it to be loaded (done via an observer notification). It would be useful if we could encapsulate this in a convenience API on XPCOMUtils.jsm (or Components.utils), such that consumers could merely use something like: XPCOMUtils.waitForModuleLoad("resource:///modules/devtools/ToolboxProcess.jsm", function() { ... });
Are there specific use cases identified for this that wouldn't be better addressed by bug 1004487? Most place I know of want to access something on a lazily-loaded service, but only if it's already been initialized, and bug 1004487 addresses that. A callback-when-loaded approach would require that someone want to know when something else is loaded, which seems better addressed with a module-specific observer notification rather than some generic mechanism. I'm afraid a generic mechanism would lead to people making fragile assumptions about what happens on module load that are then broken when the module implementation details change.
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.