CloudServices/FirefoxMobileServices: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:
=Overview=
=Overview=


Mozilla Cloud Services (MCS) requires client-side portions for Firefox OS, and Firefox on Android (Fennec) that will need to be delivered on a separate release schedule from the product itself. Firefox Mobile Services (FMS) are a set of API's that will allow new client-side components of MCS to run in Firefox OS as a special component that runs independently of FxOS's parent loop but supplies a Preferences panels.
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).


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. 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.


The initial focus will be on creating the FMS API's for FxOS which can integrate with the Preferences panel, and the Service Workers that run each client-side service. 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=


=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.


Currently the only way to integrate client-side code to handle communication with MCS requires landing code in large code-bases that are typically focused on other platform capabilities and bugs. MCS does not have B2G device developers under it, therefore landing code in B2G or Fennec is difficult and done in an ad-hoc manner for each task as it arises.
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  
The two first projects at Cloud Services that added such code on the Firefox OS platform  
are [https://wiki.mozilla.org/WebAPI/SimplePush SimplePush] and [https://wiki.mozilla.org/Identity/Firefox-Accounts Firefox Account]
are [https://wiki.mozilla.org/WebAPI/SimplePush SimplePush] and [https://wiki.mozilla.org/Identity/Firefox-Accounts Firefox Account]


We're expecting that more projects will do the same in the future, and this wiki page describes  
We're expecting that more projects (Presence) will do the same in the
the biggest problems that were encountered and how we can make this integration work faster &  
future, and this wiki page describes the biggest problems that were
easier for every one.
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:
 
* Display a panel in the Preferences for the new service
* Provide a new Javascript API available to applications (the ability to look for new services, etc.)
* 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=
=Use Cases=
TODO build a list of Feature sets


== Simple Push ==
== Simple Push ==
Line 44: Line 77:
XXX
XXX


=Firefox OS Integration=
= Firefox OS Integration =


Adding features in Firefox OS can be done at several levels:
Adding features in Firefox OS can be done at several levels:
Line 103: Line 136:
Dump of useful links
Dump of useful links


* [https://github.com/slightlyoff/ServiceWorker a ServiceWorker project on github]
* [https://developer.mozilla.org/en-US/docs/Social_API/Service_worker_API_reference Social APIS Services Worker]
* [https://developer.mozilla.org/en-US/docs/Social_API/Service_worker_API_reference Social APIS Services Worker]
* [https://groups.google.com/forum/#!topic/mozilla.dev.webapi/NFXLBW5A0JU Initial discussion in WebAPI]
* [https://groups.google.com/forum/#!topic/mozilla.dev.webapi/NFXLBW5A0JU Initial discussion in WebAPI]
* [https://groups.google.com/forum/#!topic/mozilla.dev.webapps/9UxS0BXZD9M WebAPI micro proposal]
* [https://groups.google.com/forum/#!topic/mozilla.dev.webapps/9UxS0BXZD9M WebAPI micro proposal]
* [https://etherpad.mozilla.org/WorkerThreadAPIs More Web APIs in the works?]
* [https://etherpad.mozilla.org/WorkerThreadAPIs More Web APIs in the works?]

Revision as of 00:55, 27 February 2014

Last updated: 2014/02/27
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:

  • Display a panel in the Preferences for the new service
  • Provide a new Javascript API available to applications (the ability to look for new services, etc.)
  • 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

XXX

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