You don't. This isn't a one-to-one relationship between contracts and interfaces but a many-to-many one:
- A single component as accessible by a contract can implement multiple interfaces.
- A single interface can have multiple components implementing it and therefore multiple contracts.
But, often it is a one-to-one relationship in practice. E.g. if I wanted to find out about what components implement nsILocalFile
, I'd search it in the sources, for instance:
- MXR: http://mxr.mozilla.org/mozilla-central/ident?i=nsILocalFile&tree=mozilla-central
- A glance over the result list already tells me:
line 1255 -- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
- Else I'd have to look at the files the different results link, starting with the
.js
ones.
Other times, the contract ids are even specified in the idl itself, e.g. in nsITimer.idl
(at the bottom).
The most commonly used interfaces usually are also present on MDN incl. contracts, e.g. nsILocalFile
.