gecko/dom/interfaces/push/nsIPushClient.idl
Nikhil Marathe 812956b4c1 Bug 1184574 - Allow access to PushManager on ServiceWorker. r=kitcambridge,smaug,catalinb
Refactoring to allow access to PushManager in ServiceWorkerGlobalScope. See comment in PushManager.h for details.
2015-07-23 08:30:15 -07:00

54 lines
2.0 KiB
Plaintext

/* -*- 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"
interface nsIPrincipal;
/**
* Satisfies contracts similar to the Push API specification.
*
* If status is not NS_OK, endpoint should be ignored. When subscribing to
* a new endpoint, endpoint will be a valid URL on success, when querying for
* the presence of an existing subscription, this will be an empty string if
* the calling {scope+principal} does not currently have an associated
* endpoint.
*/
[scriptable, uuid(0bcac389-a3ac-44a4-97fb-b50e41a46146)]
interface nsIPushEndpointCallback : nsISupports
{
void onPushEndpoint(in nsresult status, in DOMString endpoint);
};
/**
* Satisfies contracts similar to the Push API specification.
*
* If status is not NS_OK, there was a problem unsubscribing and success should
* be ignored. success is true if unsubscribing was successful and false if
* there was no subscription.
*/
[scriptable, uuid(9522934d-e844-4f2f-81e8-48c3947b44de)]
interface nsIUnsubscribeResultCallback : nsISupports
{
void onUnsubscribe(in nsresult status, in bool success);
};
/**
* Provides an XPIDL component to interact with the PushService from content
* processes. Unlike PushManager, this has no relationship to the DOM and is
* not exposed to web content. This was added to allow ServiceWorkers to use
* it by dispatching appropriate runnables to the main thread.
*/
[scriptable, uuid(6622d599-439e-4ad1-af32-c941bd2b9968)]
interface nsIPushClient : nsISupports
{
void subscribe(in DOMString scope, in nsIPrincipal principal, in nsIPushEndpointCallback callback);
void unsubscribe(in DOMString scope, in nsIPrincipal principal, in nsIUnsubscribeResultCallback callback);
void getSubscription(in DOMString scope, in nsIPrincipal principal, in nsIPushEndpointCallback callback);
};