TIL Debugging Gaia with B2G Desktop and WebIDE.

With some great help from Rob Wood from Mozilla Firefox OS Automation team, I finally managed to get Gaia up and running and ready for debugging with B2G Desktop Nightly build and WebIDE.

It is currently impossible to develop / debug Gaia using Firefox for Desktop. Thus, it's a pretty big barrier for new contributors who are just starting out with Gaia. Turns out, it is fairly easy to run Gaia codebase with B2G Desktop build. Here are the instructions:

Prerequisits:

Download and install B2G Desktop Nightly build

Download and install Firefox for Desktop Nightly build

Check out Gaia code base: git clone https://github.com/mozilla-b2g/gaia.git

Instructions:

In your Gaia repository build a Gaia user profile from scratch: make

Run the following command to start the B2G Nightly build with Gaia profile that you just built: /path/to/your/B2G/b2g-bin -profile /path/to/your/gaia/profile -start-debugger-server [PORT_NUMBER] For example: /Applications/B2G.app/Contents/MacOS/b2g-bin -profile /Users/me/gaia/profile -start-debugger-server 7000

Start Firefox for Desktop Nightly build

Open WebIDE (Tools -> Web Developer -> WebIDE)

Press Select Runtime -> Remote Runtime

Replace the port with the one used in step 2 ( 7000 ) and click OK

A dialog should pop up within the B2G emulator asking to permit remote debugging. Press OK

At this point you should have access to all apps bundled with the profile as well as the Main Process via WebIDE

When you make changes to Gaia code base, you can run make again to rebuild your profile. Hint: if you are working on a single app, just run APP=my_app make to only rebuild the app.

yzen