Why Mozilla has JavaScript documentation written using IDL

Reading the documentation on fileReader and finding out that they write methods using void , for example:

void readAsArrayBuffer ( in Blob blob ); 

just trying to understand why they write like that? If there is a practical use of this syntax?

Later it turns out to be not quite js, but IDL, which is the language description interface.

FYI: before asking this question, I do google and read about the actual void operator in JS. Therefore, please do not need to return me back. The question is a bit vague, but you have to deal with it, why does Mozilla have JavaScript documentation written like this? In IDL, which is little with actual JavaScript?

+6
source share
1 answer

Mozilla uses IDL in two ways.

  • Web IDL : used in the W3C specs and to describe the Javascript API. These are regulatory specifications.

  • XPCOM internal IDL dialect: Javascript native APIs implemented in C ++. In the case of Gecko (Firefox engine), in particular, in the domain infrastructure called XPCOM

As the linked page indicates, Gecko internally describes interfaces in the language of a neutral IDL dialect, since this interface must be implemented both in real time (C ++) and in the Javascript engine (Javascript).

In this case, the IDL description will either copy-paste from the orignal Web IDL specification, or from the internal implementation of Gecko.

+3
source

All Articles