当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - disable firefox extension programmatically

问题描述:

I'm having a problem trying to disable Firefox extensions programmatically. Right now, I'm modifying the extension.json file , changing the 2 parameters , active and userDisabled , but without any success. Despite the fact that in the extension menu it appears to be disabled , the icon of extensions still appear in the toolbar and I can see that the extensions still work. Is there a way to make this work using C++ ?

网友答案:

That won't work you have to use AddonManager.jsm to change the property like this:

Cu.import('resource://gre/modules/AddonManager.jsm');
AddonManager.getAddonByID('[email protected]', function(addon) { //id of the addon
  console.info('addon:', addon);
  addon.userDisabled = false; //set to true to enable it
});
分享给朋友:
您可能感兴趣的文章:
随机阅读: