Jump to content

XPCOM

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Jorgk3 (talk | contribs) at 10:37, 26 August 2015 (Removed dead link). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

XPCOM (Cross Platform Component Object Model) is a cross-platform component model from Mozilla. It is similar to Microsoft COM and CORBA. It features multiple language bindings and IDL descriptions; thus programmers can plug their custom functionality into the framework and connect it with other components.

The model

XPCOM is one of the main things making the Mozilla application environment an actual framework. It is a development environment that provides the following features for the cross-platform software developer:

This component object model makes virtually all of the functionality of Gecko available as a series of components, or reusable cross-platform libraries, that can be accessed from the web browser or scripted from any Mozilla application. Applications that want to access the various Mozilla XPCOM libraries (networking, security, DOM, etc.) use a special layer of XPCOM called XPConnect, which reflects the library interfaces into JavaScript (or other languages). XPConnect glues the front end to the C++ or C programming language-based components in XPCOM, and it can be extended to include scripting support for other languages: PyXPCOM already offers support for Python. PerlConnect [1] and plXPCOM [2] provide support for Perl, and there are efforts underway to add CLI and Ruby language support for XPConnect.

On the developer side, XPCOM lets you write components in C++, C, JavaScript, Python, or other languages for which special bindings have been created, and compile and run those components on dozens of different platforms, including these and others where Mozilla itself is supported.

The flexibility to reuse the XPCOM components from the Gecko library and develop new components that run on different platforms facilitates rapid application development and results in an application that is more productive and easier to maintain. The networking library, for example, is a set of XPCOM components that can be accessed and used by any Mozilla application. File I/O, security, password management, and profiles are also separate XPCOM components that programmers can use in their own application development.

Criticism

XPCOM adds a lot of code for marshalling objects between different usage contexts (e.g. different languages). This leads to code bloat in XPCOM based systems. This was one of the reasons why Apple forked KHTML to create the WebKit engine (which is now used in several web browsers in various forms, including Safari and Google Chrome) over the XPCOM-based Gecko rendering engine for their web browser.[1][2]

The Gecko developers are currently trying to reduce superfluous uses of XPCOM in the Gecko layout engine. This process is commonly referred to as deCOMtamination within Mozilla.[3]

See also

  • XULRunner – XULRunner is a runtime that can be used to bootstrap multiple XUL + XPCOM applications that are as rich as Firefox and Thunderbird.

References

  1. ^ Jorge O. Castro (June 15, 2004). "Ars Technica sits down with Scott Collins from Mozilla.org". Ars Technica.
  2. ^ Ryan Paul (September 9, 2008). "Why Mozilla is committed to Gecko as WebKit popularity grows". Ars Technica.
  3. ^ "Gecko:DeCOMtamination".