Esta tradução está em curso.
This guide explains how you can use the Firefox Developer Tools to debug a different instance of desktop Firefox running on the same machine. In this guide, the instance of Firefox being debugged is called the debuggee, and the instance of Firefox doing the debugging is called the debugger.
Ativar depuração remota
First, you'll need to ensure that both debugger and debuggee have the "Enable chrome and add-on debugging" and "Enable remote debugging" settings checked in the Developer Tools Settings.
You only need to do this once: the setting values persist across restarts.
Start the debugger server
Next, you need to start the debugger server in the debuggee.
Before Firefox 37
Before Firefox 37: open the Developer Toolbar and enter the following command:
This tells the debuggee to listen for debugger clients connecting on port 6000. You don't have to use 6000 here.
If you restart the debuggee, you need to enter this command again.
Firefox 37 onwards
From Firefox 37 onwards the above method still works, but there's an alternative: run the debuggee from the command line, passing it the
Passed with no arguments, --start-debugger-server makes the debugger server listen on port 6000. To use a different port, pass the desired port number:
/path/to/firefox --start-debugger-server 1234
Note: in Windows, the
start-debugger-server call will only have one dash:
firefox.exe -start-debugger-server 1234
Note: By default, and for security reasons, the
devtools.debugger.force-local option is set. If you want to debug a Firefox instance from an external machine, you can change this option, but only do this on a trusted network or set a strong firewall rule to lock down which machines can access it.
There are two different ways to do this: using the Connect screen, or using WebIDE.
Ecrã de ligação
In the debugger, under the Tools/Web Developer menu, there's an item labeled "Connect". Click it and you'll see a page like this:
Enter the port number you asked the debuggee to listen on and press "Connect". You should now see a dialog from the debuggee asking to confirm the connection:
Click "OK", and back in the debugger you'll see a page like this:
- Under "Available remote tabs" is a list of all tabs open in the debuggee. Click a tab to attach the developer tools to that tab.
- Under "Available remote add-ons" is a list of all add-ons installed in the debuggee. Click an add-on to attach the developer tools to that add-on.
- Under "Available remote processes" is a list of the processes running Firefox. Click "Main process" to attach the developer tools to the browser itself.
In the debugger open WebIDE, and under "Select Runtime" select "Remote Runtime":
You'll be asked to supply a hostname and port. Enter "localhost:6000", or a different port number if you asked the debuggee to listen on a different port.
Then you'll see a warning dialog:
Click OK. WebIDE will attach the developer tools to the main process. If you want to attach to a content tab, open the menu on the left-hand side and select the tab you want to debug.