Setting up to debug Firefox OS using Firefox developer tools

  • Revision slug: Mozilla/Boot_to_Gecko/Debugging_on_Boot_to_Gecko/Setting_up
  • Revision title: Setting up to debug on Firefox OS using Firefox developer tools
  • Revision id: 333021
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

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.

Firefox desktop

You need to be sure you have a build of Firefox 18 or later in order to have remote debugging support. Firefox 18 is currently on the Aurora channel (as of November 28, 2012). If you don't have Firefox 18 or later, you can download a copy from nightly.mozilla.org. Uncompress it, install it in your favorite place for applications, quit any already-running copies of Firefox, then start up Nightly.

Once you're running an appropriate version of Firefox on your computer, type about:config in the URL bar and change the value of devtools.debugger.remote-enabled to true. Then you'll need to restart Firefox to get remote debugging enabled. After restarting Firefox, you'll see a new Remove Debugger option in the Web Developer menu.

Note: This will also enable support for Remote Web Console.

Firefox OS

On your Firefox OS device, open the Settings app, then choose Device Information. On that page, you'll see a More Information button. Tap that, then in the following page, scroll down to "Developer" and tap that. That presents a list of developer options. Turn on Remote Debugging. You also need to turn off out-of-process support, until {{bug(797627)}} is fixed. Without doing so, only system scripts can be debugged.

Next, you need to do a little tinkering, in order to work around {{bug(764913)}}. You need to add a line to the prefs.js file on the device. To do that, open a terminal window on your computer and use the command adb shell to connect to the shell on the device. Then type:

ls /data/b2g/mozilla/

Your profile folder will be listed there. Note its name; mine was 9qojugvc.default, but of course yours will almost certainly be different. Quit the adb shell, then type the following command, replacing the profile folder name as appropriate:

adb pull /data/b2g/mozilla/9qojugvc.default/prefs.js prefs.js

Then open the prefs.js you just downloaded onto your computer and insert the following line into it:

user_pref("marionette.defaultPrefs.enabled", false); 

Now you can push the changed file back to the device:

adb push prefs.js /data/b2g/mozilla/9qojugvc.default/prefs.js

Now restart your device.

Reminder: If you flash your device, you'll need to redo these configuration changes.

 

Revision Source

<p>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.</p>
<h3 id="Firefox_desktop">Firefox desktop</h3>
<p>You need to be sure you have a build of Firefox 18 or later in order to have remote debugging support. Firefox 18 is currently on the Aurora channel (as of November 28, 2012). If you don't have Firefox 18 or later, you can download a copy from <a href="http://nightly.mozilla.org/" title="http://nightly.mozilla.org/">nightly.mozilla.org</a>. Uncompress it, install it in your favorite place for applications, quit any already-running copies of Firefox, then start up Nightly.</p>
<p>Once you're running an appropriate version of Firefox on your computer, type <code>about:config</code> in the URL bar and change the value of <code>devtools.debugger.remote-enabled</code> to <code>true</code>. Then you'll need to restart Firefox to get remote debugging enabled. After restarting Firefox, you'll see a new Remove Debugger option in the Web Developer menu.</p>
<div class="note">
  <p><strong>Note:</strong> This will also enable support for Remote Web Console.</p>
</div>
<h3 id="Firefox_OS">Firefox OS</h3>
<p>On your Firefox OS device, open the Settings app, then choose Device Information. On that page, you'll see a More Information button. Tap that, then in the following page, scroll down to "Developer" and tap that. That presents a list of developer options. Turn on Remote Debugging. You also need to turn off out-of-process support, until {{bug(797627)}} is fixed. Without doing so, only system scripts can be debugged.</p>
<p>Next, you need to do a little tinkering, in order to work around {{bug(764913)}}. You need to add a line to the <code>prefs.js</code> file on the device. To do that, open a terminal window on your computer and use the command <code>adb shell</code> to connect to the shell on the device. Then type:</p>
<pre>
ls /data/b2g/mozilla/</pre>
<p>Your profile folder will be listed there. Note its name; mine was <code>9qojugvc.default</code>, but of course yours will almost certainly be different. Quit the adb shell, then type the following command, replacing the profile folder name as appropriate:</p>
<pre>
adb pull /data/b2g/mozilla/9qojugvc.default/prefs.js prefs.js</pre>
<p>Then open the <code>prefs.js</code> you just downloaded onto your computer and insert the following line into it:</p>
<pre>
<span style="font-family: &quot;Courier New&quot;,Courier,monospace;"><span style="background-color: transparent; color: black; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">user_pref("marionette.defaultPrefs.enabled", false);</span></span> </pre>
<p>Now you can push the changed file back to the device:</p>
<pre>
adb push prefs.js /data/b2g/mozilla/9qojugvc.default/prefs.js</pre>
<p>Now restart your device.</p>
<div class="note">
  <p><strong>Reminder:</strong> If you flash your device, you'll need to redo these configuration changes.</p>
</div>
<p>&nbsp;</p>
Revert to this revision