[Project_owners] Disabling other plugins - Is there any way to do that?

Malte Kraus firefox at maltekraus.de
Fri Sep 12 06:47:36 PDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You have to query the rdf datasource. Just copied that function together
from the extension manager (which returns false if an add-on isn't
installed though):

function isAddonDisabled(uuid) {
  var rdfService =
Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
  var addon = rdfService.GetResource("urn:mozilla:item:" + uuid);

  var em =
Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
  var ds = em.datasource;

  var appRes =
rdfService.GetResource("http://www.mozilla.org/2004/em-rdf#appDisabled");
  var appDisabled = ds.GetTarget(addon, appRes, true);
  if(appDisabled instanceof Ci.nsIRDFLiteral && appDisabled.Value == "true")
    return true;

  var userRes =
rdfService.GetResource("http://www.mozilla.org/2004/em-rdf#userDisabled");
  var userDisabled = ds.GetTarget(addon, userRes, true);
  if(userDisabled instanceof Ci.nsIRDFLiteral && userDisabled.Value ==
"true")
    return true;

  return false;
}


Malte


Marco Pivetta schrieb:
> Just noticed there's no way to get if an extension is enabled from
> nsIExtensionManager... Could anybody help me out?
> I cannot just uninstall/disable concurrent/incompatible extensions... I
> obviously have to ask the user about it before! Anyone knows how to get a
> value showing if an extension is enabled from its ID?
> 
> 2008/7/31 Marco Pivetta <ocramius at gmail.com>
> 
>> Thank you, I'll check it out and let you know...
>>
>> 2008/7/31 Christopher Finke <cfinke at gmail.com>
>>
>> I believe this:
>>> http://www.xulplanet.com/references/xpcomref/ifaces/nsIExtensionManager.html#method_disableItem
>>> is what you're looking for.
>>>
>>> (MDC doesn't have all of the nsIExtensionManager documentation.)
>>>
>>> Chris
>>>
>>> On Wed, Jul 30, 2008 at 6:02 PM, Marco Pivetta <ocramius at gmail.com>
>>> wrote:
>>>> I lurked around all the MDC today and I did not find any answer.
>>>> There are two plugins that are in DIRECT conflict with StOgame
>>>> (standardogame), and I receive dozens of bug tickets every day. The
>>> default
>>>> answer is "Disable XXX and YYY before testing StOgame again".
>>>> My idea is to disable my plugin if those are active, or to enable my
>>> plugin
>>>> and disable those two. Is there any way to do that?
>>>> I'm sorry if it seems to be a foolish question, but I really didn't
>>> manage
>>>> to find anything about it...
>>>>
>>>> --
>>>> Standard Ogame Project - StOgame
>>>> http://www.stogame.net
>>>> Making Ogame a better place...
>>>>
>>>> _______________________________________________
>>>> Project_owners mailing list
>>>> Project_owners at mozdev.org
>>>> https://www.mozdev.org/mailman/listinfo/project_owners
>>>>
>>>>
>>> _______________________________________________
>>> Project_owners mailing list
>>> Project_owners at mozdev.org
>>> https://www.mozdev.org/mailman/listinfo/project_owners
>>>
>>
>>
>> --
>> Standard Ogame Project - StOgame
>> http://www.stogame.net
>> Making Ogame a better place...
>>
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> https://www.mozdev.org/mailman/listinfo/project_owners
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIynL4U9AX8TCX8csRAtsYAJ4pYMHaExqYeQzXXsWbETdVJBnorgCfTY4u
B68llHrde4CclTLL3OzCd6Y=
=dqHg
-----END PGP SIGNATURE-----


More information about the Project_owners mailing list