Firefox OS supports the same remote debugging protocol that Firefox mobile supports on Android. This means you can use the Firefox development tools to debug Gaia applications running on a Firefox OS device or emulator. In order to debug Firefox OS running on your device or on the Firefox OS Simulator, you need to use Firefox 18 or later; in addition, there are settings that need to be changed both in your desktop browser's configuration and on your Firefox OS device or simulator.
Note: If you want to debug apps on a Firefox OS device, and you are running Firefox 1.2+, your best option is to use the App Manager instead.
You need to be sure you have a build of Firefox 18 or later in order to have remote debugging support. If you don't already have a recent copy of Firefox, download the latest Nightly build to get access to all the latest features.
Once you're running an appropriate version of Firefox on your computer, type
about:config in the URL bar and change the value of
true. Then you'll need to restart Firefox to get remote debugging enabled. After restarting Firefox, the Web Developer menu will have a new option, Tools > Connect...
When using the Firefox OS Simulator (or B2G Desktop), setting up for debugging is pretty easy. You don't need to do any port forwarding like you do when debugging on a physical device. Simply open your device's Developer settings and enable Remote Debugging.
Note: This no longer works on Firefox OS devices as of January 10, 2013. As of this date device builds of Firefox OS have debugging disabled. There will eventually be a way to build your own build with it re-enabled, but this doesn't exist yet. This document will be updated once that happens. In addition, the preference for turning off out-of-process support has been removed. For now, you'll need to do your debugging in the Firefox OS Simulator.
If using a real Firefox OS device, open the Developer settings and:
- Turn on Remote Debugging.
- Turn off Out-of-process support, until error 797627 is fixed. Without doing so, only system scripts can be debugged.
Note: If you flash your device, you'll need to redo these configuration changes.
Now you're ready to use the debugger!
Enabling console logging on a Firefox OS device
Note: read On-device console logging for more details about how to use console logging on Firefox OS.