CloudServices/FirefoxMobileServices: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 75: Line 75:
== Talkilla ==
== Talkilla ==


XXX
* Ability to see if friends want to receive calls
* Ability to send Talkbox tokens through LiveNotifications to avoid storage of tokens in cloud storage


= Firefox OS Integration =
= Firefox OS Integration =

Revision as of 19:35, 7 March 2014

Last updated: 2014/03/07
Draft-template-image.png THIS PAGE IS A WORKING DRAFT Pencil-emoji U270F-gray.png
The page may be difficult to navigate, and some information on its subject might be incomplete and/or evolving rapidly.
If you have any questions or ideas, please add them as a new topic on the discussion page.

Overview

This project proposal is to provide a way for Mozilla Cloud Services to have an established way to push new services out (without bogging down FxOS releases) to increase the service-based capabilities of FxOS for app developers and address urgent security holes that may occur. It could be considered similar in spirit to Google Mobile Services on Android (except everything including the server-side service components are completely open-sourced).

The initial focus will be on creating the FMS API's for FxOS which can integrate with the Preferences panel, and a small set of Javascript modules and framework for running them in on Firefox OS. At a later point a similar component with inter-process communication for Android should be created to expose similar functionality to web applications installed on Android devices.

Background

Currently Mozilla Cloud Services has landed the client-side code for projects such as Sync by integrating client-side code in the main code- base (Firefox, Fennec, etc). If/when security problems or exploits were found requiring an urgent fix Mozilla would issue a 'chem spill' emergency release of the project. This is a feasible approach (though labor intensive as it requires a complete release of the project) because Mozilla controls the release and distribution of Firefox for desktop and mobile devices. This approach is not viable for client-side services in Firefox OS because OEM's control the phone updates, not Mozilla or the users.

An additional constraint is that Cloud Services has plans to increase the service-based feature-set of Firefox OS (to attempt to match parity on some level with iOS/Android) which requires a much shorter release cycle than Firefox OS currently has. Being able to deploy new API's and update existing ones for new services quickly is important.

The two first projects at Cloud Services that added such code on the Firefox OS platform are SimplePush and Firefox Account

We're expecting that more projects (Presence) will do the same in the future, and this wiki page describes the biggest problems that were encountered and how we can make this integration work faster & easier for every one.

Features

Several features that are needed for client-side components that include a Mozilla Cloud Service:

  • A new app in Gaia for Cloud Services preferences/settings
  • Provide a Javascript DOM API namespace available to applications for Mozilla Cloud Services
  • Run a background service (SimplePush has an agent that holds open a connection)
  • Spawn a FxOS application (Push wakes applications to process notifications)

Use Cases

Simple Push

XXX Existing implementation in xpcoms within gecko

see https://bugzilla.mozilla.org/show_bug.cgi?id=822712

Firefox Account Service

XXX ?

Presence Service

XXX

Talkilla

  • Ability to see if friends want to receive calls
  • Ability to send Talkbox tokens through LiveNotifications to avoid storage of tokens in cloud storage

Firefox OS Integration

Adding features in Firefox OS can be done at several levels:

  • by creating an open web app at one of the 3 permission level: normal, privileged and certified
  • by extending Firefox OS at a lower level : Gecko, Gaia

The first solution offers a lot of advantages:

  • updates are very easy
  • applications can interact with most of the system using Web API
  • we're coding in pure HTML5/Javascript

There are some pitfalls however:

  • limited control when the application is in the background, which is the case for headless features
  • security restrictions. For example we can't load another app's UI
  • some restrictions in what can be done in sandboxed child processes (XXX elaborate)

The other option --extending the system at lower level-- has a few advantages:

  • there are no restrictions whatsoever in what can be done
  • the code is part of the B2G process, and is not treated like web apps. For example, it can be running in the background without fearing oomkiller

But the pitfalls are quite important:

  • the feature becomes part of B2G and must follow its release lifecycle, and fast iterations become impossible: once it's part of the system it's there forever. What if we need to push a security patch asap for Firefox Account ?
  • developing in the core is very hard for people outside the FFOS team because it's a moving target. It involves a lot of boiler plate code and knowledge, and is not about coding the web anymore (xpcom anyone? JSM?)

Proposal: Service Workers

We propose to add a new kind of worker in Firefox OS: Service Workers.

Service Workers are Web Workers that run in their own scope but with full chrome privileges -- like allow IDB, XHR etc

Services Workers can be defined in any web application, and are managed by a specialized component in Gecko: the Services Manager.

The Services Manager is responsible for the registration and lifecycle of Services Workers

serviceworker.jpg

XXX

Detailed Description

ServiceManager

XXX


ServiceWorker

XXX

References

Dump of useful links