tenfourfox/dom/interfaces/push/nsIPushClient.idl
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

59 lines
2.3 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(d83e398f-9920-4451-b23a-6d5a5ad2fa26)]
interface nsIPushEndpointCallback : nsISupports
{
void onPushEndpoint(in nsresult status,
in DOMString endpoint,
in uint32_t keyLen,
[array, size_is(keyLen)] in octet key,
in uint32_t authSecretLen,
[array, size_is(authSecretLen)] in octet authSecret);
};
/**
* 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);
};