title: Check if a Firefox 3.5 add-on is enabled
body: <p>In order inform the user of possible conflicts, I'd like to have my add-on check if another add-on is installed <em>and enabled</em>. If so, I can disable either it or my own at the user's bequest:</p>
  
  <pre><code>function disableExtension(id) {
      var man = Components.classes["@mozilla.org/extensions/manager;1"];
      if (man) {
          man = man.getService(Components.interfaces.nsIExtensionManager);
      }
      if (man) {
          man.disableItem(id);
      } else {
          Components.utils.import("resource://gre/modules/AddonManager.jsm");
          AddonManager.getAddonByID(id, function(addon) {
              addon.userDisabled = true;
          });
      }
  }
  </code></pre>
  
  <p>But I first, of course have to check if a certain other add-on is installed. Presently, I do this as follows:</p>
  
  <pre><code>if (Application.extensions) {
      // Gecko 1.9.2 and older
      ext = Application.extensions.get(id);
      if (ext) {
          // TODO check if extension is also enabled
          disableExtension(id);
      }
  } else {
      // Gecko 2.0.0 and newer
      Application.getExtensions(function(extensions) {
          ext = extensions.get(id);
          Components.utils.import("resource://gre/modules/AddonManager.jsm");
          AddonManager.getAddonByID(id, function(addon) {
              if (!addon.userDisabled) {
                  disableExtension(id);
              }
          });
      })
  }
  </code></pre>
  
  <p>The code for Firefox 4 (the <code>else</code>-statement) works fine. For older versions of Firefox (3.5 and older), I can't for the life of me figure out how to determine if the extension is in fact installed.</p>
  
  <p>Does anybody know how to do this?</p>