The obvious answer is as follows:
var origCall = Function.prototype.call; Function.prototype.call = function (thisArg) { console.log("calling a function"); var args = Array.prototype.slice.call(arguments, 1); origCall.apply(thisArg, args); };
But it actually immediately falls into an infinite loop, because the call to the console.log call itself makes a function call that calls console.log, which makes a function call that calls console.log , which ...
OR
I assume you want to filter your own functions. In Firefox, Function.toString() returns the body of the function, which for the native functions will be in the form:
function addEventListener() { [native code] }
You can map the pattern /\[native code\]/ in your loop and omit the functions that match.
source share