This reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the components, provided by the XPCOM glue library. The contents herein are oriented primarily toward extension developers and people embedding XPCOM in other projects.
WebExtensions are becoming the new standard for creating add-ons. Eventually support for XPCOM add-ons will be deprecated, so you should begin to investigate porting your add-ons to use the WebExtensions API, and report any missing functionality so we can be sure to address your concerns. Work is ongoing on WebExtension capabilities, so your input will help prioritize and plan the work. To learn more about the kinds of changes that will be needed, see Comparison with XUL/XPCOM extensions. In addition, any binaries you use will then need to be converted for use with the WebExtensions native messaging API, or compiled using WebAssembly or Emscripten.
If you're working on a module in the Mozilla codebase that's compiled with the MOZILLA_INTERNAL_API
flag set, some of these APIs -- the string functions and classes in particular -- are not the ones you should be using. See the XPCOM internal string guide for documentation of the internal string API used within the Mozilla codebase.
NS_ASSERTION
) with the text "Error: (error text)", so writes this text to console (stderr) and to debug logs (NSPR logging). This macro is meant for critical errors; like assertions, NS_ERROR
s should not be reachable.nsIAbCard
interface is used to represent and manipulate cards in the address book. In a big change from the original nsIAbCard
, properties are now stored in a hash table instead of as attributes on the interface, allowing it to be more flexible.nsMsgMessageFlags
interface describes possible flags for messages. Equivalent flags are also defined in nsMsgMessageFlags.h.nsMsgNavigationType
interface contains constants used for message navigation in Thunderbird. For example to move forward a message, you would call:nsMsgViewCommandCheckState
interface contains constants used for command status in Thunderbird. It is (as far as I can tell) not currently used anywhere in Thunderbird.nsMsgViewCommandType
interface contains constants used for commands in Thunderbird. For example to mark a message read, you would call:nsMsgViewFlagsType
interface contains constants used for view flags in Thunderbird. This interface isn't ever implemented. It is only used to store constants. For example, the 'unread only' view would use the flag:nsMsgViewSortOrder
interface contains constants used for sort direction in Thunderbird. This interface isn't ever implemented. It is only used to store constants. For example to sort by date you would pass a function the value:nsMsgViewSortType
interface contains constants used for sorting the Thunderbird threadpane. This interface isn't ever implemented. It is only used to store constants. For example to sort by date you would pass a function the value:nsMsgViewType
interface contains constants used for views in Thunderbird. This interface isn't ever implemented. It is only used to store constants. For example, to request the 'show all threads' view use the constant:Many XPCOM pages return an nsresult
. Prior to Gecko 19 (Firefox 19 / Thunderbird 19 / SeaMonkey 2.16), this was an integer that simply returned an error code. It is now a strongly typed enum
when XPCOM is built using a C++11 compiler. This causes compile-time errors to occur when improper values are returned as nsresult values, thereby making it easier to catch many bugs.