Skip to content
Surf Wiki
Save to docs
general/application-programming-interfaces

From Surf Wiki (app.surf) — the open knowledge base

XPCOM

Cross-platform component model from Mozilla


Cross-platform component model from Mozilla

Cross Platform Component Object Model (XPCOM) is a cross-platform component model from Mozilla. It is similar to Component Object Model (COM), Common Object Request Broker Architecture (CORBA) and system object model (SOM). It features multiple language bindings and interface description language (IDL) descriptions, which allow programmers to plug their custom functions into the framework and connect them with other components.

The most notable use of XPCOM is within the Firefox web browser, where many internal components interact through XPCOM interfaces. Furthermore, Firefox used to allow add-ons extensive XPCOM access, but this was removed in 2017 and replaced with the less-permissive WebExtensions API. Two forks of Firefox still support XPCOM add-on capability: Pale Moon and Basilisk.

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:

  • Component management
  • File abstraction
  • Object message passing
  • Memory management

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 must 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++, C, or Rust programming language based components in XPCOM, and it can be extended to include scripting support for other languages: PyXPCOM already offers support for Python. wxWidgets provide support for Perl, and there are efforts underway to add Common Language Infrastructure (CLI) and Ruby language support for XPConnect.

For developers, XPCOM allows writing 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 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.

Past overuse

XPCOM adds a lot of code for marshalling objects, and in the Netscape era XPCOM was overused for internal interfaces where it wasn't truly necessary, resulting in software bloat. This was a key reason why in 2001 Apple forked KHTML, not Gecko, to create the WebKit engine for its Safari browser.

Mozilla has since cleaned up some of the XPCOM bloat. By 2008, this combined with other efforts resulted in big performance improvements for Gecko.

References

References

  1. [https://www.mozilla.org/en-US/firefox/57.0/releasenotes/ Firefox 57 release notes]
  2. Kev Needham. (2015-08-21). "The Future of Developing Firefox Add-ons".
  3. "Pale Moon future roadmap". [[Pale Moon (web browser).
  4. (2017-11-17). "Pale Moon team releases first version of Basilisk browser".
  5. "PyXPCOM".
  6. {{usurped
  7. Jorge O. Castro. (2004-06-15). "Ars Technica sits down with Scott Collins from Mozilla.org". Ars Technica.
  8. Paul Festa. (2003-01-14). "Apple snub stings Mozilla". [[CNET Networks]].
  9. "Gecko:DeCOMtamination".
  10. Ryan Paul. (2008-09-09). "Why Mozilla is committed to Gecko as WebKit popularity grows".
Info: Wikipedia Source

This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page.

Want to explore this topic further?

Ask Mako anything about XPCOM — get instant answers, deeper analysis, and related topics.

Research with Mako

Free with your Surf account

Content sourced from Wikipedia, available under CC BY-SA 4.0.

This content may have been generated or modified by AI. CloudSurf Software LLC is not responsible for the accuracy, completeness, or reliability of AI-generated content. Always verify important information from primary sources.

Report