> could anyone please give me some insight, where the the IDLs
> (and the code generated from them) are actually used ?
>
> Javascript bindings ?

They are typically used as an interface between C++ and JS code.

As an example, consider nsIDocShell.idl [1]. This defines an interface
named "nsIDocShell" with a bunch of attributes and methods.

The IDL compiler generates a C++ binding for this, in the form of a
header file [2] that declares an abstract base class, also named
"nsIDocShell", which has pure virtual C++ methods corresponding to the
IDL methods and attributes (in the case of attributes, a getter/setter
pair is generated).

There is then a concrete C++ class, nsDocShell [3], which inherits
from nsIDocShell and implements the methods.

Finally, the interface is made available for JS code to use, which can
access its methods, attributes, etc. [4] The methods can also be
called from C++ code [5], though typically there are at least some JS
callers, otherwise the IDL wouldn't be necessary.

Let me know if that answers your question.

Cheers,
Botond

[1] 
http://searchfox.org/mozilla-central/rev/3a3af33f513071ea829debdfbc628caebcdf6996/docshell/base/nsIDocShell.idl#58
[2] 
http://searchfox.org/mozilla-central/source/__GENERATED__/dist/include/nsIDocShell.h
[3] 
http://searchfox.org/mozilla-central/rev/3a3af33f513071ea829debdfbc628caebcdf6996/docshell/base/nsDocShell.h
[4] 
http://searchfox.org/mozilla-central/rev/3a3af33f513071ea829debdfbc628caebcdf6996/browser/base/content/content.js#603
[5] 
http://searchfox.org/mozilla-central/rev/3a3af33f513071ea829debdfbc628caebcdf6996/accessible/generic/DocAccessible.cpp#355
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to