// original chrome.manifest:
component {00000000-0000-0000-0000-000000000000} implementation.js
contract @example.com/contract;1 {00000000-0000-0000-0000-000000000000}
// original implementation.js:
var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
let classID = Components.ID("{00000000-0000-0000-0000-000000000000}");
let contractID = "@example.com/contract;1";
function exampleComponent() {
/* ... implementation ... */
exampleComponent.prototype = {
/* ... implementation ... */
var NSGetFactory = XPCOMUtils.generateNSGetFactory([exampleComponent]);
/* ... do the following in an init() method only called once from your
var { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
let classID = Components.ID("{00000000-0000-0000-0000-000000000000}");
let contractID = "@example.com/contract;1";
function exampleComponent() {
/* ... implementation ... */
exampleComponent.prototype = {
/* ... implementation ... */
let factory = XPCOMUtils.generateNSGetFactory([exampleComponent])(classId);
// WARNING: this assumes that Thunderbird is already running, as
// Components.manager.registerFactory will be unavailable for a few
// milliseconds after startup.
Components.manager.registerFactory(classID, "exampleComponent", contractID,
context.callOnClose({close(){
Components.manager.unregisterFactory(classID, factory);