1
edit
Changes
→Resources
In Mozilla, there are several technologies used that build the codebase. You will find some lower level programming languages such as C/C++ in the core, and may find some higher level programming languages such as Javascript in extensions, components, etc...
These technologies are connected using the XPCOM, XPConnect, XPIDL, etc... With these frameworks, developers can break up software projects into components.
=== Component ===
Using XPCOM supports the object oriented approach, allowing code to encapsulate and inherent functionality and characteristics.
XPCOM allows developers to connect their code to the rest of the Mozilla codebase. It is a cross platform technology which allows the code to be:
*reusable*updateable*modular.
''For example, the CookieManager Component can be called from Javascript code''
=== Interface ===
There are two fundamental issues in component and interface-based programming:
* lifetime (aka object ownership)
* interface querying (identifing components at run-time).
These issues are addressed by the nsISupports interface that every XPCOM object should implement.
The nsISupports interface is similar to the Object and other run-time interfaces built into Java and .NET.
The following is a simple example of an implemented nsISupports interface for the class Sample.
class Sample: public nsISupports {
private:
nsrefcnt mRefCnt;
public:
Sample();
virtual ~Sample();
NS_IMETHOD QueryInterface(const nsIID &aIID, void **aResult);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
};
nsISupports interface is explained well [http://www.mozilla.org/projects/xpcom/book/cxc/html/quicktour2.html#1003494 here].
== Related Links ==
*https://addons.mozilla.org/firefox/2230/
== Examples Resources == Links to Newsgroup:* [news://news.mozilla.org/netscape.public.mozilla.xpcom mozilla.xpcom newsgroup] Links to IRC Channels: * [irc://irc.mozilla.org/developers #Developers]