Jump to content

XPCOM: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Jorgk3 (talk | contribs)
m Removed dead link
Link to SOM instead to a section of it.
 
(67 intermediate revisions by 32 users not shown)
Line 1: Line 1:
'''Cross Platform Component Object Model) is a [[cross-platform]] [[Component-based software engineering|component model]] from [[Mozilla]]. It is similar to [[Component Object Model COM]] and [[]]. It features multiple [[language binding]]s and [[ description language]] descriptions; thus programmers can plug their custom into the framework and connect it with other components.
{{Portal|Free software}}


The most prominent usage of XPCOM is within the [[Firefox]] web browser. Many of its internal components interact via XPCOM interfaces. Furthermore, Firefox used to allow [[Add-on (Mozilla)|add-ons]] extensive XPCOM access, but this was removed in 2017 and replaced with the less-permissive [[Browser extension#API conformity|WebExtensions API]].<ref>[https://www.mozilla.org/en-US/firefox/57.0/releasenotes/ Firefox 57 release notes]</ref><ref>{{cite web|title=The Future of Developing Firefox Add-ons|url=https://blog.mozilla.org/addons/2015/08/21/the-future-of-developing-firefox-add-ons/|date=2015-08-21|author=Kev Needham|access-date=2018-04-02|website=blog.mozilla.org}}</ref> (Two [[Fork (software development)|forks]] of Firefox still support XPCOM add-on capability: [[Pale Moon (web browser)|Pale Moon]]<ref>{{cite web|url=https://www.palemoon.org/roadmap.shtml |title=Pale Moon future roadmap | access-date=2018-04-02 |publisher=[[Pale Moon (web browser)|Pale Moon]]}}</ref> and [[Basilisk (web browser)|Basilisk]].<ref>{{cite web|title=Pale Moon team releases first version of Basilisk browser|url=https://www.ghacks.net/2017/11/17/pale-moon-team-releases-first-version-of-basilisk-browser/|website=ghacks.net|date=2017-11-17|access-date=2018-04-02}}</ref>)
'''XPCOM''' (Cross Platform Component Object Model) is a [[cross-platform]] [[Component-based software engineering|component model]] from [[Mozilla]]. It is similar to [[Component Object Model|Microsoft COM]] and [[CORBA]]. It features multiple [[language binding]]s and [[Interface description language|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:
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
*Component management
*File abstraction
*File abstraction
*[[Message passing|Object message passing]]
*[[Message passing|Object message passing]]
*[[Memory management]]
*[[Memory management]]


This component object model makes virtually all of the functionality of [[Gecko (layout engine)|Gecko]] available as a series of components, or reusable cross-platform [[software library|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 ([[computer network|networking]], [[computer security|security]], [[Document Object Model|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)|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 (programming language)|Python]]. PerlConnect [http://www.mozilla.org/owners.html#perlconnect] and plXPCOM [http://plxpcom.mozdev.org/] provide support for [[Perl]], and there are efforts underway to add [[Common Language Infrastructure|CLI]] and [[Ruby programming language|Ruby]] language support for XPConnect.
This component object model makes virtually all of the functionality of [[Gecko (layout engine)|Gecko]] available as a series of components, or reusable cross-platform [[software library|libraries]], that can be accessed from the [[web browser]] or scripted from any Mozilla application. Applications that access the various Mozilla XPCOM libraries ([[ network|networking]], [[ security|security]], [[Document Object Model|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 (programming language)|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 (programming language)|Python]]. [://.////] provide support for [[Perl]], and there are efforts underway to add [[Common Language Infrastructure]] and [[Ruby programming language|Ruby]] language support for XPConnect.


On the developer side, XPCOM lets you write components in [[C++]], [[C (programming language)|C]], [[JavaScript]], [[Python (programming language)|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.
, XPCOM components in [[C++]], [[C (programming language)|C]], [[JavaScript]], [[Python (programming language)|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.
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 (computer science)|marshalling]] objects between different usage contexts (e.g. different languages). This leads to code [[Software bloat|bloat]] in XPCOM based systems. This was one of the reasons why [[Apple Inc.|Apple]] forked [[KHTML]] to create the [[WebKit|WebKit engine]] (which is now used in several web browsers in various forms, including [[Safari (web browser)|Safari]] and [[Google Chrome]]) over the XPCOM-based [[Gecko (layout engine)|Gecko]] rendering engine for their web browser.<ref>{{cite web
XPCOM adds a lot of code for [[Marshalling (computer science)|marshalling]] objects [[ bloat]] . This was why [[Apple Inc.|Apple]] forked [[KHTML]] to create the [[WebKit engine]] [[Safari (web browser)|Safari]] |]] <ref>
| url = http://arstechnica.com/open-source/news/2004/06/collins-interview.ars
| title = Ars Technica sits down with Scott Collins from Mozilla.org
| author = Jorge O. Castro
| publisher = [[Ars Technica]]
| date = June 15, 2004
}}</ref><ref>{{cite web
| url = http://arstechnica.com/open-source/news/2008/09/mozilla-committed-to-gecko.ars
| title = Why Mozilla is committed to Gecko as WebKit popularity grows
| author = Ryan Paul
| publisher = [[Ars Technica]]
| date = September 9, 2008
}}</ref>


Mozilla has since cleaned up some of the XPCOM bloat.<ref>{{cite web | url= https://wiki.mozilla.org/Gecko:DeCOMtamination | title= Gecko:DeCOMtamination}}</ref> By 2008, this combined with other efforts resulted in big performance improvements for [[Gecko (software)|Gecko]].<ref>{{cite web |url =https://arstechnica.com/information-technology/2008/09/mozilla-committed-to-gecko/ |author = Ryan Paul |title = Why Mozilla is committed to Gecko as WebKit popularity grows |date = 2008-09-09 |access-date=2017-02-16}}</ref>
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.<ref>{{cite web
<!--Note: this section is NOT about add-on support, it's about core browser functionality. So don't add Firefox 57 or similar info here; that's already sufficiently covered in the lede.-->
| url = https://wiki.mozilla.org/Gecko:DeCOMtamination
| title = Gecko:DeCOMtamination
| author =
| publisher =
| date =
}}</ref>

==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==
==References==
Line 47: Line 27:


==External links==
==External links==
*[https://www-archive.mozilla.org/projects/xpcom/book/cxc/html/appb XPCOM API Reference]
{{Wiktionary}}
*[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Reference XPCOM API Reference]
*[https://.mozilla.org// XPCOM ]
*[https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM XPCOM Project Homepage]
*[http://books.mozdev.org/html/mozilla-chp-8.html A slightly out-of-date but still useful book that talks about XPCOM]
*[http://www.codeproject.com/Articles/87465/A-Simple-XPCOM-Tutorial A Simple XPCOM Tutorial]
*[http://www.codeproject.com/Articles/87465/A-Simple-XPCOM-Tutorial A Simple XPCOM Tutorial]
{{Mozilla projects}}
{{Mozilla projects}}


{{DEFAULTSORT:Xpcom}}
{{DEFAULTSORT:Xpcom}}
[[Category:Application programming interfaces]]
[[Category:Mozilla]]
[[Category:Mozilla]]
[[Category:Application programming interfaces]]

Latest revision as of 20:12, 23 June 2024

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; thus programmers can plug their custom functions into the framework and connect it with other components.

The most prominent usage of XPCOM is within the Firefox web browser. Many of its internal components interact via 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.[1][2] (Two forks of Firefox still support XPCOM add-on capability: Pale Moon[3] and Basilisk.[4])

Model

[edit]

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 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[5] already offers support for Python. wxWidgets[6] 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

[edit]

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.[7] This was a key reason why in 2001 Apple forked KHTML, not Gecko, to create the WebKit engine for its Safari browser.[8]

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

References

[edit]
  1. ^ Firefox 57 release notes
  2. ^ Kev Needham (2015-08-21). "The Future of Developing Firefox Add-ons". blog.mozilla.org. Retrieved 2018-04-02.
  3. ^ "Pale Moon future roadmap". Pale Moon. Retrieved 2018-04-02.
  4. ^ "Pale Moon team releases first version of Basilisk browser". ghacks.net. 2017-11-17. Retrieved 2018-04-02.
  5. ^ PyXPCOM[dead link]
  6. ^ Perl Based Cross Platforms Developments
  7. ^ Jorge O. Castro (2004-06-15). "Ars Technica sits down with Scott Collins from Mozilla.org". Ars Technica. Retrieved 2017-02-16.
  8. ^ Paul Festa (2003-01-14). "Apple snub stings Mozilla". CNET Networks. Archived from the original on 2012-10-25. Retrieved 2017-02-16.
  9. ^ "Gecko:DeCOMtamination".
  10. ^ Ryan Paul (2008-09-09). "Why Mozilla is committed to Gecko as WebKit popularity grows". Retrieved 2017-02-16.
[edit]