How do I find a JS function declaration in the sources of FF ?
First I wanted to find declaration of function \"copy\". I opened console, typed and executed \'copy.toSou
The source of copy
(assuming you mean "copy to clipboard") is in ./toolkit/devtools/webconsole/utils.js
. It is small, so here it is:
WebConsoleCommands._registerOriginal("copy", function JSTH_copy(aOwner, aValue)
{
let payload;
try {
if (aValue instanceof Ci.nsIDOMElement) {
payload = aValue.outerHTML;
} else if (typeof aValue == "string") {
payload = aValue;
} else {
payload = JSON.stringify(aValue, null, " ");
}
} catch (ex) {
payload = "/* " + ex + " */";
}
aOwner.helperResult = {
type: "copyValueToClipboard",
value: payload,
};
});
The console.*
functions get defined in ./dom/base/Console.cpp