Open Bug 959152 Opened 11 years ago Updated 3 years ago

We should be able to initialize a .jsm without using a xpcom component.

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

People

(Reporter: Yoric, Unassigned)

Details

It is common to need to load a .jsm at startup-up. At the moment, the only way to do this is: 1. write Foo.jsm; 2. write a XPCOM component FooStartup implementing nsIObserver to observe profile-after-change and open Foo.jsm; 3. register FooStartup through a manifest to observe profile-after-change. That's ugly and error-prone. I would like a mechanism that would like me skip point 2. Example clients: Telemetry, Session Restore, Crash Monitor, ...
Yes please. I'm not sure we need this to be extensible: could we just have a list of JSMs and the method to call on them in some file?
Well, I suspect that it would be useful also for add-ons, plus I have the intuition that making it a hard-coded list will not play very nicely with our objective to support many products with a single tree. We can certainly get away with pre-processing, but I'd rather do without if possible.
Restartless addons already have their own startup notification, and I don't want to design around old-style addons at all. I've been burned hard in the past by having lists of things to start up in XPCOM categories and dealing with ordering. I'd much rather have our startup order be explicit lists of things to start up. If we need to have separate lists for "the platform" and each app, that's great, but I strongly prefer specific lists to manifests/categories/general lists.
Could we piggyback on the mechanism used by restartless add-ons?
Not really, that's all part of the addon-manager calling the startup() method of bootstrap.js
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.