xpcom/system/nsIBlocklistService.idl
author Ehsan Akhgari <ehsan@mozilla.com>
Wed, 22 Aug 2012 11:56:38 -0400
changeset 104976 a16372ce30b5f6b747246b01fcd215a4bf3b6342
parent 100872 18d69de4ff6700d624a450602e86347188c3a949
permissions -rw-r--r--
Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double

/* -*- 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 nsIPluginTag;
interface nsIVariant;

[scriptable, uuid(cbba15b8-316d-4ae6-8ed9-fe9cf8386730)]
interface nsIBlocklistService : nsISupports
{
  // Indicates that the item does not appear in the blocklist.
  const unsigned long STATE_NOT_BLOCKED = 0;
  // Indicates that the item is in the blocklist but the problem is not severe
  // enough to warant forcibly blocking.
  const unsigned long STATE_SOFTBLOCKED = 1;
  // Indicates that the item should be blocked and never used.
  const unsigned long STATE_BLOCKED     = 2;
  // Indicates that the item is considered outdated, and there is a known
  // update available.
  const unsigned long STATE_OUTDATED    = 3;
  // Indicates that the item is vulnerable and there is an update.
  const unsigned long STATE_VULNERABLE_UPDATE_AVAILABLE = 4;
  // Indicates that the item is vulnerable and there is no update.
  const unsigned long STATE_VULNERABLE_NO_UPDATE = 5;

  /**
   * Determine if an item is blocklisted
   * @param   id
   *          The ID of the item.
   * @param   version
   *          The item's version.
   * @param   appVersion
   *          The version of the application we are checking in the blocklist.
   *          If this parameter is null, the version of the running application
   *          is used.
   * @param   toolkitVersion
   *          The version of the toolkit we are checking in the blocklist.
   *          If this parameter is null, the version of the running toolkit
   *          is used.
   * @returns true if the item is compatible with this version of the
   *          application or this version of the toolkit, false, otherwise.
   */
  boolean isAddonBlocklisted(in AString id, in AString version,
                             [optional] in AString appVersion,
                             [optional] in AString toolkitVersion);

  /**
   * Determine the blocklist state of an add-on
   * @param   id
   *          The ID of the item.
   * @param   version
   *          The item's version.
   * @param   appVersion
   *          The version of the application we are checking in the blocklist.
   *          If this parameter is null, the version of the running application
   *          is used.
   * @param   toolkitVersion
   *          The version of the toolkit we are checking in the blocklist.
   *          If this parameter is null, the version of the running toolkit
   *          is used.
   * @returns The STATE constant.
   */
  unsigned long getAddonBlocklistState(in AString id, in AString version,
                                       [optional] in AString appVersion,
                                       [optional] in AString toolkitVersion);

  /**
   * Determine the blocklist state of a plugin
   * @param   plugin
   *          The plugin to get the state for
   * @param   appVersion
   *          The version of the application we are checking in the blocklist.
   *          If this parameter is null, the version of the running application
   *          is used.
   * @param   toolkitVersion
   *          The version of the toolkit we are checking in the blocklist.
   *          If this parameter is null, the version of the running toolkit
   *          is used.
   * @returns The STATE constant.
   */
  unsigned long getPluginBlocklistState(in nsIPluginTag plugin,
                                        [optional] in AString appVersion,
                                        [optional] in AString toolkitVersion);

  /**
   * Determine the blocklist web page of an add-on.
   * @param   id
   *          The ID of the blocked add-on.
   * @returns The URL of the description page.
   */
  AString getAddonBlocklistURL(in AString id, in AString version,
                              [optional] in AString appVersion,
                              [optional] in AString toolkitVersion);

  /**
   * Determine the blocklist web page of a plugin.
   * @param   plugin
   *          The blocked plugin that we are determining the web page for.
   * @returns The URL of the description page.
   */
  AString getPluginBlocklistURL(in nsIPluginTag plugin);
};

/**
 * nsIBlocklistPrompt is used, if available, by the default implementation of 
 * nsIBlocklistService to display a confirmation UI to the user before blocking
 * extensions/plugins.
 */
[scriptable, uuid(36f97f40-b0c9-11df-94e2-0800200c9a66)]
interface nsIBlocklistPrompt : nsISupports
{
  /**
   * Prompt the user about newly blocked addons. The prompt is then resposible
   * for soft-blocking any addons that need to be afterwards
   *
   * @param  aAddons
   *         An array of addons and plugins that are blocked. These are javascript
   *         objects with properties:
   *          name    - the plugin or extension name,
   *          version - the version of the extension or plugin,
   *          icon    - the plugin or extension icon,
   *          disable - can be used by the nsIBlocklistPrompt to allows users to decide
   *                    whether a soft-blocked add-on should be disabled,
   *          blocked - true if the item is hard-blocked, false otherwise,
   *          item    - the nsIPluginTag or Addon object
   * @param  aCount
   *         The number of addons
   */
  void prompt([array, size_is(aCount)] in nsIVariant aAddons,
              [optional] in uint32_t aCount);
};