These articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for your Firefox add-ons and the like.
- Avoiding leaks in JavaScript XPCOM components
- Programmers writing and reviewing JavaScript code in Mozilla should understand how code using XPCOM in JavaScript can leak so that they can avoid leaks. This document attempts to help them do so, first by explaining the underlying concepts, and second by describing a number of common JavaScript patterns that cause leaks.
- Creating XPCOM components
- This guide is about Gecko, and about creating XPCOM components for Gecko-based applications.
- How to build an XPCOM component in Javascript
- If you are looking for Add-on SDK solution for XPCOM JavaScript components then check out platform/xpcom module first.
- Inheriting from implementation classes
- Given that IDL interfaces map to abstract classes in C++, a common problem when dealing with IDL is when you have an IDL inheritance hierarchy, and a corresponding C++ implementation hierarchy, you run into multiple inheritance. That's not inherently multiple inheritance, though, because you only mix in interfaces (i.e. the problem would not exist with Java's
interface
s). - Making cross-thread calls using runnables
- In the Mozilla platform, most activities such as layout, DOM operations, content JavaScript, and chrome JavaScript run on the main thread. However, it may be useful for C++ code in the Mozilla platform to run tasks on another thread.
- Mozilla internal string guide
- Most of the Mozilla code uses a C++ class hierarchy to pass string data, rather than using raw pointers. This guide documents the string classes which are visible to code within the Mozilla codebase (code which is linked into libxul).
services
C++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect XPCOM approach: GetService()
, CallGetService()
, etc methods are expensive and should be avoided when possible.