CodeQL library for JavaScript/TypeScript
codeql/javascript-all 1.0.1 (changelog, source)

Member predicate DataFlow::InvokeNode::getABoundCallbackParameter

Gets a parameter of a callback passed into this call.

callback indicates which argument the callback passed into, and param is the index of the parameter in the callback function.

For example, for the call below, getABoundCallbackParameter(1, 0) refers to the parameter e (the first parameter of the second callback argument):

addEventHandler("click", e => { ... })

This predicate takes interprocedural data flow into account, as well as partial function applications such as .bind.

For example, for the call below getABoundCallbackParameter(1, 0) returns the parameter e, (the first parameter of the second callback argument), since the first parameter of foo has been bound by the bind call:

function foo(x, e) { }
addEventHandler("click", foo.bind(this, "value of x"))
ParameterNode getABoundCallbackParameter(int callback, int param)