To secretly copy JavaScript function to clipboard, use any of the following method: clear() and profile(). These functions work on JavaScript console as well,
For clear(),
InjectedScriptHost.clearConsoleMessages();
For profile(),
console.profile.apply(console, arguments)
For copy(),
InjectedScriptHost.copyText(object);