Visit Mozilla.org

XPConnect:Using components

From MDC

XPConnect works transparently in Mozilla and xpcshell to give you access to XPCOM components.

Commonly, we start our scripts like so:

var Cc = Components.classes;
var Ci = Components.interfaces;

If we want to get a hold of a component, we then do something like:

var rc = Cc["@mozilla.org/registry;1"];
var rs = rc.getService(Ci.nsIRegistry);

See also:

  • xpcshell -- how to get a command line interface to JavaScript