||The Push component runs in the child process and exposes the Push API
to the web application. The PushService running in the parent process is the
one actually performing all operations.
||Convert the listeners from our on-disk format to the format
needed by a hello message.
interact with the Push service.
||Localized error property names.
The record to be added.
||PushManager and PushSubscription are exposed on the main and worker threads.
The main thread version is implemented in Push.js. The JS implementation
makes it easier to use certain APIs like the permission prompt and Promises.
Unfortunately, JS-implemented WebIDL is not supported off the main thread.
To work around this, we use a chain of runnables to query the JS-implemented
nsIPushService component for subscription information, and return the
results to the worker. We don't have to deal with permission prompts, since
we just reject calls if the principal does not have permission.
On the main thread, PushManager wraps a JS-implemented PushManagerImpl
instance. The C++ wrapper is necessary because our bindings code cannot
accomodate "JS-implemented on the main thread, C++ on the worker" bindings.
PushSubscription is in C++ on both threads since it isn't particularly
verbose to implement in C++ compared to JS.
||`PushDispatcher` is a base class used to forward observer notifications and
service worker events to the correct process.
||The push subscription record, stored in IndexedDB.
||State is change only in couple of functions:
init - change state to PUSH_SERVICE_INIT if state was PUSH_SERVICE_UNINIT
changeServerURL - change state to PUSH_SERVICE_ACTIVATING if serverURL
present or PUSH_SERVICE_INIT if not present.
changeStateConnectionEnabledEvent - it is call on pref change or during
the service activation and it can
change state to
changeStateOfflineEvent - it is called when offline state changes or during
the service activation and it change state to
uninit - change state to PUSH_SERVICE_UNINIT.
||A proxy between the PushService and connections listening for incoming push
messages. The PushService can silence messages from the connections by
setting PushSubscriptionListener._pushService to null. This is required
because it can happen that there is an outstanding push message that will
be send on OnStopRequest but the PushService may not be interested in these.
It's easier to stop listening than to have checks at specific points.
||A proxy between the PushService and the WebSocket. The listener is used so
that the PushService can silence messages from the WebSocket by setting
PushWebSocketListener._pushService to null. This is required because
a WebSocket can continue to send messages or errors after it has been
closed but the PushService may not be interested in these. It's easier to
stop listening than to have checks at specific points.