mozilla

Revision 350073 of Firefox OS apps architecture

  • Revision slug: Mozilla/Firefox_OS/Platform/Apps_architecture
  • Revision title: Firefox OS apps architecture
  • Revision id: 350073
  • Created:
  • Creator: Sheppy
  • Is current revision? No
  • Comment

Revision Content

Although you don't need to understand the internals of how applications are launched and managed on Firefox OS in order to build and distribute apps, you may be interested. Also, this information can be useful for Firefox OS platform developers, as well as teams porting the operating system to new hardware.

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 {{domxref("App")}} API, then calling the {{domxref("App.launch()")}} method to launch the app.

Gecko receives that request and sends the {{event("mozChromeEvent")}} to the System app with the app's details. The System app handles that event by inserting a new {{HTMLElement("iframe")}} into its DOM tree and loading the app within the new {{HTMLElement("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 {{event("mozChromeEvent")}} and {{event("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: We need to improve documentation about this, although it's primarily of interest to people working on the System app and the underlying support code for it. For now, you can glean a lot about how this is used by looking at the code in {{source("b2g/chrome/content/shell.js")}}.

See also

  • Apps
  • {{domxref("App")}}

Revision Source

<p>Although you don't need to understand the internals of how applications are launched and managed on Firefox OS in order to build and distribute apps, you may be interested. Also, this information can be useful for Firefox OS platform developers, as well as teams porting the operating system to new hardware.</p>
<h2 id="The_app_startup_process">The app startup process</h2>
<p>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 {{domxref("App")}} API, then calling the {{domxref("App.launch()")}} method to launch the app.</p>
<p>Gecko receives that request and sends the {{event("mozChromeEvent")}} to the System app with the app's details. The System app handles that event by inserting a new {{HTMLElement("iframe")}} into its DOM tree and loading the app within the new {{HTMLElement("iframe")}}. That frame will be the app's home until it terminates.</p>
<p>Every app requires a manifest that describes the app, and has a particular file hierarchy within its package. For details, see the article <a href="/en-US/docs/Apps/App_Manifest" title="/en-US/docs/Apps/App_Manifest">App manifest</a>.</p>
<h2 id="Communication_with_Gecko">Communication with Gecko</h2>
<p>The communication between Gecko and Gaia's System app is done via {{event("mozChromeEvent")}} and {{event("mozContentEvent")}}. <code>mozChromeEvent</code>s are broadcast from chrome to content and <code>mozContentEvent</code>s 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.</p>
<div class="note">
  <p><strong>Note:</strong> We need to improve documentation about this, although it's primarily of interest to people working on the System app and the underlying support code for it. For now, you can glean a lot about how this is used by looking at the code in {{source("b2g/chrome/content/shell.js")}}.</p>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li><a href="/en-US/docs/Apps" title="/en-US/docs/Apps">Apps</a></li>
  <li>{{domxref("App")}}</li>
</ul>
Revert to this revision