Bug 537180 - Fennec uses old blocklisting URL [r=dtownsend a=blocking-fennec]
authorWesley Johnston <wjohnston@mozilla.com>
Wed, 01 Sep 2010 21:35:06 -0400
changeset 51866 d81c3c24a14bca073c91f719132a0000d3468a9f
parent 51865 cbbccc115e555e4cc0b7aacd6c70b21131df87f7
child 51867 45d8f81c82cf5365f70d61d67b1cace17b15b45b
push idunknown
push userunknown
push dateunknown
reviewersdtownsend, blocking-fennec
bugs537180
milestone2.0b6pre
Bug 537180 - Fennec uses old blocklisting URL [r=dtownsend a=blocking-fennec]
toolkit/mozapps/extensions/nsBlocklistService.js
xpcom/system/nsIBlocklistService.idl
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -861,16 +861,27 @@ Blocklist.prototype = {
           }
         }
         plugins[i].blocklisted = state == Ci.nsIBlocklistService.STATE_BLOCKED;
       }
 
       if (addonList.length == 0)
         return;
 
+      if ("@mozilla.org/addons/blocklist-prompt;1" in Cc) {
+        try {
+          let blockedPrompter = Cc["@mozilla.org/addons/blocklist-prompt;1"]
+                                 .getService(Ci.nsIBlocklistPrompt);
+          blockedPrompter.prompt(addonList);
+        } catch (e) {
+          LOG(e);
+        }
+        return;
+      }
+
       var args = {
         restart: false,
         list: addonList
       };
       // This lets the dialog get the raw js object
       args.wrappedJSObject = args;
 
       var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
--- a/xpcom/system/nsIBlocklistService.idl
+++ b/xpcom/system/nsIBlocklistService.idl
@@ -35,16 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsISupports.idl"
 
 interface nsIPluginTag;
+interface nsIVariant;
 
 [scriptable, uuid(8439f9c0-da03-4260-8b21-dc635eed28fb)]
 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.
@@ -109,8 +110,37 @@ interface nsIBlocklistService : nsISuppo
    *          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);
 };
+
+/**
+ * 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 PRUint32 aCount);
+};