Starting with Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), you can easily add new APIs to the
Programmatically adding an object to navigator
This adds a new object,
myApi, to the
window.navigator object. The newly added object is a reference to the component specified by the contract ID
MY_CONTRACT_ID. You can learn more about Contract IDs are unique text identifiers for XPCOM components.
Using a manifest to add an object to navigator
Generate a GUID and replace the "ffff" sections in both the component and contract lines with your GUID.
This adds a new API,
myComponent, to the navigator object, which you can then access as
You can see an example of how this is used in Firefox by taking a look at how the
mozApps API is implemented: