Example: I want to use the interface of nsILocalFile
in Javascript, how to find the corresponding Contract ID("@mozilla.org/file/local;1")
? Is there a map in the source code?
You don't. This isn't a one-to-one relationship between contracts and interfaces but a many-to-many one:
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:
line 1255 -- let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
.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
.