2013-07-04
■ XPCOM Concepts
http://kb.mozillazine.org/Implementing_XPCOM_components_in_JavaScript#XPCOM_Concepts
There are basically 4 concepts you need to understand when developing XPCOM objects. They are components, interfaces, modules, and factories. I will give a brief summary of each, then go into more details later.
Components
A component is simply an object that implements interfaces, and is registered with the component manager. In our case the implementation will be a Javascript object.
Interfaces
Interfaces are used to define what functions and attributes an XPCOM component provides. nsISupports is an interface that all classes must implement. It provides a function to request the interfaces on a class.
Factories
Factories are objects used to instantiate components. Each factory object implements the nsIFactory interface.
Modules
Multiple classes can be defined in a file. A module is an object that is used to register, unregister and provide factories for classes. It implements the nsIModule interface.