views:

47

answers:

2

When you need to create or access well-known objects in XPCOM, where do you find their contract IDs?

A: 

It really depends on the object you are looking for. Generally, the documentation will tell you what the contract ID is. If there's a specific contract ID you are looking for, that'd be an easier to answer question.

sdwilsh
Replace "generally" with "sometimes". However, I found all contract IDs I needed using Google. The documentation often does only describe the interface but does not contain the contract ID. Sometimes there isn't even a description of the interface on https://developer.mozilla.org/ even though the interface in question has appropriate comments on http://mxr.mozilla.org/. Sometimes even the documentation there is incomplete and you have to look at a certain implementation of the interface.
panzi
PS: How I use Google for this purpose: I just google for:`getService(Components.interfaces.nsIInterfaceInQuestion)`or`createInstance(Components.interfaces.nsIInterfaceInQuestion)`
panzi
Note that it is a wiki and can be improved by you too.
sdwilsh
+1  A: 

You also should look at the Mozilla code through http://mxr.mozilla.org to understand how people use interfaces and functions your want to use.

Paul Rouget