B2G/FAQ/Apps

From MozillaWiki
< B2G‎ | FAQ
Jump to: navigation, search

DISCLAIMER: This page is informational only. The content here itself along does not imply and commitment, official policies, of Mozilla nor any other parties. We also do not promise to keep this page up-to-date and guarantee it's accuracy. Please look at the history and make your own informed decisions.

This page tried to address common technical questions for writing web applications for Firefox OS. Please also read B2G/FAQ, the parent page, for general overview FAQ about the project.

Frequently asked questions about running apps on Firefox OS

Which PC-version browser is the most similar with the embedded browser?
  • Firefox 18 for v1.0.1/v1.1
  • Firefox 26 for v1.2
  • You can use firefoxos simulator addon to test some current release device support level. (though some hardware related features need real device)
JS is a good language, but it's too free from restrictions. Do you have any plans to support dart vm by any chance?

Various languages can be compiled to JS (include Dart):

- Dart 2 JS: https://www.dartlang.org/docs/dart-up-and-running/contents/ch04-tools-dart2js.html
- More: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

However we recommend people to code in JS directly, or using Emscripten to port existing code to Javascript. Mozilla will not directly support any other language on the web in foreseeable future.

What's the reason to use tcpsocket instead of websocket?

TCPSocket API enables you to use the socket directly so no modification is needed on the server-side. Application can implement any protocol with this API. WebSocket is TCP socket wrapped in an HTTP(S) request; app could always use that however the sever need to be specially configured (to "fuse" HTTP(S) with any socket protocol)

What are the functions developed internally, instead of html5 spec?

Mozilla is one of the driven force of html5 specs. all of Mozilla-initiated works are open and can be tracked from those references url:

- Planning: https://wiki.mozilla.org/WebAPI
- Documentation: https://developer.mozilla.org/en-US/docs/WebAPI

All of the APIs prefixed with moz* are considered APIs developed internally by Mozilla. We would like to start implementing and experimenting (with partners and the users) so that we can propose a sound and confirmed spec to the standard body.

Spec in the standard organizations are the results of the joint co-operation of the web industury, not the prerequisite. We are very welcome to hearing feedbacks from developers as the API design envolves.

Does it support background mode? We couldn't find it clearly, although it seems to be possible.

B2G running on a memory model, like conventional mobile OSes, where the background processes will be killed by the system at will. If your app need to maintain a background presence for keeping connections, etc., we recommend the following alternative approach: - Using Simple Push API to have the user to launch your app only if the she/he interact with the notification sent from the server. - Alarm API allow your app to be launched in background from time to time. You may have the app launch itself every 10 min to pull data from the server.


We had developed web client for a long time but we didn't use it from FF 3.x as it was slower than other browsers such as chrome. How much improvement did you make after that?

In June 30, 2013, Tom's hardware reports Firefox stands out from comparison between modern browsers. With no shortpoint and wins for start-up time and reliability testing.

- http://www.tomshardware.com/reviews/chrome-27-firefox-21-opera-next,3534-12.html

Desktop Firefox have greatly improved since 3.x. There is no sigifigent speed differences between browsers anymore as of 2013. For JS performance benchmark on browser, the latest result can be found on

- http://arewefastyet.com/
We're concerned about the performance due to low hardware spec when we proceed with big projects even though we optimized the resources such as js, html, css and images. What are your countermeasures for bad performance?

As previously mentioned, the OS will try to kill as many background app as possible to enable the foreground app to use the full power of the phone. Other than that, the app itself need to manage it's own memory. Several architecture choices affect performances or can be applied later: Moving animations work to the GPU with CSS3, keeping the DOM light, avoid unnecessary repaints, avoiding long sync operations (use Web Worker), store/retrieve big data in asynchronous batches (IndexedDB) etc

What kinds of web apps do you have in your app store? Do you have messenger apps? If not, do you have any plans to develop major messenger apps for Firefox OS?

Any web-based app can be used on Firefox OS device even its not in the app store (Marketplace). Marketplace is available for Firefox OS/Android mobile phone and desktop. : There are 18 categories of apps right now. LOQUI is one of messenger app on marketplace.

We are actively contact messenger app providers to support Firefox OS device. There are currently no plan to develop a built-in instant messenger app for Firefox OS, other than the SMS/MMS app.

When the web app is run through proxy after its certain source file is revised, it can be vulnerable in terms of security. What are your countermeasures?

Always use HTTPS for network connections.

Could you send us the html5 performance data of each handset?

We don't report performance data per device. We recommend testing on target hardware that Mozilla can provide.

How does the security system work?

Many perspectives of system or user security concerns are addressed in official documentation. In summarize, each app runs in its own profile which separates runtime and persisted data between apps. This prevents other apps to look into your code or data.

We're curious about the security system as the source of web app can be easily obtained like other web. It's easy to open the source level of html5. Can we resolve those security issues with packaging?

To protect developers properties, you can refer to webpage games and learn from their experience. If your source code is generated by Emscripten or process by obfuscator or optimzer like google closure tool, your original source code is as protected as any platforms that runs byte code. Running such preprocessor before publish your webapp can protect your resources. Keeping some intelligent operations on server side also helps.

Any alternatives to html5? We need to know whether it's possible to develop native app which can replace html5 as it is pessimistic at this moment.

Firefox OS native app are HTML5 webapp. Compiled app is not in our road map.