Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Firefox OS apps architecture

This article explains the internals of how applications are launched and managed in Firefox OS. This information will be useful for Firefox OS platform developers, as well as teams porting the operating system to new hardware. You don't really need this if you are an app developer, but it might still be interesting.

The app startup process

When the user selects an app they'd like to launch, or an app otherwise needs to be launched, the home screen app starts by getting an app reference from the App API, then calling the App.launch() method to launch the app.

Gecko receives that request and sends the mozChromeEvent to the System app with the app's details. The System app handles that event by inserting a new <iframe> into its DOM tree and loading the app within the new <iframe>. That frame will be the app's home until it terminates.

Every app requires a manifest that describes the app, and has a particular file hierarchy within its package. For details, see the article App manifest.

Communication with Gecko

The communication between Gecko and Gaia's System app is done via mozChromeEvent and mozContentEvent. mozChromeEvents are broadcast from chrome to content and mozContentEvents are broadcast from content to chrome. This communication is used to control the creation and closure of the trusted UI and to inject the required functions for notifications and other tasks, including telling the System app to start an app.

Note: You find more out about how these events work by reading our System app documentation. You can also glean a lot about how this is used by looking at the code in b2g/chrome/content/shell.js.

See also

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, teoli, kscarfone, aurigadl, kohei.yoshino, Sheppy
 Last updated by: chrisdavidmills,