nsIMessageWakeupService

Implements the Message Manager wakeup service; this lets other components be woken up when specific Message Manager messages arrive. By using this service, you can avoid starting those components until they're needed.
1.0
66
Introduced
Gecko 2.0
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Note: This service was introduced in Gecko 5.0 on Firefox for Android, but was not provided on desktop until Gecko 13.0 (Firefox 13). There is no IDL for this interface.

The parentprocessmessagemanager is used for this, so messages send from childprocessmessagemanagers will be heard.

Requesting wakeups

To request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. The easiest way to do this is to add the appropriate entry to the chrome manifest that registers your component (see category in "Chrome registration").

To indicate a wakeup request in a manifest file, add a line that looks something like this:

category wakeup-request nsComponent @mozilla.org/myservice;1,nsIMyInterface,getService,myMessage1,myMessage2[,..]

The category entry value consists of a comma separate string that contains:

  1. The contract ID for your component (e.g. "@mozilla.org/myservice;1").
  2. The string name of interface to instantiate the component as (e.g. "nsIMyInterface").
  3. The method to call to instantiate the component (either "getService" or "createInstance").
  4. A comma-separated list of messages for which your component should be instantiated.

Alternatively, it is possible to register a wakeup entry programmatically via the nsICategoryManager interface.

Currently, services must expose a wrappedJSObject in order to support this; however, once bug 593407 is fixed, the service to be woken up must implement nsIFrameMessageListener.

See also