NoSystemMessageForWEB

From MozillaWiki
Jump to: navigation, search

System Message is now a part of Runtime and Security Model for Web Applications. The functions of System Message is to wake up an application and deliver messages to the application. We really need a way to wake up an application for some types of events. But, do we really need another event/message system other than DOM Event? In the experiences of working on B2G project, System Message is always/usually a replacement of DOM Event for delivering events to applications while the application can be in a sleep. Actually, what we really need is to deliver DOM events even applications are sleeping/not running. So, what we need to do is let an applications to register itself for what kind of events will wake it up, and dispatch events once the application register an event handler after waked up.

My suggestion to hide System Message from applications. As a replacement, applications register them self for wakeup events when they are installed, so an application will be waked up when some events are happening if it is not running. But, the events are still dispatched through DOM Events. It means DOM Events will be queued if someone should be waked up for that event.

Implementation

NoSystemMessage.jpg

We still use System Message, but only in UA code. Web applications should not know System Message anymore. The API implementation for content processes should listen to System Messages and translate System Messages to DOM Events. So, DOM Events that should wake up some applications are always dispatching through System Messages to make sure applications waked up by the DOM event will be waked up if not running.

When to Deliver Pending Events

An explicit signal to tell platform ready for receiving messages. We can have one function to tell UA to deliver all events.