When a parameter is identified as an "in-parameter", it means that the value is passed into the function, as opposed to "out-parameters" where the function adds data to the argument or memory location that can be utilized by the calling code.
For instance, the MDN documentation includes an example with an "out-parameter":
void get(
in string prop,
in nsIIDRef iid,
[iid_is(iid),retval] out nsQIResult result
);
Here's a JavaScript sample:
function range(n, result) {
for (var i = 0; i < n; i++) {
result.push(i);
}
}
// Usage
var foo = [];
range(10, foo);
console.log(foo); // displays [0,1,2,3,4,5,6,7,8,9]
While "out-parameters" are uncommon in JavaScript, they are more prevalent in C or C++, the languages in which Firefox is developed.
As suggested by c.P.u1, this syntax is not specific to JavaScript but a representation of the interface. Mozilla utilizes XPIDL. According to their documentation:
Each method parameter can be specified as in
, out
, or inout
. An out
parameter functions as an auxiliary return value, though using it in script contexts can be cumbersome. It's recommended to avoid them if possible. An inout
parameter is an input parameter whose value may change as a result of the method, and they are generally advised to be avoided if possible due to their complexities.
Indeed, using void
signifies that the function does not return anything, but the void
operator does have a purpose (unrelated to the interface description).