mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1150683 - Add XPCOM interfaces for push notifications. r=dougt
--- b2g/installer/package-manifest.in | 1 + browser/installer/package-manifest.in | 1 + dom/interfaces/push/moz.build | 12 ++++++ dom/interfaces/push/nsIPushNotificationService.idl | 49 ++++++++++++++++++++++ .../push/nsIPushObserverNotification.idl | 30 +++++++++++++ dom/moz.build | 1 + mobile/android/installer/package-manifest.in | 1 + 7 files changed, 95 insertions(+) create mode 100644 dom/interfaces/push/moz.build create mode 100644 dom/interfaces/push/nsIPushNotificationService.idl create mode 100644 dom/interfaces/push/nsIPushObserverNotification.idl
This commit is contained in:
parent
82eb0d980a
commit
b292c26440
@ -209,6 +209,7 @@
|
||||
@RESPATH@/components/dom_json.xpt
|
||||
@RESPATH@/components/dom_messages.xpt
|
||||
@RESPATH@/components/dom_power.xpt
|
||||
@RESPATH@/components/dom_push.xpt
|
||||
@RESPATH@/components/dom_quota.xpt
|
||||
@RESPATH@/components/dom_range.xpt
|
||||
@RESPATH@/components/dom_security.xpt
|
||||
|
@ -218,6 +218,7 @@
|
||||
@RESPATH@/components/dom_offline.xpt
|
||||
@RESPATH@/components/dom_json.xpt
|
||||
@RESPATH@/components/dom_power.xpt
|
||||
@RESPATH@/components/dom_push.xpt
|
||||
@RESPATH@/components/dom_quota.xpt
|
||||
@RESPATH@/components/dom_range.xpt
|
||||
@RESPATH@/components/dom_security.xpt
|
||||
|
12
dom/interfaces/push/moz.build
Normal file
12
dom/interfaces/push/moz.build
Normal file
@ -0,0 +1,12 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIPushNotificationService.idl',
|
||||
'nsIPushObserverNotification.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_push'
|
49
dom/interfaces/push/nsIPushNotificationService.idl
Normal file
49
dom/interfaces/push/nsIPushNotificationService.idl
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* A service for components to subscribe and receive push messages from web
|
||||
* services. This functionality is exposed to content via the Push API, which
|
||||
* uses service workers to notify applications. This interface exists to allow
|
||||
* privileged code to receive messages without migrating to service workers.
|
||||
*/
|
||||
[scriptable, uuid(32028e38-903b-4a64-a180-5857eb4cb3dd)]
|
||||
interface nsIPushNotificationService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Creates a push subscription for the given |scope| URL and |pageURL|.
|
||||
* Returns a promise for the new subscription record, or the existing
|
||||
* record if this |scope| already has a subscription.
|
||||
*
|
||||
* The |pushEndpoint| property of the subscription record is a URL string
|
||||
* that can be used to send push messages to subscribers. For details,
|
||||
* please see the Simple Push protocol docs.
|
||||
*
|
||||
* Each incoming message fires a `push-notification` observer
|
||||
* notification, with an `nsIPushObserverNotification` as the subject and
|
||||
* the |scope| as the data.
|
||||
*
|
||||
* If the server drops a subscription, a `push-subscription-change` observer
|
||||
* will be fired, with the subject set to `null` and the data set to |scope|.
|
||||
* Servers may drop subscriptions at any time, so callers should recreate
|
||||
* subscriptions if desired.
|
||||
*/
|
||||
jsval register(in string scope, [optional] in string pageURL);
|
||||
|
||||
/**
|
||||
* Revokes a push subscription for the given |scope|. Returns a promise
|
||||
* for the revoked subscription record, or `null` if the |scope| is not
|
||||
* subscribed to receive notifications.
|
||||
*/
|
||||
jsval unregister(in string scope);
|
||||
|
||||
/**
|
||||
* Returns a promise for the subscription record associated with the
|
||||
* given |scope|, or `null` if the |scope| does not have a subscription.
|
||||
*/
|
||||
jsval registration(in string scope);
|
||||
};
|
30
dom/interfaces/push/nsIPushObserverNotification.idl
Normal file
30
dom/interfaces/push/nsIPushObserverNotification.idl
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* A push message received by an `nsIPushNotificationService`, used as the
|
||||
* subject of a `push-notification` observer notification.
|
||||
*/
|
||||
[scriptable, uuid(66a87970-6dc9-46e0-ac61-adb4a13791de)]
|
||||
interface nsIPushObserverNotification : nsISupports
|
||||
{
|
||||
/* The URL that receives push messages from an application server. */
|
||||
attribute string pushEndpoint;
|
||||
|
||||
/**
|
||||
* The notification version sent by the application server. This is a
|
||||
* monotonically increasing number.
|
||||
*/
|
||||
attribute long long version;
|
||||
|
||||
/**
|
||||
* The notification payload. Delivery is not guaranteed; if the browser is
|
||||
* offline when the application server sends the push message, the payload
|
||||
* may be discarded.
|
||||
*/
|
||||
attribute string data;
|
||||
};
|
@ -26,6 +26,7 @@ interfaces = [
|
||||
'storage',
|
||||
'json',
|
||||
'offline',
|
||||
'push',
|
||||
'geolocation',
|
||||
'notification',
|
||||
'permission',
|
||||
|
@ -151,6 +151,7 @@
|
||||
@BINPATH@/components/dom_json.xpt
|
||||
@BINPATH@/components/dom_payment.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
@BINPATH@/components/dom_push.xpt
|
||||
@BINPATH@/components/dom_quota.xpt
|
||||
@BINPATH@/components/dom_range.xpt
|
||||
@BINPATH@/components/dom_security.xpt
|
||||
|
Loading…
Reference in New Issue
Block a user