emptyother
emptyother

Reputation: 143

Find the source file of a function in Firefox DevTools

In Chrome Devtools console, if I output a Function object, it shows the top few lines of the function. I can click on the function name in the output and it takes me to the file and line where the function were loaded from (or from the original source if theres a source map):

Chrome Devtools showing the original source code

In the new Firefox Devtools (Quantum) is it possible to find the sourcefile and linenumber for the function? Clicking on it only reveals the Function object itself:

Firefox Devtools showing a Function object

I found i can use Function.toSource() to view the source code in Firefox Devtools console . But it gives no hint about which file or line it's from:

Firefox Devtools, converting a Function to string

Upvotes: 2

Views: 499

Answers (1)

Sebastian Zartner
Sebastian Zartner

Reputation: 20125

The DevTools show a button to jump to the function's definition for quite some time now.

Jump to function definition from console

I cannot pinpoint in what version this feature got added but it must have been around Firefox 61 when the new Console UI got enabled.

Upvotes: 2

Related Questions