Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at

Hackeando Gaia

Esta página está dirigida a desarrolladores de Gaia. Si usted está buscando información acerca de cómo construir y ejecutar Firefox OS, debería consultar la página de Construyendo e Instalando Firefox OS en su lugar.

Gaia es la colección de aplicaciones web que forman la interfaz de Firefox OS. Cualquier cosa que usted vea en la pantalla del Firefox OS es creada usando tecnologías web abiertas. Esto incluye la pantalla de inicio y todas las aplicaciones predeterminadas.

Obteniendo el código fuente

Para obtener el código fuente de Gaia, fork us on GitHub and then clone your fork using git.

$ git clone

Ejecutando Gaia

Usted puede ejecutar Gaia en el escritorio, en Firefox, o en un un dispositivo móvil compatible.

B2G desktop

B2G desktop es una versión de escritorio de la aplicación de ejecución utilizada en los dispositivos Firefox OS, la cual puedes utilizar para correr Gaia en tu computadora de escritorio.

Puedes descargar una versión nightly de B2G desktop desde aquí.Dependiendo de qué versión estés utilizando, puede que quieres una versión específica de latest-mozilla-b2g18. Hay versiones para Linux (32 bits y 64 bits), Mac OS X y Windows.

Las versiones Nightly tienen empaquetadas con ellas una versión reciente de Gaia. Una vez que hayas descargado el archivo, todo lo que necesitas es extraerlo en una carpeta y correr el binario de b2g desde la carpeta extraída.

Nota: Las versiones de 64-bits de Linux no funcionan correctamente con algunas distribuciones, se trata del bug 812484. Si tienes problemas trata con una versión de 32-bits en lugar de una de 64-bits

$ cd b2g
$ ./b2g

Para correr B2G con tu propia versión de Gaia para propósitos de desarrollo primero necesitas una construir una versión de tu copia:

$ cd /path/to/gaia
$ DEBUG=1 make

Esto generara un directorio en tu carpeta gaia llamada profile. La parte DEBUG correo Gaia como aplicaciones locales en servidor-web interno, en lugar las aplicaciones empaquetadas por defecto, estas tienen que ser re-empaquetadas después de cada cambio. Puedes encontrar la ruta del perfil de directorio tomando un vistazo a la última línea de salida después de ejecutar el comando de abajo, que debería verse así:

Profile Ready: please run [b2g|firefox] -profile /path/to/gaia/profile

Puedes entonces correr B2G Desktop con tu perfil generado como se indica abajo:

$ ./b2g /path/to/gaia/profile

Si quieres puedes compilar tu propio B2G desktop desde el código.

Usando Gaia en Firefox

It's also possible to run Gaia inside of Firefox. This gives you the advantages of having a rapid development cycle, as well as standard web development tools and debuggers. See Using Gaia in Firefox for details on how to do this.

Usando Gaia en un dispositivo

If you have a compatible mobile device you can also run Gaia by flashing it with Firefox OS. See Building and installing Firefox OS for details on how to do this. We also have documentation for how to test Firefox OS.

Unidad de pruebas

See Gaia unit tests for documentation about how to create and run unit tests for Gaia.

Presentando errores

Bugs are filed on Bugzilla under Firefox OS > Gaia. File a new bug under the Gaia component (or one of the sub-components).

Contribuyendo a Gaia

Mozilla depends on contributions from the open source community to help develop Gaia apps and we'd love you to get involved.

Some great places to find some bugs to start hacking on:

Estilos de codificación básicos

  • Background:
  • Make sure HTML files are declared <!DOCTYPE html> (that is, as HTML5 documents). If you don't, Internet Explorer 9 and later will load them in compatibility mode.
  • Include the "use strict"; statement (just like that, including the quotes) to the top of your JavaScript files to put them into strict mode.
  • Always use two spaces for indentation, rather than tabs.
  • Please use line breaks to separate logical bits of code!
  • Multi-word file names should use the "underscore" character to separate words, like_this.js.
  • Use single quotes instead of double quotes for strings.

Reglas Adicionales


if (expression) doSomething();


if (expression) {

If you're working on the system app, check out the guidance listed here.

Before submitting a patch we recommend you run gjslint on it to check for any style errors:

gjslint --nojsdoc my_file.js

Enviando un parche

First file or assign a bug to yourself on Bugzilla, you'll need a Bugzilla account.

Then create a branch on your fork of Gaia:

$ git branch branchname
$ git checkout branchname

Commit your changes:

$ git add /file/to/add
$ git commit -m "Bug XXXXX - Fix the broken Gaia and save the world"

Push your branch:

$ git push origin branchname

Send a pull request by navigating to the branch in your fork on GitHub and finding the pull request button.

To request a review of your patch, add an attachment to the bug in Bugzilla referencing the URL of the pull request and set the review ("r") flag to "?" and enter the bugzilla ID of one of the module owners and peers. The Github tweaks for bugzilla extension on AMO can help automate this process by automatically creating the attachment and adding it to the bug; you will still need to set the review flag on Bugzilla.

The reviewer may ask you to make some changes. Once they're is happy with your patch, they will merge it into the master branch for you. Before they do this they would prefer it if you could squash all your changes into a single commit, so your contribution can be tracked easily.

The person who merge the commit (usually the reviewer) would add a r= flag in the comment of the merge commit.

Opciones de Make

There are many undocumented nor unsupported environment variable presists in the Makefile. Do not depend on them as they may be removed in the future.



Make a profile with packaged apps, lunachable by B2G Desktop and can be pushed to device.

Debug make

DEBUG=1 make

The DEBUG part runs Gaia as hosted apps on a built-in web server, rather than the default packaged apps which have to be re-packaged after every change. Launch the profile with the latest Firefox Nightly will also give you nice B2G specific panels on the Firefox Developer Tools.

Push to device

make install-gaia

make reset-gaia

With adb (Android Debug Bridge) setup, these make targets will push Gaia to the device. reset-gaia will purge the profile and all other webapps before pushing the new Gaia copy.

Selective build

APP=system make

APP=system make install-gaia

With a profile already exists, APP allow you to specify which app to re-package, instead of re-pack and re-push all the Gaia apps.

High resolution image assets


When packaging the app, replace images with their *@1.5x.(gif|jpg|png) ones if such image exists.

Gaia is currently targetting HBGA (320x240), qHD (540×960) and WVGA (480×800) only; use GAIA_DEV_PIXELS_PER_PX to make sure the images looks sharp on qHD and WVGA devices. see A pixel is not a pixel for more information about device pixels per css pixels.

Script compression and optimization



App selection

GAIA_APP_SRCDIRS=apps test_apps showcase_apps


App selection shortcuts



Preference shortcuts



Device webapp installation partation selection



Distribution and market customization build


Read Customization Overview for detail.

Contacting the Team

Etiquetas y colaboradores del documento

 Colaboradores en esta página: chrisdavidmills, GeekerX, StripTM, EdwardNavarro, cargabsj175
 Última actualización por: chrisdavidmills,