1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/system/nsIBlocklistService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,131 @@ 1.4 +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsIPluginTag; 1.13 +interface nsIVariant; 1.14 + 1.15 +[scriptable, uuid(d463dfbb-89c4-4553-97af-b4fd8854e161)] 1.16 +interface nsIBlocklistService : nsISupports 1.17 +{ 1.18 + // Indicates that the item does not appear in the blocklist. 1.19 + const unsigned long STATE_NOT_BLOCKED = 0; 1.20 + // Indicates that the item is in the blocklist but the problem is not severe 1.21 + // enough to warant forcibly blocking. 1.22 + const unsigned long STATE_SOFTBLOCKED = 1; 1.23 + // Indicates that the item should be blocked and never used. 1.24 + const unsigned long STATE_BLOCKED = 2; 1.25 + // Indicates that the item is considered outdated, and there is a known 1.26 + // update available. 1.27 + const unsigned long STATE_OUTDATED = 3; 1.28 + // Indicates that the item is vulnerable and there is an update. 1.29 + const unsigned long STATE_VULNERABLE_UPDATE_AVAILABLE = 4; 1.30 + // Indicates that the item is vulnerable and there is no update. 1.31 + const unsigned long STATE_VULNERABLE_NO_UPDATE = 5; 1.32 + 1.33 + /** 1.34 + * Determine if an item is blocklisted 1.35 + * @param addon 1.36 + * The addon item to be checked. 1.37 + * @param appVersion 1.38 + * The version of the application we are checking in the blocklist. 1.39 + * If this parameter is null, the version of the running application 1.40 + * is used. 1.41 + * @param toolkitVersion 1.42 + * The version of the toolkit we are checking in the blocklist. 1.43 + * If this parameter is null, the version of the running toolkit 1.44 + * is used. 1.45 + * @returns true if the item is compatible with this version of the 1.46 + * application or this version of the toolkit, false, otherwise. 1.47 + */ 1.48 + boolean isAddonBlocklisted(in jsval addon, 1.49 + [optional] in AString appVersion, 1.50 + [optional] in AString toolkitVersion); 1.51 + 1.52 + /** 1.53 + * Determine the blocklist state of an add-on 1.54 + * @param id 1.55 + * The addon item to be checked. 1.56 + * @param appVersion 1.57 + * The version of the application we are checking in the blocklist. 1.58 + * If this parameter is null, the version of the running application 1.59 + * is used. 1.60 + * @param toolkitVersion 1.61 + * The version of the toolkit we are checking in the blocklist. 1.62 + * If this parameter is null, the version of the running toolkit 1.63 + * is used. 1.64 + * @returns The STATE constant. 1.65 + */ 1.66 + unsigned long getAddonBlocklistState(in jsval addon, 1.67 + [optional] in AString appVersion, 1.68 + [optional] in AString toolkitVersion); 1.69 + 1.70 + /** 1.71 + * Determine the blocklist state of a plugin 1.72 + * @param plugin 1.73 + * The plugin to get the state for 1.74 + * @param appVersion 1.75 + * The version of the application we are checking in the blocklist. 1.76 + * If this parameter is null, the version of the running application 1.77 + * is used. 1.78 + * @param toolkitVersion 1.79 + * The version of the toolkit we are checking in the blocklist. 1.80 + * If this parameter is null, the version of the running toolkit 1.81 + * is used. 1.82 + * @returns The STATE constant. 1.83 + */ 1.84 + unsigned long getPluginBlocklistState(in nsIPluginTag plugin, 1.85 + [optional] in AString appVersion, 1.86 + [optional] in AString toolkitVersion); 1.87 + 1.88 + /** 1.89 + * Determine the blocklist web page of an add-on. 1.90 + * @param addon 1.91 + * The addon item whose url is required. 1.92 + * @returns The URL of the description page. 1.93 + */ 1.94 + AString getAddonBlocklistURL(in jsval addon, 1.95 + [optional] in AString appVersion, 1.96 + [optional] in AString toolkitVersion); 1.97 + 1.98 + /** 1.99 + * Determine the blocklist web page of a plugin. 1.100 + * @param plugin 1.101 + * The blocked plugin that we are determining the web page for. 1.102 + * @returns The URL of the description page. 1.103 + */ 1.104 + AString getPluginBlocklistURL(in nsIPluginTag plugin); 1.105 +}; 1.106 + 1.107 +/** 1.108 + * nsIBlocklistPrompt is used, if available, by the default implementation of 1.109 + * nsIBlocklistService to display a confirmation UI to the user before blocking 1.110 + * extensions/plugins. 1.111 + */ 1.112 +[scriptable, uuid(ba915921-b9c0-400d-8e4f-ca1b80c5699a)] 1.113 +interface nsIBlocklistPrompt : nsISupports 1.114 +{ 1.115 + /** 1.116 + * Prompt the user about newly blocked addons. The prompt is then resposible 1.117 + * for soft-blocking any addons that need to be afterwards 1.118 + * 1.119 + * @param aAddons 1.120 + * An array of addons and plugins that are blocked. These are javascript 1.121 + * objects with properties: 1.122 + * name - the plugin or extension name, 1.123 + * version - the version of the extension or plugin, 1.124 + * icon - the plugin or extension icon, 1.125 + * disable - can be used by the nsIBlocklistPrompt to allows users to decide 1.126 + * whether a soft-blocked add-on should be disabled, 1.127 + * blocked - true if the item is hard-blocked, false otherwise, 1.128 + * item - the nsIPluginTag or Addon object 1.129 + * @param aCount 1.130 + * The number of addons 1.131 + */ 1.132 + void prompt([array, size_is(aCount)] in nsIVariant aAddons, 1.133 + [optional] in uint32_t aCount); 1.134 +};