1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6#include "nsISupports.idl"
7
8[scriptable, uuid(b58249f9-1a04-48cc-bc20-2c992d64c73e)]
9interface nsIPushErrorReporter : nsISupports
10{
11  /**
12   * Ack types, reported when the Push service acknowledges an incoming message.
13   *
14   * Acks are sent before the message is dispatched to the service worker,
15   * since the server delays new messages until all outstanding ones have been
16   * acked. |reportDeliveryError| will be called if an error occurs in the
17   * worker's `push` event handler after acking the message.
18  */
19  const uint16_t ACK_DELIVERED = 0;
20  const uint16_t ACK_DECRYPTION_ERROR = 1;
21  const uint16_t ACK_NOT_DELIVERED = 2;
22
23  /**
24   * Unsubscribe reasons, reported when the service drops a subscription.
25   */
26  const uint16_t UNSUBSCRIBE_MANUAL = 3;
27  const uint16_t UNSUBSCRIBE_QUOTA_EXCEEDED = 4;
28  const uint16_t UNSUBSCRIBE_PERMISSION_REVOKED = 5;
29
30  /**
31   * Delivery error reasons, reported when a service worker fails to handle
32   * an incoming push message in its `push` event handler.
33   */
34  const uint16_t DELIVERY_UNCAUGHT_EXCEPTION = 6;
35  const uint16_t DELIVERY_UNHANDLED_REJECTION = 7;
36  const uint16_t DELIVERY_INTERNAL_ERROR = 8;
37
38  /**
39   * Reports a `push` event handler error to the Push service. |messageId| is
40   * an opaque string passed to `nsIPushNotifier.notifyPush{WithData}`.
41   * |reason| is a delivery error reason.
42   */
43  void reportDeliveryError(in DOMString messageId,
44                           [optional] in uint16_t reason);
45};
46